About Administering an Oracle Database Instance Using ORADIM

ORADIM is a command-line tool that is available with Oracle Database.

Use ORADIM only if you are manually creating, deleting, or modifying databases. Oracle Database Configuration Assistant is an easier tool to use for this purpose.

ORADIM creates Oracle Database service, Oracle VSS Writer service, and Oracle Scheduler service to run under the Oracle Home User account. If this account is a Windows Local User Account or a Windows Domain User Account, then ORADIM prompts for a password for that account and accepts the same through stdin.

Specify both the Oracle Home User and its password using the -RUNAS osusr[/ospass] option to oradim. If the given osusr is different from the Oracle Home User, then use the Oracle Home User instead of osusr along with the given ospass.

The following sections describe ORADIM commands and parameters. Note that each command is preceded by a dash (-). To get a list of the ORADIM parameters, enter:

oradim -? | -h | -help

Note:

Specifying oradim without any options also returns a list of ORADIM parameters and descriptions.

When you use ORADIM, a log file called oradim.log opens in ORACLE_HOME\database, or in the directory specified by registry parameter ORA_CWD. All operations, whether successful or failed, are logged in this file. You must check this file to verify success of an operation.

If you have installed an Oracle Database service on Windows, then when logging in as the SYSTEM user (LocalSystem), with the startup mode set to Automatic, it is possible that the Oracle Database service starts but the database does not start automatically. The following error message is written to the file ORADIM.LOG in the directory ORACLE_HOME\database:

ORA-12640: Authentication adapter initialization failed

Oracle Enterprise Management Agent, Oracle Enterprise Manager Management Server, and Oracle Internet Directory fails, because they cannot connect to the database for the same reason.

To work around this issue, perform the following tasks:

  1. Modify SQLNET.ORA

    You can modify SQLNET.ORA, by doing either of the following:

    • Remove the line sqlnet.authentication_services=(NTS)

    • Change the line sqlnet.authentication_services=(NONE)

  2. Start the database after the service starts.

    You can start the database manually after the Oracle Database service has started, using SQL*Plus and connecting as SYSDBA.

  3. Start the service as a specific user.

    See Also:

    Your operating system documentation for instructions on starting the services

Creating an Instance Using ORADIM

Learn how to create an Oracle Database instance using ORADIM.

To use ORADIM to create an instance, enter:

oradim [-NEW -SID SID] | -SRVC service_name | -ASMSID SID | -ASMSRVC service_name 
[-SYSPWD password][-MAXUSERS number][-STARTMODE auto | manual] [-SRVCSTART system | demand] 
[-PFILE filename | -SPFILE] [-SHUTMODE normal | immediate | abort] [-TIMEOUT 
secs] [-RUNAS osusr[/ospass]]

For this command, note the following:

  • -NEW indicates that you are creating a new instance. This is a mandatory parameter.

  • -SID SID is the name of the instance to create.

  • -SRVC service_name is the name of the service to create (OracleServiceSID).

  • -ASMSID SID is the name of the Oracle Automatic Storage Management instance to create.

  • -ASMSRVC service_name is the name of the Oracle Automatic Storage Management service to create.

  • -SYSPWD password is the system password.

  • -MAXUSERS number is the number of users defined in the password file. The default is 5.

  • -STARTMODE auto | manual indicates whether to start the instance when the Oracle Database service is started. The default is manual.

  • -SRVCSTART system | demand indicates whether to start the Oracle Database service upon computer restart. Default is demand. Here, system specifies that the service be configured to automatically start when the system boots or reboots. Demand specifies that the user has to explicitly start the service.

  • -PFILE filename is the initialization parameter file to be used with this instance. Ensure that you specify the complete path name of this file, including the drive letter.

  • -SPFILE indicates that a server parameter file (SPFILE) be used during startup instead of a PFILE.

  • -SHUTMODE specifies how to stop an instance. It requires an argument and the default is immediate. If SHUTMODE is omitted, then there is no attempt made to shutdown the instance when the service is shut down.

  • -TIMEOUT secs sets the maximum time to wait (in seconds) before the service for a particular SID stops. The default is 90 seconds. It cannot be used without the SHUTDOWN argument.

  • -RUNAS osusr[/ospass] ("run as") makes it possible to specify both the Oracle Home User and its password. If the given osusr is different from the Oracle Home User, then the Oracle Home User is used instead of the osusr along with the given ospass.

    Though the ospass can be specified on the command line, Oracle recommends accepting ospass through stdin.

    ORADIM creates Oracle Database service, Oracle VSS Writer service, and Oracle Scheduler service to run under the Oracle Home User account. If this account is a Windows Local User Account or Windows Domain User Account, then ORADIM prompts for the password for that account and accepts the same through stdin.

