Create Enterprise Geodatabase from XML Workspace document

Note: I have updated this toolbox to include more functionality, ported it to a Python Toolbox, and created a GitHub repository for it.

Teaching classes frequently necessitates quickly creating and setting up enterprise geodatabases using ArcGIS SDE technology. To make my life easier, I keep demonstration datasets on hand as xml workspace documents. Still, the process has a lot of steps to set up. This is a perfect instance where a script can be used.

The Create Enterprise Geodatabase tool logs in as the database superuser, creates the geodatabase, assigns the SDE user as the database owner and licenses the geodatabase. Next a connection is created as the SDE user. Using this connection as the SDE user, the data owner is created in the geodatabase. Another connection is then made as the data owner. Finally, data is loaded through the data owner login.

On my laptop running PostgreSQL what used to be about a five to seven minute process now takes around a minute and half. You can download this script as a completed tool in a toolbox contained in a zipped archive.