Database Commands

Use commands with the database keyword to manage cluster database.

You can add, modify, manage environment variables for, list the configuration of, enable, disable, start, stop, and obtain the status of databases, and also to upgrade, downgrade, and remove database configuration information about databases.

srvctl add database

Adds a database configuration to Oracle Clusterware.

Note:

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

Syntax

srvctl add database -db db_unique_name -oraclehome oracle_home
  [-dbtype  {RACONENODE | RAC | SINGLE} [-server "server_list"] [-instance instance_name]
  [-timeout timeout]] [-domain domain_name] [-spfile spfile]
  [-pwfile password_file_path] [-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY | FAR_SYNC}]
  [-startoption start_options] [-stopoption stop_options] [-startconcurrency start_concurrency]
  [-stopconcurrency stop_concurrency] [-dbname db_name] [-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY | RANK}]
  [-node node_name] [-diskgroup "disk_group_list"] [-acfspath "acfs_path | acfs_path_list"]
  [-css_critical {yes | no}] [-memorytarget memory_target] [-maxmemory max_memory]
  [-defaultnetnum network_number] [-verbose] [-importfile file_name]

Parameters

Table: srvctl add database Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the database.
-oraclehome oracle_homeThe path for the Oracle AI Database home directory.
-dbtype {RACONENODE | RAC | SINGLE}The type of database you are adding: Oracle RAC One Node, Oracle RAC, or single instance. The default is RAC . If you specify the -node node_name parameter, then the -dbtype parameter defaults to SINGLE .
-server server_list

List of candidate servers for Oracle RAC One Node databases.

Oracle Clusterware attempts to start Oracle RAC One instance in the order in which the servers are listed. First, it attempts to start the instance on the first server in the list. If that does not succeed for any reason, then Oracle Clusterware attempts to start the instance on the second server defined in the list, and so on. For example, for a 3-node cluster:
  • Use "N3,N2,N1" to start a particular instance preferably on the third node.
  • Use "N3,N1,N2" to make the first node the designated failover node.
  • Use "N3,N1" to prevent the second node from being used.

Oracle Clusterware refers to this list every time an instance starts, which can be either a regular start or a start that is triggered by a failure event.

-instance instance_nameThe instance name prefix for Oracle RAC One Node databases. The default value for this parameter is the first 12 characters of the global unique name of the database.
-timeout timeoutThe online database relocation timeout, in minutes, for Oracle RAC One Node databases. The default value is 30 .
-domain db_domainThe domain for the database. Note: You must use this parameter if you set the DB_DOMAIN initialization parameter for the database.
-spfile spfileThe path name of the database server parameter file.
-pwfile password_file_pathThe full path to the location of the password file.
-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY | FAR_SYNC}The role of the database in an Oracle Data Guard configuration. The default is PRIMARY .
-startoption start_optionsStartup options for the database, such as OPEN, MOUNT, and NOMOUNT. The default value is OPEN.
Notes:
  • For multi-word startup options, such as read only and read write, separate the words with a space and enclose in double quotation marks (""). For example, "read only".
  • When performing a switchover in an Oracle Data Guard configuration, the -startoption for a standby database that becomes a primary database is always set to OPEN after the switchover.
-stopoption stop_optionsStop options for the database, such as NORMAL , TRANSACTIONAL , IMMEDIATE , and ABORT .
-startconcurrency start_concurrencyNumber of instances to be started simultaneously, or 0 to disable this option.
-stopconcurrency stop_concurrencyNumber of instances to be stopped simultaneously, or 0 to disable this option.
-dbname db_nameThe name of the database, if it is different from the unique name given by the -db parameter.
-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY | RANK}

The management policy for the database.

  • AUTOMATIC (default): The database is automatically restored to its previous running condition (started or stopped) upon restart of the database host computer.
  • MANUAL: The database is never automatically restarted upon restart of the database host computer. A MANUAL setting does not prevent Oracle Clusterware from monitoring the database while it is running and restarting it if a failure occurs.
  • NORESTART: Similar to the MANUAL setting, the database is not automatically restarted upon restart of the database host computer. A NORESTART setting, however, does not restart the database, even if a failure occurs, unless it must be started for dependencies, such as services or PDBs.
  • USERONLY: The database can only be restarted by user command, not as a result of any other reason (auto-start, start by dependency, node failure, and so on.)
  • RANK: The database won't be restarted when the Oracle Clusterware stack is restarted unless it is restarted by start dependencies of its PDBs that are started according to RANK. For example, 2 CDBs have policy set to RANK and their PDBs have policy set to RESTART. If a PDB of CDB1 has a rank of 3 and a PDB in CDB2 has a rank of 2, and if there are only enough resources to start one CDB, then CDB1 will be started by dependency when its PDB is started. CDB2 is not started because its PDB has a lower rank number.