Note:

For simplicity in demonstrating this feature, this example does not perform the password management techniques that a deployed system typically uses. In a production environment, follow the Oracle Database password management guidelines, and disable any sample accounts.

To create an instance called PROD, for example, enter:

C:\> oradim -NEW -SID prod -STARTMODE auto -PFILE C:\app\username\admin\prod\pfile\init.ora

See Also:

Oracle Database Security Guide for password management guidelines and other security recommendations.

Starting an Instance and Services Using ORADIM

Learn how to start an instance and services using ORADIM.

To use ORADIM to start an instance and services, enter:

oradim -STARTUP -SID SID | -ASMSID SID [-SYSPWD password] [-STARTTYPE srvc | 
inst | srvc,inst] [-PFILE filename | -SPFILE]

For this command, note the following:

  • -STARTUP indicates that you are starting an instance that already exists. This is a mandatory parameter.

  • -SID SID is the name of the instance to start.

  • -ASMSID SID is the name of the Oracle Automatic Storage Management instance to start.

  • -STARTTYPE srvc, inst indicates whether to start the service or the instance. One or both values can be specified. If it is not specified, then the registry is checked for the current setting.

    -STARTTYPE srvc is the equivalent of running net start oracleservicesid from the command line.

    -STARTTYPE inst is the equivalent of running startup within SQL*Plus.

  • -PFILE filename is the initialization parameter file to be used with this instance. Ensure that you specify the complete path name of this file, including drive letter.

  • -SPFILE indicates that a server parameter file (SPFILE) be used during startup instead of a PFILE.

To start an instance called puma, for example, enter:

C:\> oradim -STARTUP -SID puma -STARTTYPE inst -PFILE C:\app\username\admin\prod\pfile\init.ora

Stopping an Instance and Services Using ORADIM

Learn how to stop an instance and services using ORADIM.

To use ORADIM to stop an instance, enter:

oradim -SHUTDOWN -SID SID | -ASMSID SID [-SYSPWD password] 
[-SHUTTYPE srvc | inst | srvc,inst] [-SHUTMODE normal | immediate | abort]

For this command, note the following:

  • -SHUTDOWN indicates that you are stopping an instance. This is a mandatory parameter.

  • -SID SID specifies the name of the instance to stop.

  • -ASMSID SID is the name of the Oracle Automatic Storage Management instance to stop.

  • -SHUTTYPE srvc, inst indicates whether to stop the service or the instance. One or both values can be specified. If it is not specified, then the registry is checked for the current setting.

  • -SHUTMODE specifies how to stop an instance. This is an optional parameter. If you do not specify how to stop an instance, then immediate is the default mode.

To stop an instance called puma, for example, enter:

C:\> oradim -SHUTDOWN -SID puma -SHUTTYPE srvc,inst

Editing an Instance Using ORADIM

Learn how to edit an instance to change such values as instance name, startup mode, shutdown mode, and shutdown type using ORADIM.

To use ORADIM to modify an instance, enter:

oradim -EDIT -SID SID | -ASMSID SID [-SYSPWD password] [-STARTMODE auto | 
manual] [-SRVCSTART system | demand] [-PFILE filename | -SPFILE][SHUTMODE normal 
| immediate | abort] [SHUTTYPE srvc | inst | srvc,inst]

For this command, note the following:

  • -EDIT indicates that you are modifying an instance. This is a mandatory parameter.

  • -SID SID specifies the name of the instance to modify. This is a mandatory parameter.

  • -ASMSID SID is the name of the Oracle Automatic Storage Management instance to modify.

  • -STARTMODE indicates whether to start the instance when the Oracle Database service is started. The default is manual.

  • -SRVCSTART system | demand indicates whether to start the Oracle Database service on computer restart. The default is demand.

  • -PFILE filename specifies the initialization parameter file to be used with this instance. Ensure that you specify the complete path name of this file, including the drive letter.

  • -SPFILE indicates that a server parameter file (SPFILE) be used during startup instead of a PFILE.

  • -SHUTMODE specifies how to stop an instance. This is an optional parameter. If you do not specify how to stop an instance, then immediate is the default mode.

  • -SHUTTYPE indicates whether to stop the service or the instance. One or both values can be specified. If it is not specified, then the registry is checked for the current setting.

