PDB Commands

Use commands with the pdb keyword to manage the Pluggable Databases (PDBs) in your cluster database.

You can add, modify, remove, list the configuration of, enable, disable, start, stop, and obtain the status of PDBs.

Related Topics

srvctl add pdb

Adds a Pluggable Database (PDB) configuration to Oracle Clusterware.

Syntax

srvctl add pdb -db db_unique_name -pdb pdb_name
  [-cardinality {num_of_instances | ALL}] [-maxcpu max_cpu_usage]
  [-mincpuunit min_cpu_usage] [-approot approot_database]
  [-startoption start_options] [-stopoption stop_options]
  [-policy policy] [-importfile file_name]

Parameters

Table: srvctl add pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the Container Database (CDB).
-pdb pdb_nameThe name of the PDB.
-cardinality { num_of_instances | ALL}

The number of instances of the PDB to be open at any time. If you specify ALL, then the PDB can open in any or all instances of the cluster database.

Note: If this parameter is not set, then the PDB can run on any node on which the cluster database can run. Where the PDB runs is determined by the preferred and available lists of the PDB services. If this parameter is set, then the PDB services must be UNIFORM, SINGLETON, or DUPLEX.

-maxcpu max_cpu_usageThe maximum CPU usage limit for the PDB.
-mincpuunit min_cpu_usageThe minimum CPU usage limit for the PDB.
-approot approot_databaseThe application root PDB.
-startoption start_options

Startup options for the PDB, such as OPEN or OPEN READ ONLY. The default value is an empty string, which means the PDB uses the same open mode as the CDB.

Note: 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".

-stoption stop_optionsStop options for the PDB, such as NORMAL. The default stop option is IMMEDIATE.
-policy policy

Management policy for the Pluggable Database, where policy can be one of the following values:

  • AUTOMATIC: The PDBs are started automatically when the database is started with the srvctl start database command. With this management policy, a PDB always starts with its CDB starts, whether it was running before or not.
    Note: When you add a PDB using SRVCTL, then the PDB's default management policy depends on the CDB's management policy. For example, if CDB's management policy is AUTOMATIC, then PDB's management policy is also set to AUTOMATIC.
  • MANUAL: The PDB is restarted when the PDB services require it. The PDB restart is driven by the previous running state and management policy of the PDB services. A MANUAL PDB with MANUAL services is restarted after the CRS restart.
  • RESTART: The PDB is restarted upon restart of the database host computer.
-importfile file_nameSpecify the JSON file containing the resource configuration to use when adding or re-creating the resource.

Usage Notes

If a PDB's management policy is RESTART, then the management policy for the CDB must be RANK.

Related Topics

srvctl config pdb

Displays the configuration information for a Pluggable Database (PDB).

Syntax

srvctl config pdb -db db_unique_name [-pdb pdb_name]

Parameters

Table: srvctl config pdb Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the Container Database (CDB).
-pdb pdb_nameThe name of the PDB.

Example

This examples shows the configuration information for the crmeast PDB.

srvctl config pdb -db crm -pdb crmeast

Pluggable database name: crmeast
Application Root PDB:
Maximum CPU count (whole CPUs): 0
Minimum CPU count unit (1/100 CPU count): 0
Start Option: open
Stop Option: immediate

srvctl disable pdb

Disables a running Pluggable Database (PDB) from Oracle Clusterware management.

Syntax

srvctl disable pdb -db db_unique_name -pdb pdb_name [-node node_name]

Parameters

Table: srvctl disable pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the Container Database (CDB).
-pdb pdb_nameThe name of the PDB .
-node node_name

The node on which you want to disable the PDB.

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

Example

The following example disables the PDB crmeast:

srvctl disable pdb -db crm -pdb crmeast

srvctl enable pdb

Enables the Pluggable Database (PDB) for Oracle Clusterware management.

Syntax

srvctl enable pdb -db db_unique_name -pdb pdb_name [-node node_name]

Parameters

Table: srvctl enable pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the Container Database (CDB).
-pdb pdb_nameThe name of the PDB that you want to enable.
-node node_name

The name of the node on which the PDB resource resides that you want to enable.

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

Example

The following example enables a PDB named crmeast for Oracle Clusterware management:

srvctl enable pdb -db crm -pdb crmeast

srvctl modify pdb

Modifies the configuration for a Pluggable Database (PDB).

Syntax

srvctl modify pdb -db db_unique_name -pdb pdb_name
  [-cardinality {num_of_instances | ALL}]
  [-maxcpu max_cpu_usage] [-mincpuunit min_cpu_usage]
  [-rank rank] [-startoption start_options]
  [-stopoption stop_options] [-policy policy]

Parameters

Table: srvctl modify pdb Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the Container Database (CDB).
-pdb pdb_nameThe name of the PDB.
-cardinality { num_of_instances | ALL}

The number of instances of the PDB to be open at any time. If you specify ALL, then a PDB is open in every available Container Database (CDB) in the cluster database.

Note: You can modify the -cardinality parameter only if you had set the -cardinality parameter when creating the PDB.

-maxcpu max_cpu_usage

The maximum CPU usage limit for the PDB in whole CPUs. Specify a positive integer value that is equal to or greater than 1.

You must be logged in as either the grid or the root user to modify this parameter.

-mincpuunit min_cpu_usage

The minimum CPU usage limit for the PDB. Specify a positive integer value that is equal to or greater than 10. The value must be in hundredths of the total CPU count (1/100 CPU count).

You must be logged in as either the grid or the root user to modify this parameter.

-rank rank

The rank of the PDB. The range of values you can specify for this parameter is 0 to 5. The default value is 0.

You must be logged in as either the grid or the root user to modify this parameter.