-node node_nameThe node name on which you want to register a noncluster, or single instance, Oracle AI Database. Note: This parameter can be used only with Oracle Clusterware.
-diskgroup " disk_group_list "A comma-delimited list of Oracle Automatic Storage Management (Oracle ASM) disk groups if database uses Oracle ASM storage.
-acfspath " acfs_path | acfs_path_list "You can add (/+) or remove (/-) a single Oracle ACFS path with acfs_path or multiple Oracle ACFS paths using a comma-delimited list with acfs_path_list enclosed in double quotation marks ("") where the database's dependency is set.

Use this parameter to create dependencies on Oracle ACFS file systems other than ORACLE_HOME, such as for when the database uses ORACLE_BASE on a file system that is different from the ORACLE_HOME file system.

Note:

This parameter is available only on the platforms on which Oracle ACFS is supported.

-css_critical {YES | NO}You can add weight to a service by setting this parameter to YES . In the event of a node failure within the cluster, Oracle Clusterware will evict the node with the least amount of weight, ensuring that critical services remain available.
-memorytarget memory_targetThe target memory size, in MB, to be allocated for the database. The default is 0.
-maxmemory max_memoryThe maximum memory size, in MB, to be allocated for the resource. If you specify -memorytarget but not -maxmemory , then -maxmemory will default to 0. Both -maxmemory and -memorytarget are validated as long as -memorytarget is less than or equal to -maxmemory .
-defaultnetnum network_numberSpecify a network number (an integer) to which services will default in the event you do not specify a network number when you add the service. The number must match the value of the -netnum parameter you specified when you added the network.
-importfile file_nameSpecify the JSON file containing the resource configuration to use when adding or re-creating the resource.

Examples

This example shows how to add a database named crm.example.com in a specific Oracle Home directory.

$ srvctl add database -db crm -oraclehome /u01/oracle/product/23.0.0/mydb
-domain example.com

srvctl config database

Displays the configuration for an Oracle RAC database or lists all configured databases that are registered with Oracle Clusterware.

Syntax

srvctl config database [-db db_unique_name] [-all] [-exportfile file_name] [-verbose]

Parameters

Table: srvctl config database Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the database. If you do not specify this parameter, then the utility displays the configuration of all database resources.
-allPrint detailed configuration information.
-verboseDisplay verbose output.
-exportfile file_nameSpecify the output file to which the resource configuration will be exported in JSON format for backup or resource re-creation purposes.

Example

This command returns output similar to the following:

$ srvctl config database -d main4

Database unique name: main
Database name:
Oracle home: /ade/mjkeenan_main4/oracle
Oracle user: mjkeenan
Spfile:
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups:
Mount point paths:
Services: test
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: main41,main42
Configured nodes: mjkeenan_main4_0,mjkeenan_main4_1
CSS critical: no
CPU count: 0
Memory target : 0
Maximum memory: 0
CPU cap: 0
Database is administrator managed

srvctl convert database

Converts a database either to or from an Oracle RAC One Node database.

Syntax

Use this command with one of the following syntax models:

srvctl convert database -db db_unique_name -dbtype RACONENODE
   [-instance instance_name] [-timeout timeout]

srvctl convert database -db db_unique_name -dbtype RAC [-node node_name]

Parameters

Table: srvctl convert database Command Parameters

ParameterDescription
-db db_unique_name

Specify the unique name for the database.

Note: If you specify a noncluster database, then command returns an error instructing you to first convert the noncluster database to Oracle RAC or Oracle RAC One Node.

-dbtype RACONENODE | RAC

Specify the type of database to which you are converting, either Oracle RAC One Node or Oracle RAC.

