switch_database

Switches the Oracle listener to a new Oracle home

Format

emcli switch_database 
–input_file_loc=” path of input file” 
-dest_oh=<path of new Gold image based Oracle home> 
-host_creds=<Normal Named host credential> 
-privilege_creds=<Named credential with root privileges> 

[ ] indicates an optional parameter

If the target type, destination Oracle home, and credentials are consistent throughout multiple databases, users can perform the same task without a response file.

Options

  • input_file_loc: Input file path location

  • target_name: Database target name which needs to be switched.

  • target_type:
    • For single instance database: oracle_database

    • For RAC/RAC One database: rac_database

  • dest_oh: Path of new Oracle home where the database needs to be switched to.

  • host_creds: Named credentials for the Oracle home owner on the host following “<Named Credentials>:<Owner>”

    The “Owner” field is the owner of the named credential in Enterprise Manager.

    If no “Owner” is specified, the logged-in user is taken by default.

  • privilege_creds: Named credentials on the database host which has root privileges.

  • dataguard_role: This is an explicit mandatory parameter which the user has to set to “STANDBY” in case this is a standby switch operation.

Note:

If database names are provided in the command line, input file will not be used.

If input file is specified, for each database, the inputs in the response file override the one in the command line.

In case the preferred credentials are set for the host, users can choose not to provide “host_creds” and “privilege_creds” as part of emcli command (or input file).

We have a validation in initialize DP step for the same. If credentials are not provided as part of emcli and also the preferred credentials are not set, the DP will error out without any processing.

In case this flag is not specified, it is considered to be a switch operation for databases without data guard configuration.

Example Input File

input_file: This file will be a “xml” format file and will contain details for each database target

<root>
<target>
<target_name>racm</target_name>
<target_type>rac_database</target_type>
<dest_oh>/scratch/aimedb/home1</dest_oh>
<host_creds>AIMEDB_NORMAL:SYSMAN</host_creds>
<privilege_creds>AIMEDB_P:SYSMAN</privilege_creds>
</target>
<target
><target_name>racp</target_name>
<target_type>rac_database</target_type>
<dest_oh>/scratch/aimedb/home2</dest_oh>
<host_creds>AIMEDB_NORMAL:SYSMAN</host_creds>
<privilege_creds>AIMEDB_P:SYSMAN</privilege_creds>
</target>
</root>

Example 5-2 Examples

This examples demonstrates how to use switch_database when there is more than one database.

emcli switch_database 
–target_name=<DB target name>[,<DB target name2>]* 
-target_type=<oracle_database|rac_database>  
-dest_oh=<path of new Gold image based Oracle home> 
-host_creds=<Normal Named host credential> 
-privilege_creds=<Named credential with root privileges> 
–dataguard_role=<Standby|Primary> -startupAfterSwitch=false