As an instructor teaching ArcGIS Server classes, I frequently have the need to quickly set up new enterprise geodatabases for teaching demonstrations. To streamline this process, I recently created an ArcGIS Python Toolbox with three tools and have made it available on GitHub. To streamline the process even more, there is a location at the top to hard code in passwords if this does not pose too much of a security risk for you.
The toolbox contains three tools, Create SDE Workspace, File to SDE Workspace and XML to SDE Workspace. Create SDE Workspace sets up a new SDE geodatabase according to best practices by creating an SDE geodatabase, creating a connection as the sde user, adding a data owner user to the database and creating a connection as the data owner to load the data into. File to SDE Workspace does all of these steps using the name of the file geodatabase to name the new enterprise geodatabase, and copies everything from the file geodatabase to the enterprise geodatabase. XML to SDE Workspace also does all the steps in Create SDE Workspace using the name of the xml workspace file to name the new enterprise geodatabase, and loads the contents of the xml workspace file into the new SDE geodatabase.
I decided to make this project available through GitHub. Not only does GitHub provide a reliable location to access the tool, it also facilitates other people smarter than myself (this would be you) examining and possibly improving the code. Please feel free to download use and if you find improvements, submit a pull request. I welcome suggestions and improvements.
To further streamline the process of database setup, toward the top of the script there is a section for saving default passwords if this is not too much of a security risk for your workflows. I have detailed process for doing this on a wiki page associated with the GitHub project.
Hopefully this toolbox will save you a little time when you are scrambling to get a database set up quickly. If it helps you out, please post a comment below letting me know about it. Hearing success stories is always fun!
Resource: SDE Workspace Creation Toolbox on GitHub