Note: If there is an ongoing or failed online database relocation, then the command returns an error instructing you to first complete or stop the online database relocation and then rerun the command.

-instance instance_name

Optionally, you can specify an instance name prefix for Oracle RAC One Node databases. The default value for this parameter is the first 12 characters of the global unique name of the database.

Notes:

  • You can use this parameter only when converting from an Oracle RAC database to an Oracle RAC One Node database.

  • In order for the converted instance to come online, you must restart the database using the srvctl stop/start database commands.

-timeout timeoutOptionally, you can specify online database relocation timeout, in minutes, for Oracle RAC One Node databases. The default is 30.
-node node_name

Optionally, you can specify the name of the node for an administrator-managed Oracle RAC database. The default is the first candidate.

Note: If you do not specify a node name or you specify a node name where the database is not running, then the command returns an error instructing you specify the correct node.

Example

An example of this command is:

$ srvctl convert database -db myDB -dbtype RACONENODE -instance myDB3

srvctl disable database

Disables a running database.

If the database is a cluster database, then its instances are also disabled.

Syntax

srvctl disable database -db db_unique_name [-node node_name]

Parameters

Table: srvctl disable database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the name of the database you want to disable.
-node node_name

Optionally, you can specify a node on which you want to disable the database.

Note: You can only use this parameter only with Oracle Clusterware.

Example

The following example disables the database mydb1:

$ srvctl disable database -db mydb1

srvctl downgrade database

Downgrades the configuration of a database and its services from its current version to a specific lower version.

Syntax

srvctl downgrade database -db db_unique_name -oraclehome Oracle_home
  -targetversion to_version

Parameters

Table: srvctl downgrade database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database you want to downgrade.
-oraclehome Oracle_homeSpecify the path to the Oracle home.
-targetversion to_versionSpecify the database version to which you want to downgrade.

srvctl enable database

Enables a cluster database and its instances.

Syntax

srvctl enable database -db db_unique_name [-node node_name]

Parameters

Table: srvctl enable database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database you want to enable.
-node node_name

Optionally, you can specify the name of the node on which the database resource resides that you want to enable.

Note: You can only use this parameter with Oracle Clusterware.

Example

The following example enables a database named mydb1:

$ srvctl enable database -db mydb1

srvctl getenv database

Displays the values for environment variables associated with a database.

Syntax

srvctl getenv database -db db_unique_name [-envs "name_list"]

Parameters

Table: srvctl getenv database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database for which you want to display the environment variable values.
-envs " name_list "

Optionally, you can specify a comma-delimited list of the names of specific environment variables enclosed in double quotation marks ("") for which you want to display the values.

If you do not use this parameter, then SRVCTL displays the values of all environment variables associated with the database.

Example

The following example displays the environment configuration for a database named crm:

$ srvctl getenv database -db crm

srvctl modify database

Modifies the configuration for a database.

Note:

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

Syntax

srvctl modify database -db db_unique_name [-dbname db_name] [-instance instance_name]
  [-oraclehome oracle_home_path] [-localrolling] | [-localrolling_revert] [-user user_name]
  [-server "server_list"] [-timeout timeout] [-domain db_domain]
  [-spfile spfile] [-pwfile password_file_path]
  [-role {PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY}]
  [-startoption start_options] [-stopoption stop_options]
  [-startconcurrency start_concurrency] [-stopconcurrency stop_concurrency]
  [-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY | RANK}]
  [{-diskgroup "diskgroup_list" | -nodiskgroup}] [-acfspath "acfs_path | acfs_path_list"]
  [-css_critical {YES | NO}] [-memorytarget memory_target] [-maxmemory max_memory]
  [-defaultnetnum network_number] [-disabledreason {DECOMMISSIONED}] [-force]
  [-verbose]

Parameters

Table: srvctl modify database Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the database.
-dbname db_nameThe name of the database, if it is different from the unique name given by the -db parameter.
-instance instance_nameInstance name prefix; this parameter is required for administrator-managed Oracle RAC One Node databases.
-oraclehome oracle_homeThe path for the Oracle AI Database home directory.
-localrollingCreates a new Oracle RAC database instance to enable the local rolling feature.
-localrolling_revertUse this parameter to revert the Oracle RAC local rolling configuration changes.
-user user_name