Note: You can modify the -rank parameter only if you had set the -rank parameter when creating the PDB.

-startoption start_options

Startup options for the PDB, such as OPEN or OPEN READ ONLY. The default value is an empty string, which means the PDB uses the same open mode as the CDB.

Note: 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".

-stoption stop_optionsStop options for the PDB, such as NORMAL. The default stop option is IMMEDIATE.
-policy policyManagement policy for the Pluggable Database, where policy can be one of the following values: AUTOMATIC, MANUAL, or RESTART.

Related Topics

srvctl relocate pdb

Relocates a Pluggable Database (PDB) from one Oracle Clusterware node to another.

Syntax

srvctl relocate pdb -db db_unique_name -currentnode current_node [-pdb pluggable_database]
  [-targetnode target_node] [-drain_timeout timeout] [-stopoption stop_options] [-force [-verbose]]

Parameters

Table: srvctl relocate pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the Container Database (CDB).
-currentnode current_nodeName of the node where the PDB is currently running.
-pdb pdb_nameThe name of the PDB.
-targetnode target_nodeName of node where the PDB is to be relocated. If you do not specify a target node, then Oracle Clusterware chooses a new location.
-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.

Drain timeout is the maximum time the service waits before exiting, until the draining of sessions is completed. If session draining completes in 10 seconds and the drain timeout value is 100 seconds, then SRVCTL continues after 10 seconds. It does not wait for the remaining 90 seconds.

-stopoption stop_optionsStop options for the PDB, such as NORMAL or IMMEDIATE. The default stop option is IMMEDIATE.
-forceUse this parameter to force relocate the PDB and its services, and any dependent resources.
-verboseOptionally, you can use this parameter to display detailed output.

Example

This example relocates the PDB orclpdb1 from node1 to node2:

srvctl relocate pdb -db orcl -pdb orclpdb1 -currentnode node1 -targetnode node2

srvctl remove pdb

Removes the Pluggable Database (PDB) configuration from Oracle Clusterware management.

Syntax

srvctl remove pdb -db db_unique_name -pdb pdb_name
    [-force] [-noprompt] [-verbose]

Parameters

Table: srvctl remove pdb Command Parameters

ParameterDescription
-db db_unique_nameUnique name of the Container Database (CDB).
-pdb pdb_nameThe name of the PDB.
-forceForcibly remove the PDB and ignore any dependencies.
-nopromptSuppress prompts.
-verboseDisplay verbose output.

Example

This example shows how to remove configuration from Oracle Clusterware management of the PDB named crmeast in the Container Database (CDB) named crm.

$ srvctl remove pdb -db crm -pdb crmeast

srvctl start pdb

Starts a Pluggable Database (PDB) and the associated services based on the management policy of the service. All the services with the AUTOMATIC management policy will start automatically.

Syntax

srvctl start pdb -db db_unique_name -pdb pdb_name
  [-startoption start_options] [-node node_list]

Parameters

Table: srvctl start pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the database to start.
-pdb pdb_nameThe name of the PDB to start.
-startoption start_options

Options for the startup command, such as READ ONLY or OPEN.

Notes:

  • This command parameter supports all PDB 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: STARTUP command in SQL*Plus User's Guide and Reference

-node node_listComma-separated list of nodes on which to start the PDB.

Examples

The following example starts the crmeast PDB in READ ONLY mode:

srvctl start pdb -db crm -pdb crmeast -startoption "read only"

srvctl status pdb

This command displays the current state of the Pluggable Database (PDB).

Syntax

srvctl status pdb -db db_unique_name [-pdb pdb_name]
    [-detail]

Parameters

Table: srvctl status pdb Parameters

ParameterDescription
-db db_unique_nameThe unique name of the Container Database (CDB).
-pdb pdb_nameThe name of the PDB. If you do not specify a PDB name, then information on all the PDBs in that particular database are displayed.
-detailDisplay detailed status information.

Examples

This example shows sample output for the status information for the crmeast and crmnorth PDBs.

$ srvctl status pdb -db crm -pdb crmeast

Pluggable database crmeast of crm is running on nodes site1, site3.

$ srvctl status pdb -db crm -pdb crmnorth

Pluggable database crmnorth of crm is not running.

srvctl stop pdb

Stops a Pluggable Database (PDB) and its services.

Syntax

srvctl stop pdb -db db_unique_name -pdb pdb_name [-node node_name]
  [-stopoption stop_options] [-drain_timeout timeout]
  [-stopsvcoption stop_service_options] [-force]

Parameters

Table: srvctl stop pdb Command Parameters

ParameterDescription
-db db_unique_nameThe unique name for the Container Database (CDB).
-pdb pdb_nameThe name of the PDB to stop.
-node node_nameThe name of the node on which to stop the PDB. If you do not specify any nodes, then the specified PDB is stopped on all the nodes where the PDB is running.
-stopoption stop_optionsOptions for the shutdown command, such as NORMAL or IMMEDIATE. The default value is IMMEDIATE.
-drain_timeout timeout

The time, in seconds, for the resource draining action to complete. 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 or srvctl stop pdb), until the draining of sessions is completed. If session draining completes in 10 seconds and the drain timeout value is 100 seconds, then SRVCTL continues after 10 seconds. It does not wait for the remaining 90 seconds.

-stopsvcoption stop_service_optionsOptions for stopping services, such as TRANSACTIONAL or IMMEDIATE. If you do not specify this open, then the stop option set in the service resource attribute USR_ORA_STOP_MODE is used.
-forceUse this parameter to force stop the PDB and its services, and any dependent resources.

Example

The following command stops a PDB named crmeast that is open in the crm database, allowing 50 seconds for all sessions to drain from the PDB:

srvctl stop pdb -db crm -pdb crmeast -drain_timeout 50