To specify a new initialization parameter file for the instance prod, for example, enter:

C:\> oradim -EDIT -SID prod -PFILE C:\app\username\product\12.2.0\admin\lynx\pfile\init.ora

Deleting an Instance Using ORADIM

Learn how to delete an instance using ORADIM.

To use ORADIM to delete an instance, enter:

oradim -DELETE -SID SID | -ASMSID SID | -SRVC service_name | -ASMSRVC service_name

For this command, note the following:

  • -DELETE indicates that you are deleting an instance or service. This is a mandatory parameter.

  • -SID SID specifies the name of the SID to delete.

  • -SRVC service_name specifies the name of the service to delete (OracleServiceSID). The user must specify either SID or SRVC.

  • -ASMSID SID is the name of the Oracle Automatic Storage Management instance to delete.

  • -ASMSRVC service_name is the name of the Oracle Automatic Storage Management service to delete.

To delete an instance called prod, for example, enter:

C:\> oradim -DELETE -SID prod

Manipulating ACLs Using ORADIM

Learn how to manipulate ACLs using ORADIM.

To use ORADIM to manipulate ACL, enter:

oradim    -ACL -setperm|-addperm|-removeperm  dbfiles|diag|registry  -USER username  -OBJTYPE file|dir|registry  -OBJPATH object-path  -RECURSE true|false [-HOST hostname]

For this command, note the following:

  • -ACL indicates that you are manipulating ACL on an object. This is a mandatory parameter.

  • -setperm | -addperm | -removeperm dbfiles | diag | registry- indicates that you are setting, adding, or removing ACLs on the specified object.  dbfiles is for database files, diag is for database, oracle-base & logs and registry is for registry key. Set one of these based on the object on which the ACL is set. This is a mandatory parameter.

  • -USER username indicates the user for whom the ACLs are granted. This must not be essentially the service user of the current oracle home. This is a mandatory parameter.

  • -OBJTYPE file|dir|registry Set the object type to file/dir/registry based on the object on which the ACLs are set. This is a mandatory parameter.

  • -RECURSE true / false indicates whether the ACL is applicable to all objects within the specified object. This is a mandatory parameter.

  • -HOST hostname This can be used to remotely set ACLs on the specified host. This is limited to the scope of what windows supports remotely. Another way of doing this is to use the windows allowed conventions without using the -HOST option.  For example , \\<hostame>\c$\oracle\rdbms\admin\abc.txt. This is optional.

To set ACL on a file named abc.txt, for example, enter:

c:\> oradim -acl -setperm dbfiles -user winusr -objtype file -objpath c:\a.txt -recurse true

To add ACL on a registry key, for example, enter:

c:\>oradim -acl -addperm registry -USER wingen  -OBJTYPE registry -OBJPATH MACHINE\SOFTWARE\ORACLE\KEY_OraDB12Home1 -RECURSE true

Manipulating Family Settings to Initialization Parameters using ORADIM

Learn how to manipulate family settings to initializing parameters.

To use ORADIM to add family support to the initialization parameters, enter:

oradim     -FAMILY -set|-delete value [-SID sid | -ASMSID sid |  -MGMTDBSID sid | -IOSSID sid | -APXSID sid ]

For this command, note the following:

  • -FAMILY: Indicates that you are manipulating family settings. This is a mandatory parameter.

  • -set | -delete value: Should be used to set/delete value <HKLM>/Software/Oracle/<Current_ORACLE_HOME>/ORACLE_FAMILY. Set creates the above registry key and sets its value with the one specified. If the key exists already, then its value is updated. Delete removes the entry.

  • [-SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid ]: If one of these is specified, then the registry entry set/delete is <HKLM>/Software/Oracle/<Current_ORACLE_HOME>/ORACLE_<sid>_FAMILY. This is optional.

To make inst1 as part of the family prod for example, enter:

c:\>oradim -FAMILY -set prod -SID inst1

This creates the registry entry <HKLM>/Software/Oracle/<Current_ORACLE_HOME>/ORACLE_inst1_FAMILY = prod.