The name of the user who owns the Oracle home directory.

Note: If you specify the -userparameter, then you must run this command in privileged mode.

-server server_list

List of candidate servers for Oracle RAC One Node databases.

Oracle Clusterware attempts to start Oracle RAC One instance in the order in which the servers are listed. First, it attempts to start the instance on the first server in the list. If that does not succeed for any reason, then Oracle Clusterware attempts to start the instance on the second server defined in the list, and so on. For example, for a 3-node cluster:
  • Use "N3,N2,N1" to start a particular instance preferably on the third node.
  • Use "N3,N1,N2" to make the first node the designated failover node.
  • Use "N3,N1" to prevent the second node from being used.

Oracle Clusterware refers to this list every time an instance starts, which can be either a regular start or a start that is triggered by a failure event.

-timeout timeoutOnline database relocation timeout, in minutes, for Oracle RAC One Node databases. The default is 30.
-domain db_domain

The domain for the database.

Note: You must use this parameter if you set the DB_DOMAIN initialization parameter for the database.

-spfile spfileThe path name of the database server parameter file.
-pwfile password_file_pathEnter the full path to the location of the password file.
-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}The role of the database in an Oracle Data Guard configuration. The default is PRIMARY.
-startoption start_options

Startup options for the database, such as OPEN, MOUNT, and NOMOUNT. The default value is OPEN.

Notes:
  • For multi-word startup options, such as read only and read write, separate the words with a space and enclose in double quotation marks (""). For example, "read only".

  • When performing a switch-over in an Oracle Data Guard configuration, the -startoption for a standby database that becomes a primary database is always set to OPEN after the switchover.

-stopoption stop_optionsStop options for the database, such as NORMAL, TRANSACTIONAL, IMMEDIATE, and ABORT.
-startconcurrency start_concurrencyNumber of instances to be started simultaneously, or 0 to disable this option.
-stopconcurrency stop_concurrencyNumber of instances to be stopped simultaneously, or 0 to disable this option.
-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY | RANK}

The management policy for the database.

  • AUTOMATIC (default): The database is automatically restored to its previous running condition (started or stopped) upon restart of the database host computer.
  • MANUAL: The database is never automatically restarted upon restart of the database host computer. A MANUAL setting does not prevent Oracle Clusterware from monitoring the database while it is running and restarting it if a failure occurs.
  • NORESTART: Similar to the MANUAL setting, the database is not automatically restarted upon restart of the database host computer. A NORESTART setting, however, does not restart the database, even if a failure occurs, unless it must be started for dependencies, such as services or PDBs.
  • USERONLY: The database can only be restarted by user command, not as a result of any other reason (auto-start, start by dependency, node failure, and so on.)
  • RANK: The database won't be restarted when the Oracle Clusterware stack is restarted unless it is restarted by start dependencies of its PDBs that are started according to RANK. For example, 2 CDBs have policy set to RANK and their PDBs have policy set to RESTART. If a PDB of CDB1 has a rank of 3 and a PDB in CDB2 has a rank of 2, and if there are only enough resources to start one CDB, then CDB1 will be started by dependency when its PDB is started. CDB2 is not started because its PDB has a lower rank number.
-diskgroup " disk_group_list "Comma-delimited list of Oracle ASM disk groups if database uses Oracle ASM storage.
-acfspath " acfs_path | acfs_path_list "

You can add (/+) or remove (/-) a single Oracle ACFS path with acfs_path or multiple Oracle ACFS paths using a comma-delimited list with acfs_path_list enclosed in double quotation marks ("") where the database's dependency is set.

Use this parameter to create dependencies on Oracle ACFS file systems other than ORACLE_HOME, such as for when the database uses ORACLE_BASE on a file system that is different from the ORACLE_HOME file system.

Note:

This parameter is available only on the platforms on which Oracle ACFS is supported.

