Available with Standard or Advanced license.
How you create a geodatabase depends on situations at your site. Follow the instructions for the scenario that applies to your organization.
- You are the database and geodatabase administrator.
- The Oracle administrator configures the database; the geodatabase administrator creates the geodatabase.
- You want to store multiple geodatabases in the same Oracle database.
You are the database and geodatabase administrator
If you perform the role of both the database administrator and geodatabase administrator and, therefore, know the password for both logins, you can use the Create Enterprise Geodatabase geoprocessing tool or Python script to create a geodatabase in Oracle.
The Create Enterprise Geodatabase tool makes it easy to set up a geodatabase because it creates the sde user, schema, and tablespace, and grants required privileges to the sde user for you. To achieve this, the tool uses the following default settings:
- Creates a database user named sde
- Creates a 400 MB tablespace in the Oracle default location and sets it as the sde user's tablespace
- Grants the sde user privileges to create and upgrade a geodatabase, remove database connections, and import data using Oracle Data Pump (Oracle 12c only)
- Grants package privileges required to create a geodatabase
- Creates a geodatabase
For more information on required privileges, see Privileges for geodatabases in Oracle.
Before you run the tool or script to create a geodatabase, you must set up Oracle.
Install and configure Oracle
Before you create a geodatabase, Oracle must be installed and configured. How you configure the Oracle instance depends on the specific needs of your organization. Consult the Oracle documentation for installation and configuration information.
Check the ArcGIS system requirements for Oracle before you set up a geodatabase to be sure the Oracle, ArcGIS, and hardware combinations you want to use are supported.
If you require the ability to do any of the following, you also need to configure the Oracle extproc to access the Esri ST libraries:
- Execute ST_Geometry SQL functions from SQL clients.
- Access the XML columns in the GDB_ITEMS_VW and GDB_ITEMRELATIONSHIPS_VW geodatabase system views.
- Define a query layer in ArcMap or ArcGIS Pro that executes SQL functions on ST_Geometry columns.
- Publish data from the Oracle database.
After Oracle is installed and configured, install ArcGIS and Oracle clients.
Install and configure clients
You can install ArcGIS Desktop (Desktop Standard or Desktop Advanced), ArcGIS Engine Geodatabase Update, or ArcGIS Server (enterprise edition) and run a script to create a geodatabase. If you want to run the Create Enterprise Geodatabase geoprocessing tool instead of a script, install ArcGIS Desktop.
In most cases, your ArcGIS client will be installed on a different computer than Oracle. Therefore, you must have a supported Oracle client on the ArcGIS client computer to connect to the Oracle instance. See the Oracle documentation to determine which version of the Oracle client you should install to connect to the version of Oracle you are using and for instructions on installing and configuring the client.
- Install the ArcGIS client you want to use for geodatabase creation.
Follow the instructions provided in the software installation guides.
- Install and configure an Oracle client on the ArcGIS client computer.
If you are connecting from a 32-bit ArcGIS client (such as ArcMap), you must install a 32-bit Oracle client. This is true even if you install the ArcGIS client application on a computer with a 64-bit operating system and the database and server operating system are 64 bit. If you are connecting from a 64-bit ArcGIS client (such as ArcGIS Server or ArcGIS Pro), you must install a 64-bit Oracle client.
You can obtain the Oracle Instant, Runtime, or Administrator Client from Oracle. See the Oracle documentation for instructions to install.
- Set the environment variable of your operating system or user profile to include the path to and name of the directory where the Oracle client is installed.
- On Linux, set the LD_LIBRARY_PATH environment variable.
You can obtain the Oracle Instant, Runtime, or Administrator Client from Oracle. See the Oracle documentation for instructions to install.
. - On Windows, set the PATH environment variable. If ArcMap is installed on the same Windows computer as ArcGIS Pro or ArcGIS Server, set the PATH variable to read the 64-bit client before the 32-bit client. For example, if your 32-bit Oracle client is installed to c:\Program Files (x86)\Oracle and your 64-bit Oracle Instant Client is installed to c:\Program Files\Oracle, add the following to the beginning of your PATH variable value: C:\Program Files\Oracle;C:\Program Files (x86)\Oracle;.
- On Linux, set the LD_LIBRARY_PATH environment variable.
- If your ArcGIS client was already running, restart it to recognize the Oracle client and new environment variables.
- You can connect from ArcGIS to Oracle using an Easy Connect string. However, you must configure your Oracle database to allow Easy Connect strings. If you have the full Oracle client installed but want to use Easy Connect syntax to connect, be sure the sqlnet.ora file on the client is configured to allow the use of Easy Connect and the Oracle server is configured to allow Easy Connect syntax. See the Oracle documentation for further instructions.
Now you can create a geodatabase.
Create a geodatabase
You can run the Create Enterprise Geodatabase tool from ArcGIS Desktop (Desktop Standard or Desktop Advanced), or run a Python script from an ArcGIS Desktop, ArcGIS Server, or ArcGIS Engine client to create an sde user, schema, tablespace, and geodatabase.
Run the Create Enterprise Geodatabase tool
If you have access to ArcGIS Desktop, you can run a geoprocessing tool to create the geodatabase.
Follow these steps to create a geodatabase using the Create Enterprise Geodatabase tool in ArcMap:
- Start an ArcGIS Desktop client.
- Open the Create Enterprise Geodatabase tool.
You can search for or browse to this tool, which is located in the Geodatabase Administration toolset of the Data Management toolbox.
- Choose Oracle from the Database Platform drop-down list.
- Provide the information required to connect to the Oracle instance.
- If you have already configured the Oracle client to use a TNS network alias, type the Net service alias in the Instance text box.
- If you have not configured the Oracle client's network alias and your Oracle database and client are configured to use Easy Connect strings, provide the Oracle Easy Connect string in the Instance text box.
See Connect to Oracle from ArcGIS for a list of possible Easy Connect strings.
- Type the sys user's password in the Database Administrator Password text box.
- Type sde in the Geodatabase Administrator text box.
If the sde user does not already exist in the database, the tool creates it and grants it the privileges necessary to create a geodatabase. If the user already exists, the required privileges are granted to it.
- Type a password for the sde user in the Geodatabase Administrator Password text box.
If the sde user already exists in the database, be sure to type the correct password for the existing user; this tool will not change the password. If you are creating an sde user, the password you type is used when creating the sde user.
- Specify a tablespace for the sde user.
- If you have a preconfigured tablespace to be used for the geodatabase repository, type its name in the Tablespace Name text box.
- If you want the tool to create a tablespace for you, type a valid name in the Tablespace Name text box and the tool creates a 400 MB tablespace in the Oracle default location. If you do not type a tablespace name, SDE_TBS tablespace is created and set as the default tablespace for the sde user.
- To specify an Authorization File, browse to and choose the keycodes file that was created when you authorized ArcGIS Server Enterprise.
This file is written to the \\Program Files\ESRI\License<release#>\sysgen folder on Windows servers and /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen on Linux servers. Copy the keycodes file to a location the tool can access. If you have not already done so, authorize ArcGIS Server now to create this file.
- Click OK (ArcMap or ArcCatalog) or Run (ArcGIS Pro).
A geodatabase is created in your Oracle database.
Messages about geodatabase creation are written to the sde_setup.log file, which is created in the directory specified for your %TEMP% variable on the computer where the tool is run. If you have any problems creating a geodatabase, check this log file to troubleshoot the problem.
Next, if the Oracle database open_cursors parameter is set to anything other than 300, run the sde.gdb_util.update_open_cursors stored procedure to synchronize your Oracle database parameter with the geodatabase's setting.
Run a Python script
You can copy, save, and run the script provided here to create a geodatabase from ArcGIS Desktop (Desktop Standard or Desktop Advanced), ArcGIS Server, or ArcGIS Runtime (with the Geodatabase Update extension).
-
Create a text file on the ArcGIS client machine and copy the following script into the file.
""" Name: create_enterprise_gdb.py Description: Provide connection information to a DBMS instance and create an enterprise geodatabase. Type create_enterprise_gdb.py -h or create_enterprise_gdb.py --help for usage """ # Import system modules import arcpy import os import optparse import sys # Define usage and version parser = optparse.OptionParser(usage = "usage: %prog [Options]", version="%prog 1.0 for " + arcpy.GetInstallInfo()['Version'] ) #Define help and options parser.add_option ("--DBMS", dest="Database_type", type="choice", choices=['SQLSERVER', 'ORACLE', 'POSTGRESQL', ''], default="", help="Type of enterprise DBMS: SQLSERVER, ORACLE, or POSTGRESQL.") parser.add_option ("-i", dest="Instance", type="string", default="", help="DBMS instance name") parser.add_option ("-D", dest="Database", type="string", default="none", help="Database name: Do not specify for Oracle") parser.add_option ("--auth", dest="Account_authentication", type ="choice", choices=['DATABASE_AUTH', 'OPERATING_SYSTEM_AUTH'], default='DATABASE_AUTH', help="Authentication type options (case-sensitive): DATABASE_AUTH, OPERATING_SYSTEM_AUTH. Default=DATABASE_AUTH") parser.add_option ("-U", dest="Dbms_admin", type="string", default="", help="DBMS administrator user") parser.add_option ("-P", dest="Dbms_admin_pwd", type="string", default="", help="DBMS administrator password") parser.add_option ("--schema", dest="Schema_type", type="choice", choices=['SDE_SCHEMA', 'DBO_SCHEMA'], default="SDE_SCHEMA", help="Schema type applies to geodatabases in SQL Server only. Type SDE_SCHEMA to create geodatabase in SDE schema or type DBO_SCHEMA to create geodatabase in DBO schema. Default=SDE_SCHEMA") parser.add_option ("-u", dest="Gdb_admin", type="string", default="", help="Geodatabase administrator user name; Must always be sde for PostgreSQL, sde-schema geodatabases in SQL Server, and master sde geodatabase in Oracle") parser.add_option ("-p", dest="Gdb_admin_pwd", type="string", default="", help="Geodatabase administrator password") parser.add_option ("-t", dest="Tablespace", type="string", default="", help="Tablespace name; For PostgreSQL, type name of existing tablespace in which to store database. If no tablespace name specified, pg_default is used. For Oracle, type name of existing tablespace, or, if tablespace with specified name does not exist, it will be created and set as the default tablespace for the sde user. If no tablespace name is specified, SDE_TBS tablespace is created and set as sde user default. Tablespace name not supported for SQL Server.") parser.add_option ("-l", dest="Authorization_file", type="string", default="", help="Full path and name of authorization file; file created when ArcGIS Server Enterprise authorized, and stored in \\Program Files\ESRI\License<release#>\sysgen on Windows or /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release#>/sysgen on Linux") # Check if value entered for option try: (options, args) = parser.parse_args() #Check if no system arguments (options) entered if len(sys.argv) == 1: print("%s: error: %s\n" % (sys.argv[0], "No command options given")) parser.print_help() sys.exit(3) #Usage parameters for spatial database connection database_type = options.Database_type.upper() instance = options.Instance database = options.Database.lower() account_authentication = options.Account_authentication.upper() dbms_admin = options.Dbms_admin dbms_admin_pwd = options.Dbms_admin_pwd schema_type = options.Schema_type.upper() gdb_admin = options.Gdb_admin gdb_admin_pwd = options.Gdb_admin_pwd tablespace = options.Tablespace license = options.Authorization_file if (database_type == "SQLSERVER"): database_type = "SQL_SERVER" if( database_type ==""): print(" \n%s: error: \n%s\n" % (sys.argv[0], "DBMS type (--DBMS) must be specified.")) parser.print_help() sys.exit(3) if (license == ""): print(" \n%s: error: \n%s\n" % (sys.argv[0], "Authorization file (-l) must be specified.")) parser.print_help() sys.exit(3) if(database_type == "SQL_SERVER"): if(schema_type == "SDE_SCHEMA" and gdb_admin.lower() != "sde"): print("\n%s: error: %s\n" % (sys.argv[0], "To create SDE schema on SQL Server, geodatabase administrator must be SDE.")) sys.exit(3) if (schema_type == "DBO_SCHEMA" and gdb_admin != ""): print("\nWarning: %s\n" % ("Ignoring geodatabase administrator specified when creating DBO schema...")) if( account_authentication == "DATABASE_AUTH" and dbms_admin == ""): print("\n%s: error: %s\n" % (sys.argv[0], "DBMS administrator must be specified with database authentication")) sys.exit(3) if( account_authentication == "OPERATING_SYSTEM_AUTH" and dbms_admin != ""): print("\nWarning: %s\n" % ("Ignoring DBMS administrator specified when using operating system authentication...")) else: if (schema_type == "DBO_SCHEMA"): print("\nWarning: %s %s, %s\n" % ("Only SDE schema is supported on", database_type, "switching to SDE schema..." )) if( gdb_admin.lower() == ""): print("\n%s: error: %s\n" % (sys.argv[0], "Geodatabase administrator must be specified.")) sys.exit(3) if( gdb_admin.lower() != "sde"): if (database_type == "ORACLE"): print("\nGeodatabase admin user is not SDE, creating user schema geodatabase on Oracle...\n") else: print("\n%s: error: %s for %s.\n" % (sys.argv[0], "Geodatabase administrator must be SDE", database_type)) sys.exit(3) if( dbms_admin == ""): print("\n%s: error: %s\n" % (sys.argv[0], "DBMS administrator must be specified!")) sys.exit(3) if (account_authentication == "OPERATING_SYSTEM_AUTH"): print("Warning: %s %s, %s\n" % ("Only database authentication is supported on", database_type, "switching to database authentication..." )) # Get the current product license product_license=arcpy.ProductInfo() # Checks required license level if product_license.upper() == "ARCVIEW" or product_license.upper() == 'ENGINE': print("\n" + product_license + " license found!" + " Creating an enterprise geodatabase requires an ArcGIS Desktop Standard or Advanced, ArcGIS Engine with the Geodatabase Update extension, or ArcGIS Server license.") sys.exit("Re-authorize ArcGIS before creating enterprise geodatabase.") else: print("\n" + product_license + " license available! Continuing to create...") arcpy.AddMessage("+++++++++") try: print("Creating enterprise geodatabase...\n") arcpy.CreateEnterpriseGeodatabase_management(database_platform=database_type,instance_name=instance, database_name=database, account_authentication=account_authentication, database_admin=dbms_admin, database_admin_password=dbms_admin_pwd, sde_schema=schema_type, gdb_admin_name=gdb_admin, gdb_admin_password=gdb_admin_pwd, tablespace_name=tablespace, authorization_file=license) for i in range(arcpy.GetMessageCount()): arcpy.AddReturnMessage(i) arcpy.AddMessage("+++++++++\n") except: for i in range(arcpy.GetMessageCount()): arcpy.AddReturnMessage(i) #Check if no value entered for option except SystemExit as e: if e.code == 2: parser.usage = "" print("\n") parser.print_help() parser.exit(2)
- Save the file with a .py extension.
- Run the script, providing options and information specific to your site.
In the following example run from a Linux machine, the file create_gdb.py is run for an Oracle instance with an SID of orcl. The instance is running on server gisprod. An sde user with password Tgdbst@rtsh3r3 is created, along with a tablespace named sde. A keycodes file in the default ArcGIS Server location is specified to authorize the geodatabase.
./create_gdb.py --DBMS ORACLE -i gisprod/orcl --auth DATABASE_AUTH -U sys -P N0pe3king! -u sde -p Tgdbst@rtsh3r3 -t sde -l '/usr/arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License/sysgen/keycodes'
In this example, the same script is run from a Windows machine:
create_gdb.py --DBMS ORACLE -i gisprod/orcl --auth DATABASE_AUTH -U sys -P N0pe3king! -u sde -p Tgdbst@rtsh3r3 -t sde -l '\\Program Files\ESRI\License\sysgen\keycodes'
You now have a geodatabase in Oracle.
Messages about geodatabase creation are written to the sde_setup.log file, which is created in the directory specified for your TEMP or TMP variable on the computer where the tool is run. If you have any problems creating a geodatabase, check this log file to troubleshoot the problem.
Next, if the Oracle database open_cursors parameter is set to anything other than 300, run the sde.gdb_util.update_open_cursors stored procedure to synchronize your Oracle database parameter with the geodatabase's setting.
The Oracle administrator configures the database; the geodatabase administrator creates the geodatabase
If the person creating the geodatabase does not have access to the database administrator's password, the database administrator can set up the database and sde user, and then the geodatabase administrator can connect to it using the sde login and create a geodatabase in the database using the Enable Enterprise Geodatabase geoprocessing tool or Python script.
The Enable Enterprise Geodatabase tool takes a database connection file as input and creates the geodatabase system tables, views, functions, and procedures in the sde user's schema.
Install and configure Oracle
Before the geodatabase administrator can create a geodatabase, the database administrator must do the following:
- Install and configure an Oracle instance. How you configure the Oracle instance depends on the specific needs of your organization. Consult Oracle documentation for installation and configuration information.
Check the ArcGIS system requirements before you set up a geodatabase to be sure the database management system, ArcGIS, and hardware combinations you want to use are supported. See Privileges for geodatabases in Oracle for a list of required privileges.
- Create an sde user and schema.
- Grant the sde user the privileges necessary to create a geodatabase.
- Create a tablespace for the sde user and set the tablespace as the sde user's default tablespace.
- Grant execute privileges on packages needed for geodatabase creation. See Privileges for geodatabases in Oracle for a list of the packages.
If you require the ability to do any of the following, you also need to configure the Oracle extproc to access the Esri ST libraries:
- Execute ST_Geometry SQL functions from SQL clients.
- Access the XML columns in the GDB_ITEMS_VW and GDB_ITEMRELATIONSHIPS_VW geodatabase system views.
- Define a query layer in ArcMap or ArcGIS Pro that executes SQL functions on ST_Geometry columns.
- Publish data from the Oracle database.
After Oracle is installed and configured, the geodatabase administrator can install ArcGIS and Oracle clients.
Install and configure clients
You can install ArcGIS Desktop (Desktop Standard or Desktop Advanced), ArcGIS Engine Geodatabase Update or ArcGIS Server to run a Python script and create a geodatabase. If you want to run the Create Enterprise Geodatabase geoprocessing tool instead of a script, install ArcGIS Desktop.
In most cases, your ArcGIS client will be installed on a different computer than Oracle. Therefore, you must have a supported Oracle client on the ArcGIS client computer to connect to the Oracle instance. See Oracle's documentation to determine which version of the Oracle client you should install to connect to the version of Oracle you are using and for instructions on installing and configuring the client.
- Install the ArcGIS client you want to use for geodatabase creation.
Follow the instructions provided in the software installation guides.
- Install and configure an Oracle client on the ArcGIS client computer.
If you are connecting from a 32-bit ArcGIS client (such as ArcMap), you must install a 32-bit Oracle client. This is true even if you install the ArcGIS client application on a computer with a 64-bit operating system and the database and server operating system are 64 bit. If you are connecting from a 64-bit ArcGIS client (such as ArcGIS Server or ArcGIS Pro), you must install a 64-bit Oracle client.
You can obtain the Oracle Instant, Runtime, or Administrator Client from Oracle. See the Oracle documentation for instructions to install.
- Set the environment variable of your operating system or user profile to include the path to and name of the directory where the Oracle client is installed.
- On Linux, set the LD_LIBRARY_PATH environment variable.
- On Windows, set the PATH environment variable. If ArcMap is installed on the same Windows computer as ArcGIS Pro or ArcGIS Server, set the PATH variable to read the 64-bit client before the 32-bit client. For example, if your 32-bit Oracle client is installed to c:\Program Files (x86)\Oracle and your 64-bit Oracle Instant Client is installed to c:\Program Files\Oracle, add the following to the beginning of your PATH variable value: C:\Program Files\Oracle;C:\Program Files (x86)\Oracle;.
- If your ArcGIS client was already running, restart it to recognize the Oracle client and new environment variables.
- You can connect from ArcGIS to Oracle using an Easy Connect string. However, the database administrator must configure the Oracle database to allow Easy Connect strings. If you have the full Oracle client installed but want to use Easy Connect syntax to connect, be sure the sqlnet.ora file on the client is configured to allow the use of Easy Connect and that the database administrator has configured the Oracle server to allow Easy Connect syntax. See the Oracle documentation for further instructions.
Now you can create a geodatabase.
Create a geodatabase
The geodatabase administrator can run the Enable Enterprise Geodatabase tool from ArcGIS Desktop (Desktop Standard or Desktop Advanced), or run a Python script from an ArcGIS Desktop, ArcGIS Server, or ArcGIS Engine client to create a geodatabase in the existing database.
Run the Enable Enterprise Geodatabase ArcGIS Desktop tool
If you have access to , you can run the Enable Enterprise Geodatabase tool to create a geodatabase.
Follow these steps to create a geodatabase using the Enable Enterprise Geodatabase tool in ArcGIS Desktop:
- Start an ArcGIS Desktop client.
- Connect to the Oracle database as the sde user.
Be sure to save the user's password on the Database Connection dialog box.
- Open the Enable Enterprise Geodatabase geoprocessing tool.
- Use the database connection you created in step 2 as the Input Database Connection.
- Browse to the authorization file that was created when you authorized ArcGIS Server and add it to the Authorization File text box.
When you use the wizard to authorize ArcGIS Server, a keycodes file is written to the server where the software is installed. If you authorized ArcGIS Server on a Linux machine, the keycodes file was created in /arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License<release>/sysgen. If you authorized on a Windows server, the file was created in Program Files\ESRI\License<release>\sysgen. If you have not already done so, authorize ArcGIS Server to create this file. Copy the keycodes file to a location the tool can access.
- Click OK (ArcMap or ArcCatalog) or Run (ArcGIS Pro).
A geodatabase is created in the database.
Messages about geodatabase creation are written to the sde_setup.log file, which is created in the directory specified for your %TEMP% variable on the computer where the tool is run. If you have any problems creating a geodatabase, check this log file to troubleshoot the problem.
If clients will access the geodatabase using SQL, configure the Oracle extproc to allow access.
Next, the database administrator can synchronize open_cursors settings between Oracle and the geodatabase using the sde.gdb_util.update_open_cursors stored procedure.
Run a Python script
If you want to create the geodatabase by running a script from an ArcGIS Server, ArcGIS Desktop, or ArcGIS Engine installation, you can use the script provided here.
- Create a text file on the ArcGIS client machine and copy the following script into the file.
""" Name: enable_enterprise_gdb.py Description: Provide connection information to an enterprise database and enable enterprise geodatabase. Type enable_enterprise_gdb.py -h or enable_enterprise_gdb.py --help for usage """ # Import system modules import arcpy, os, optparse, sys # Define usage and version parser = optparse.OptionParser(usage = "usage: %prog [Options]", version="%prog 1.0 for " + arcpy.GetInstallInfo()['Version'] ) #Define help and options parser.add_option ("--DBMS", dest="Database_type", type="choice", choices=['SQLSERVER', 'ORACLE', 'POSTGRESQL', 'DB2','INFORMIX','DB2ZOS', ''], default="", help="Type of enterprise DBMS: SQLSERVER, ORACLE, POSTGRESQL, DB2, INFORMIX, or DB2ZOS.") parser.add_option ("-i", dest="Instance", type="string", default="", help="DBMS instance name") parser.add_option ("--auth", dest="account_authentication", type ="choice", choices=['DATABASE_AUTH', 'OPERATING_SYSTEM_AUTH'], default='DATABASE_AUTH', help="Authentication type options (case-sensitive): DATABASE_AUTH, OPERATING_SYSTEM_AUTH. Default=DATABASE_AUTH") parser.add_option ("-u", dest="User", type="string", default="", help="Geodatabase administrator user name") parser.add_option ("-p", dest="Password", type="string", default="", help="Geodatabase administrator password") parser.add_option ("-D", dest="Database", type="string", default="none", help="Database name: Not required for Oracle") parser.add_option ("-l", dest="Authorization_file", type="string", default="", help="Full path and name of authorization file") # Check if value entered for option try: (options, args) = parser.parse_args() #Check if no system arguments (options) entered if len(sys.argv) == 1: print "%s: error: %s\n" % (sys.argv[0], "No command options given") parser.print_help() sys.exit(3) #Usage parameters for spatial database connection database_type = options.Database_type.upper() instance = options.Instance account_authentication = options.account_authentication.upper() username = options.User.lower() password = options.Password database = options.Database.lower() license = options.Authorization_file if( database_type ==""): print " \n%s: error: \n%s\n" % (sys.argv[0], "DBMS type (--DBMS) must be specified.") parser.print_help() sys.exit(3) if (license == ""): print " \n%s: error: \n%s\n" % (sys.argv[0], "Authorization file (-l) must be specified.") parser.print_help() sys.exit(3) if (database_type == "SQLSERVER"): database_type = "SQL_SERVER" # Get the current product license product_license=arcpy.ProductInfo() if (license == ""): print " \n%s: error: %s\n" % (sys.argv[0], "Authorization file (-l) must be specified.") parser.print_help() sys.exit(3) # Checks required license level if product_license.upper() == "ARCVIEW" or product_license.upper() == 'ENGINE': print "\n" + product_license + " license found!" + " Enabling enterprise geodatabase functionality requires an ArcGIS Desktop Standard or Advanced, ArcGIS Engine with the Geodatabase Update extension, or ArcGIS Server license." sys.exit("Re-authorize ArcGIS before enabling an enterprise geodatabase.") else: print "\n" + product_license + " license available! Continuing to enable..." arcpy.AddMessage("+++++++++") # Local variables instance_temp = instance.replace("\\","_") instance_temp = instance_temp.replace("/","_") instance_temp = instance_temp.replace(":","_") Conn_File_NameT = instance_temp + "_" + database + "_" + username if os.environ.get("TEMP") == None: temp = "c:\\temp" else: temp = os.environ.get("TEMP") if os.environ.get("TMP") == None: temp = "/usr/tmp" else: temp = os.environ.get("TMP") Connection_File_Name = Conn_File_NameT + ".sde" Connection_File_Name_full_path = temp + os.sep + Conn_File_NameT + ".sde" # Check for the .sde file and delete it if present arcpy.env.overwriteOutput=True if os.path.exists(Connection_File_Name_full_path): os.remove(Connection_File_Name_full_path) print "\nCreating Database Connection File...\n" # Process: Create Database Connection File... # Usage: out_file_location, out_file_name, DBMS_TYPE, instnace, database, account_authentication, username, password, save_username_password(must be true) arcpy.CreateDatabaseConnection_management(out_folder_path=temp, out_name=Connection_File_Name, database_platform=database_type, instance=instance, database=database, account_authentication=account_authentication, username=username, password=password, save_user_pass="TRUE") for i in range(arcpy.GetMessageCount()): if "000565" in arcpy.GetMessage(i): #Check if database connection was successful arcpy.AddReturnMessage(i) arcpy.AddMessage("\n+++++++++") arcpy.AddMessage("Exiting!!") arcpy.AddMessage("+++++++++\n") sys.exit(3) else: arcpy.AddReturnMessage(i) arcpy.AddMessage("+++++++++\n") # Process: Enable geodatabase... try: print "Enabling Enterprise Geodatabase...\n" arcpy.EnableEnterpriseGeodatabase_management(input_database=Connection_File_Name_full_path, authorization_file=license) for i in range(arcpy.GetMessageCount()): arcpy.AddReturnMessage(i) arcpy.AddMessage("+++++++++\n") except: for i in range(arcpy.GetMessageCount()): arcpy.AddReturnMessage(i) if os.path.exists(Connection_File_Name_full_path): os.remove(Connection_File_Name_full_path) #Check if no value entered for option except SystemExit as e: if e.code == 2: parser.usage = "" print "\n" parser.print_help() parser.exit(2)
- Save the file with a .py extension.
- Run the script, providing options and information specific to your site.
In the following example run from a Linux machine, the file enable_gdb.py is run for an Oracle instance with an SID of orcl. The instance is running on server gisprod. A keycodes file in the default ArcGIS Server location is specified to authorize the geodatabase.
enable_gdb.py --DBMS ORACLE -i gisprod/orcl --auth DATABASE_AUTH -u sde -p Tgdbst@rtsh3r3 -l '/usr/arcgis/server/framework/runtime/.wine/drive_c/Program Files/ESRI/License/sysgen/keycodes'
In this example, the same script is run from a Windows machine:
create_gdb.py --DBMS ORACLE -i gisprod/orcl --auth DATABASE_AUTH -U sys -P N0pe3king! -u sde -p Tgdbst@rtsh3r3 -t sde -l '\\Program Files\ESRI\License\sysgen\keycodes'
You now have a geodatabase in the Oracle database.
Messages about geodatabase creation are written to the sde_setup.log file, which is created in the directory specified for your TEMP or TMP variable on the computer where the script is run. If you have any problems creating a geodatabase, check this log file to troubleshoot the problem.
Next, the database administrator can synchronize open_cursors settings between Oracle and the geodatabase using the sde.gdb_util.update_open_cursors stored procedure.
You want to store multiple geodatabases in the same Oracle database
Once a geodatabase has been created in the sde user's schema (also referred to as the master sde geodatabase) using the procedures described in the previous sections, other users can create a geodatabase in their schemas. You might allow other users to create their own geodatabases as a way to group and separate data for different teams or projects.
The following rules apply for geodatabases in user's schemas:
- A geodatabase is owned by the user who created it. That user is the geodatabase administrator for that geodatabase and requires geodatabase administrator privileges. See Privileges for geodatabases in Oracle for specific geodatabase administrator privileges.
- A user can own only one geodatabase.
- Only the owner of the user-schema geodatabase can own data in that geodatabase.
- If a user owns a geodatabase, he or she cannot own data in the master sde geodatabase.
- If a user owns data in the master sde geodatabase, he or she cannot own a user-schema geodatabase.
- The amount of time it takes to connect to the Oracle database will increase as the number of user-schema geodatabases you create and use increases. This is especially true if the user-schema geodatabases contain a mix of geodatabase tables and tables that are not registered with the geodatabase.
Once the master sde geodatabase exists, you can use any of the aforementioned tools or scripts to create a user-schema geodatabase.
- Create Enterprise Geodatabase: When the database administrator runs this tool, be sure the schema owner's name is specified for the geodatabase administrator.
- Enable Enterprise Geodatabase: If you do not have access to the sys user's password, the database administrator can grant you the privileges required to create a geodatabase. Then you can connect to the geodatabase with your login and run the Enable Enterprise Geodatabase tool or script to create a geodatabase in your schema.