Instance Commands
Use commands with the instance keyword to add, modify, enable, disable, start, stop, obtain the status of, and remove database instances.
srvctl add instance
Adds a configuration for an instance to your cluster database configuration.
Syntax
srvctl add instance -db db_unique_name -instance instance_name
-node node_name [-force]
Parameters
Table: srvctl add instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | The unique name of the database you are adding the instance to |
-instance instance_name | The name of the instance you are adding |
-node node_name | The name of the node on which you are creating the instance |
-force | Optionally, you can force the add operation, even though some resources will be stopped. |
Usage Notes
- You can only use this command with Oracle Clusterware and Oracle RAC.
- This command increments the
CARDINALITYresource attribute. - If you attempt to use this command on an Oracle RAC One Node database, then the command returns an error stating you must convert the database to Oracle RAC.
Examples
Examples of this command are:
$ srvctl add instance -db crm -instance crm01 -node gm01
$ srvctl add instance -db crm -instance crm02 -node gm02
$ srvctl add instance -db crm -instance crm03 -node gm03
srvctl disable instance
Disables a database instance.
If the database instance that you disable with this command is the last enabled database instance, then this operation also disables the database.
Note:
This command is only available with Oracle Clusterware and Oracle RAC.
If you run this command on an Oracle RAC One Node database, then the command returns an error instructing you to use the database noun, instead.
Syntax
srvctl disable instance -db db_unique_name -instance "instance_name_list"
Parameters
Table: srvctl disable instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Specify the unique name for the database for which you want to disable the instance. |
-instance " instance_name_list " | Specify an instance name or a comma-delimited list of instance names enclosed in double quotation marks ( "" ) you want to disable. |
Example
The following example disables two instances of the crm database, named crm1 and crm2:
$ srvctl disable instance -db crm -instance "crm1,crm3"
srvctl enable instance
Enables an instance of an Oracle RAC database.
If you use this command to enable all instances, then the database is also enabled.
Note:
You can only use this command with Oracle Clusterware and Oracle RAC.
If you run this command on an Oracle RAC One Node database, then the command returns an error instructing you to use the database noun, instead.
Syntax
srvctl enable instance -db db_unique_name -instance "instance_name_list"
Parameters
Table: srvctl enable instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Specify the unique name of the database for which you want to enable instances. |
-instance " instance_name_list " | Specify a comma-delimited list of instance names enclosed in double quotation marks ( "" ) that you want to enable. |
Example
The following example enables two instances of the crm database:
$ srvctl enable instance -db crm -instance "crm1,crm2"
srvctl modify instance
This command modifies the configuration for a database instance from its current node to another node.
Syntax
Note:
The policy-managed database deployment option is desupported in Oracle AI Database 26ai.
srvctl modify instance -db db_unique_name -instance instance_name
-node node_name
Parameters
Table: srvctl modify instance Command Parameters
| Parameter | Description |
|---|---|
-database db_unique_name | Specify the unique name for the database. |
-instance instance_name | Specify the database instance name. Note: If you specify an instance name that has never been started before, then you may have to assign an instance number, undo, and redo in the SPFILE. |
-node node_name | Name of the node on which to run the instance. |
Usage Notes
You cannot use this command to rename or relocate a running instance.
Examples
The following example to changes the configuration of a database, amdb, so that the database instance, amdb1, runs on the specified node, mynode:
$ srvctl modify instance -db amdb -instance amdb1 -node mynode
The following example removes the directive established by the previous example:
$ srvctl modify instance -db pmdb -instance pmdb1_1 -node ""
srvctl remove instance
Removes the configurations for an instance of a database.
Syntax
srvctl remove instance -db db_unique_name -instance instance_name
[-noprompt] [-force]
Parameters
Table: srvctl remove instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Specify the unique name of the database. |
-instance instance_name | Specify the name of the instance that you want to remove. |
-noprompt | Use this parameter to suppress prompts. |
-force | Use this parameter to skip checking that the instance is not running, and remove it even though it is running. This parameter also skips checking that the instance has no running services using it, and causes those services to stop before the instance is removed. |
Usage Notes
- You can use this command only with Oracle Clusterware and Oracle RAC.
- If you use the
-forceparameter, then any services running on the instance stop. Oracle recommends that you reconfigure services to not use the instance you want to removed as a preferred or available instance before removing the instance. - If you attempt to use this command on an Oracle RAC One Node database, then the command returns an error stating that cannot remove the instance except by removing the database.
Example
The following example removes the crm01 database instance from the crm database.
$ srvctl remove instance -db crm -instance crm01
srvctl start instance
Starts instances and their dependencies in the cluster database.
Use the srvctl start instance command to start database instances, and all listeners on nodes with database instances.
Syntax
Use the srvctl start instance command with one of these syntax models:
To start all Oracle Clusterware managed database instances on one or more nodes:
srvctl start instance -node "node_list" [-startoption start_options]
To start an instance of a database on a specific node:
srvctl start instance -db db_unique_name -node node_name
[-instance "instance_name"] [-startoption start_options]
To start an instance of a database on one or more nodes:
srvctl start instance -db db_unique_name -node "node_list" [-startoption start_options]
To start specific instances of a database on available nodes:
srvctl start instance -db db_unique_name -instance "inst_name_list"
[-startoption start_options]
Parameters
Table: srvctl start instance Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Unique name for the database |
-node node_name or -node " node_list " | The name of a single node or a comma-delimited list of node names |
-instance " instance_name " or -instance " inst_name_list " | The name of a single instance or a comma-delimited list of instance names |
-startoption start_options | Options for startup command, such as Note: For multi-word startup options, such as |
Usage Notes
- This command is only available with Oracle Clusterware and Oracle RAC.
- If you run this command on an Oracle RAC One Node database, then the command returns an error instructing you to use the
databasenoun, instead.
Related Topics
srvctl status instance
Displays the status of instances.
Syntax
srvctl status instance -db db_unique_name {-node node_list | -instance instance_name_list}
[-force] [-detail] [-verbose]
Parameters
Table: srvctl status instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | The unique name of the database. |
-node node_list | A comma-separated list of node names. |
-instance instance_name_list | A comma-separated list of instance names. |
-force | Optionally, you can include a list of the disabled applications. |
-detail | Optionally, print detailed status information of the instance. |
-verbose | Display verbose output. |
Usage Notes
You can only use this command with Oracle Clusterware and Oracle RAC.
Examples
Example of this command is:
$ srvctl status instance -db crm -node gm01,gm02
srvctl stop instance
The srvctl stop instance command stops instances and stops any services running on specified instances.
Syntax
Use this command with one of the following syntax models.
To stop all instances on one or more nodes:
srvctl stop instance -node "node_list" [-stopoption stop_options]
[-drain_timeout timeout] [-force] [-failover] [-verbose]
To stop instances for a database that are running on specific nodes:
srvctl stop instance -db db_unique_name -node "node_list"
[-stopoption stop_options] [-drain_timeout timeout] [-force] [-failover] [-verbose]
To stop one or more instances by name for a database:
srvctl stop instance -db db_unique_name -instance "instance_name_list"
[-stopoption stop_options] [-drain_timeout timeout] [-force] [-failover] [-verbose]
Parameters
Table: srvctl stop instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Specify the unique name for the database for which you want to stop an instance. |
-node " node_list " | Specify a comma-delimited list of node names enclosed in double quotation marks ( If you specify |
-instance " instance_name_list " | Specify a comma-delimited list of instance names enclosed in double quotation marks ( "" ). |
-stopoption stop_options | Specify options for the shutdown command, such as NORMAL, TRANSACTIONAL LOCAL, IMMEDIATE, or ABORT. |
-drain_timeout timeout | 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 Note: If the |
-force | Use this parameter to forcibly stop the instance and any running services if the srvctl stop instance command fails with an error. |
-failover | If you specify -failover, then the services fail over to an available instance or may start a new instance, when the current instance stops. |
-verbose | Display verbose output. |
Usage Notes
If you run this command on an Oracle RAC One Node database, then the command returns an error instructing you to use the srvctl stop database command instead.
Example
The following command example stops the instance of the db1 database running on the node server1, and includes verbose output:
$ srvctl stop instance -db db1 -node server1 -drain_timeout 50 -verbose
Draining in progress on services svc1
Draining in progress on services svc1
Drain complete on services svc1
Related Topics
srvctl transfer instance
Transfers Oracle RAC and Oracle Oracle RAC One Node databases, PDBs, and services from the old Oracle home to the new Oracle home in single-server rolling database maintenance.
Syntax
srvctl transfer instance -db db_unique_name [-node node_list]
[-stopoption stop_options] [-drain_timeout timeout] [-rollback] [-verbose]
Parameters
Table: srvctl transfer instance Command Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | Specify the unique name of the database you want to relocate. |
-node target_node | Comma-separated list of nodes on which you want to transfer the instances from the old Oracle homes to the new Oracle homes. |
-stopoption NORMAL | Use this parameter to override the default shutdown option for the instance running from the old Oracle home, such as NORMAL, TRANSACTIONAL, IMMEDIATE, and ABORT. |
-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. Note: If the |
-rollback | Use this parameter to rollback an online instance transfer. |
-verbose | Use this parameter to display verbose output. |
Example
The following example transfers an Oracle RAC One Node database instance of database named rac1 on the node called node1.
$ srvctl transfer instance -db rac1 -node node1
srvctl update instance
The srvctl update instance command changes the open mode or the target Oracle ASM instance of the database instances.
Syntax
srvctl update instance -db db_unique_name [-instance "instance_name_list"
| -node "node_list"] [-startoption start_options] [-targetinstance instance_name]
Parameters
| Parameter | Description |
|---|---|
-db db_unique_name | The unique name of the database |
-instance " instance_name_list " | -node " node_list " | A comma-delimited list of instance names or node names that you want to update. If you specify a list of node names, then SRVCTL udpates the instances running on those specific nodes. |
-startoption start_options | The specify startup options for the database, such as OPEN, MOUNT, or "READ ONLY" |
-targetinstance instance_name | The target Oracle ASM or Oracle ASM IOServer instance. Use double quotation marks ( "" ) with no space in-between to specify the default target instance. |
Examples
An example of this command is:
$ srvctl update instance -db db00 -instance db00_3 -targetinstance +ASM2