-css_critical {YES | NO}You can add weight to a service by setting this parameter to YES. In the event of a node failure within the cluster, Oracle Clusterware will evict the node with the least amount of weight, ensuring that critical services remain available.
-memorytarget memory_targetSpecify the target memory, in MB, to be allocated for the database. The default is 0.
-maxmemory max_memorySpecify the maximum memory, in MB, to be allocated for the resource. If you specify -memorytarget but not -maxmemory, then -maxmemory will be the default value of 0. Both -maxmemory and -memorytarget are validated as long as -memorytarget is less than or equal to -maxmemory.
-defaultnetnum network_numberSpecify a network number to which services will default in the event you do not specify a network number when you add a service.
-disabledreason {DECOMMISSIONED}Marks the database as being decommissioned, which means it cannot be started again and is not being used. This is intended for databases that will be deleted at a future date.

Usage Notes

  • When using the srvctl modify database command, for a running database, if the server list is supplied, then the node where the database is running must be on that list.
  • The instance name prefix cannot be modified after running the srvctl add database command.
  • You cannot change the management policy from AUTOMATIC (using the -policy parameter) for Oracle RAC One Node databases. Any attempt to do so results in an error message.

Examples

The following example changes the role of a database to a logical standby:

$ srvctl modify database -db crm -role logical_standby

The following example directs the racTest database to use the SYSFILES, LOGS, and OLTP Oracle ASM disk groups:

$ srvctl modify database -db racTest -diskgroup "SYSFILES,LOGS,OLTP"

Related Topics

srvctl predict database

Predicts the consequences of the failure of a specific database.

Syntax

srvctl predict database -db db_unique_name [-verbose]

Usage Notes

  • Specify the unique name of the database you want to check.
  • Optionally, you can use the -verbose parameter to display detailed output.

srvctl relocate database

Initiates the relocation of an Oracle RAC One Node database from one node to another node.

This command also cleans up after a failed relocation, and you can only use it for relocating Oracle RAC One Node databases.

Syntax

Use this command with one of the following syntax models:

To initiate the online relocation of an Oracle RAC One Node database:

srvctl relocate database -db db_unique_name {[-node target_node] [-timeout timeout]
   [-stopoption NORMAL] | -abort [-revert]} [-drain_timeout drain_timeout] [-eval] [-verbose]

To stop the failed online relocation of an Oracle RAC One Node database:

srvctl relocate database -db db_unique_name -abort [-revert]
   [-drain_timeout drain_timeout] [-eval] [-verbose]

Parameters

Table: srvctl relocate database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database you want to relocate.
-node target_node

Optionally, you can specify a target node to which to relocate the Oracle RAC One Node database.

Note: You must use this parameter if you are relocating an administrator-managed Oracle RAC One Node database.

-timeout timeoutOptionally, you can specify an online database relocation timeout, in minutes, for Oracle RAC One Node databases. The default is 30.
-stopoption NORMALUse this parameter to override the default shutdown option for a running instance, such as the default of SHUTDOWN TRANSACTIONAL LOCAL for a primary database or SHUTDOWN IMMEDIATE for a standby database. The only value accepted for -stopoption is NORMAL.
-abortUse this parameter to stop a failed online database relocation.
-revertUse this parameter to remove the target node of a failed online relocation request from the candidate server list of an administrator-managed Oracle RAC One Node database.
-drain_timeout timeout

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer. The default value is an empty string, which means that this parameter is not set. If it is set to 0, then draining occurs, immediately.

The draining period is intended for planned maintenance operations. During the draining period, all current client requests are processed, but new requests are not accepted. When set on the service this value is used when the command line value is not set.

-evalEvaluates the effects of the operation without making any changes to the system.
-verboseUse this parameter to display verbose output.

Usage Notes

  • If the Oracle RAC One Node database you want to relocate is not running, then the command returns an error.
  • If another online database relocation is active for this Oracle RAC One Node database, then the command returns an error.
  • If the -drain_timeout value is higher than the -timeout value, then SRVCTL relocates the services but does not explicitly start or stop the services on the database instances.
  • If an online database relocation for this Oracle RAC One Node database has failed and the target nodes are not the same for either relocation, then the command returns an error instructing you to stop the failed online database relocation and then initiate a new one.
  • If an online database relocation for this Oracle RAC One Node database has failed and the target nodes are the same (or you do not specify the target), then the command attempts to relocate the database.

Example

The following example relocates an Oracle RAC One Node database named rac1 to a server called node7.

$ srvctl relocate database -db rac1 -node node7

srvctl remove database

Removes database configurations.

After running this command, ensure that the password file is in the default location if you want to connect to the database as the SYS user with the SYS user's password.

Syntax

srvctl remove database -db db_unique_name [-force] [-noprompt] [-verbose]

Parameters

Table: srvctl remove database Command Parameters

ParameterDescription
-database db_unique_nameUnique name for the database.
-forceForcibly remove the database and ignore any dependencies.
-nopromptSuppress prompts.
-verboseDisplay verbose output.

Example

To remove a database named crm:

$ srvctl remove database -db crm

srvctl setenv database

Administers cluster database environment configurations.

Syntax

Use this command with one of the following syntax models:

srvctl setenv database -db db_unique_name -envs "name=val[,...]"
srvctl setenv database -db db_unique_name -env "name=val"

Parameters

Table: srvctl setenv database Command Parameters

ParameterDescription
-db db_unique_nameSpecify a unique name for the database for which you want to set environment variables.
-envs " name = val [,...]"Specify a comma-delimited list of name-value pairs of environment variables enclosed in double quotation marks ( "" ) that you want to set.
-env " name = val "Specify a single environment variable that you want to set to a value that contains commas or other special characters enclosed in double quotation marks ( "" ).

Usage Notes

Add additional information about the command here.

Example

The following example sets the language environment variable for a cluster database:

$ srvctl setenv database -db crm -env LANG=en

srvctl start database

Starts a database and its enabled instances, and all listeners on nodes with database instances.

You can disable listeners that you do not want to start.

Syntax

srvctl start database -db db_unique_name [-eval] [-startoption start_options]
  [-startconcurrency number_of_instances] [-node node_name]

Parameters

Table: srvctl start database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database you want to start.
-evalOptionally, use this parameter to hypothetically evaluate the impact of the command on the system.
-startoption start_options

Optionally, you can set options for the startup command (for example: OPEN, MOUNT, or NOMOUNT).

Notes:

  • This command parameter supports all database startup options.

  • For multi-word startup options, such as read only and read write, separate the words with a space and enclose in double quotation marks (""). For example, "read only".

    See Also: SQL*Plus User's Guide and Reference for more information about startup options

-startconcurrency number_of_instances

Optionally, you can specify a number of database instances to start simultaneously, or specify 0 for an empty start concurrency value. When you use this parameter with the srvctl start database command, it overrides any -startconcurrency value configured using the srvctl add | modify database commands.

Note:

If the value for the -startconcurrency parameter is greater than the number of total instances, then this parameter does not have any effect, same as 0.

-node node_name

Optionally, you can specify the name of a node on which you want to start the database.

Notes:

  • This command only applies to Oracle RAC One Node and Standard Edition High Availability databases.

  • The node you specify must be in the candidate list for an administrator-managed Oracle RAC One Node or Standard Edition High Availability database.

  • If the database is already running on a node than the one you specify, then the command returns an error.

  • If you do not specify a node, then Oracle Clusterware chooses which node on which to start the Oracle RAC One Node or Standard Edition High Availability database according to its policies, such as dispersion, number of resources, and order of candidate nodes.

  • If there is an active online database relocation for the Oracle RAC One Node database you are attempting to start, then both instances will already be running and the command returns an error message. Only during an online database relocation are two instances of an Oracle RAC One Node database in existence.

    If the online database relocation failed for the Oracle RAC One Node database and you do not specify a node, then the command attempts to start both database instances.

    If the online database relocation failed for the Oracle RAC One Node database and you specify a node, then the command attempts to stop the failed relocation and start the instance on that node.

Examples

The following example starts the crm database and sets the startup option to read only:

$ srvctl start database -db crm -startoption "read only"

srvctl status database

This command displays the current state of the of the database.

Syntax

srvctl status database {-db db_unique_name {[-sid] [-home]} | -thisversion | -thishome}
   [-force] [-detail] [-verbose]

Parameters

Table: srvctl status database Parameters

ParameterDescription
-db db_unique_nameSpecify a unique name for the database.
-sidUse this parameter to display the SID of the Oracle instance running on this node.
-homeUse this parameter to display the Oracle home of the specified database.
-thisversionUse this parameter to display the status of databases that are of the same Oracle product version as SRVCTL.
-thishomeUse this parameter to display the status of databases that are configured in this Oracle home.
-forceInclude disabled applications
-detailUse this parameter to display detailed database status information.
-verbose

Displays STATE_DETAILS and INTERNAL_STATE attributes, which include STABLE, STARTING, STOPPING, and CLEANING.

If the INTERNAL_STATE is STABLE, then SRVCTL displays no additional information. If the INTERNAL_STATE is STARTING, then SRVCTL displays:

Instance instance_name is being started

If the INTERNAL_STATE is CLEANING, then SRVCTL displays:

Instance instance_name is being cleaned up

If the INTERNAL_STATE is STOPPING, then SRVCTL displays:

Instance instance_name is being stopped

Usage Notes

The output of this command includes information on the Oracle ASM or Oracle ASM IOServer instance for each running instance of the database.

Examples

This command displays output similar to the following:

$ srvctl status database -db db00 -detail

Instance db00_1 is connected to ASM instance +ASM3
Instance db00_2 is connected to ASM I/O server instance +IOS1

srvctl stop database

Stops a database, its instances, and its services.

Syntax

srvctl stop database -db db_unique_name [-stopoption stop_options]
  [-stopconcurrency number_of_instances] [-drain_timeout timeout] [-eval]
  [-force] [-verbose]

Parameters

Table: srvctl stop database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name for the database that you want to stop.
-stopoption stop_optionsOptionally, you can specify options for the shutdown command, such as NORMAL, TRANSACTIONAL LOCAL, IMMEDIATE, or ABORT.
-stopconcurrency number_of_instances

Optionally, you can specify a number of database instances to stop simultaneously, or specify 0 for an empty stop concurrency value. When you use this parameter with the srvctl stop database command, it overrides any -stopconcurrency value configured using the srvctl add | modify database commands.

Note:

If the value for the -stopconcurrency parameter is greater than the number of total instances, then this parameter does not have any effect, same as 0.

-drain_timeout timeout

Optionally, you can specify the time, in seconds, allowed to complete the resource draining action. By default, this parameter is not set. You can specify 0 or any positive integer. An empty string unsets the parameter. If you specify zero, then the agent will perform the actions related to service draining, immediately.

Drain timeout is the maximum time the service waits before exiting (in case of srvctl stop service or srvctl stop instance) or proceeding to stop database (srvctl stop database), until the draining of sessions is completed. If session draining completes in 10 seconds and the drain timeout value (on CLI or resource attribute) is 100 seconds, then SRVCTL moves on after 10 seconds. It does not wait for the remaining 90 seconds.

Note: If the -drain_timeout value is not specified, then the maximum configured drain timeout of all the running services of the database on the specified nodes is used.

-evalOptionally, you can use this parameter to hypothetically evaluate the impact of the command on the system.
-forceOptionally, you can use this parameter to stop the database, its instances, its services, and any resources that depend on those services.
-verboseOptionally, you can use this parameter to display detailed output.

Example

The following command example stops a database and includes detailed output:

$ srvctl stop database -db db1 -drain_timeout 50 -verbose
Draining in progress on services svc1,svc2.
Drain complete on services svc1.
Draining in progress on services svc2.
Draining in progress on services svc2.
Drain complete on services svc2.

srvctl unsetenv database

Unsets the cluster database environment configurations.

Syntax

srvctl unsetenv database -db db_unique_name -envs "name_list"

Parameters

Table: srvctl unsetenv database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database for which you want to unset environment variables.
-envs " name_list "Specify a comma-delimited list of environment variable names enclosed in double quotation marks ( "" ).

Example

The following example unsets two cluster database environment variables:

$ srvctl unsetenv database -db crm -envs "CLASSPATH,LANG"

srvctl update database

Updates the specified database to use the new listener endpoints.

Syntax

srvctl update database -db db_unique_name [-startoption start_options [-node node_name]]

Usage Notes

  • You can only use this command with Oracle Clusterware.
  • Specify the unique name of the database you want to update.

srvctl upgrade database

Upgrades the configuration of a database and all of its services to the version of the database home from where this command is run.

Syntax

srvctl upgrade database -db db_unique_name -oraclehome Oracle_home

Parameters

Table: srvctl upgrade database Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database you want to upgrade.
-oraclehome Oracle_homeSpecify the path to the upgraded ORACLE_HOME.