Cloned from dbca in command mode

Hello everyone, how about you are. Today we are going to talk again about an Oracle 19c functionality that can be useful when creating new databases. This functionality allows you to create a new instance in version 19c from another that we have created by cloning it. It can be done from the graphical mode of the dbca but in this case we are going to tell you how it can be done with the dbca in silent mode.

Syntax for cloning from dbca

The option we discussed is called createDuplicateDB and the parameters it supports are:

dbca -createDuplicateDB 
 -gdbName global_database_name 
 -primaryDBConnectionString easy_db_connection_string
 -sid database_system_identifier
 [-initParams initialization_parameters
 [-initParamsEscapeChar initialization_parameters_escape_character]]
 [-sysPassword SYS_user_password]
 [-policyManaged | -adminManaged]
 [-policyManaged
 -serverPoolName server_pool_names
 [-pqPoolName pq_pool_name]
 [-createServerPool new_server_pool_name
 [-pqPoolName new_pq_pool_name]
 [-force]
 [-pqCardinality pq_cardinality_of_the_new_server_pool]
 [-cardinality cardinality_of_the_new_server_pool]]]
 [-adminManaged]
 [-nodelist database_nodes_list]
 [-datafileDestination data_files_directory]
 [-recoveryAreaDestination recovery_files_directory
 [-recoveryAreaSize fast_recovery_area_size]]
 [-databaseConfigType {SINGLE | RAC | RACONENODE}
 [-RACOneNodeServiceName service_name_for_RAC_One_Node_database]]
 [-useOMF {true | false}]
 [-storageType {FS | ASM} 
 [-asmsnmpPassword ASMSNMP_password]
 -datafileDestination database_files_directory]
 [-createListener new_database_listener]
 [-createAsStandby 
 [-dbUniqueName db_unique_name_for_standby_database]]
 [-customScripts custom_sql_scripts_to_run_after_database_creation]
 [-useWalletForDBCredentials {true | false}
 -dbCredentialsWalletPassword wallet_account_password
 -dbCredentialsWalletLocation wallet_files_directory] 

In the primaryDBConnectionString section we have to indicate the connection string to the source server instance and supports the following format:

"host[:p ort][/service_name][:server][/instance_name]"

The chain of Connection is very similar to what we use for a normal jdbc connection.

Cloned from dbca in command mode

In the -databaseConfigType parameter we indicate what type of database we are going to create:

  • SINGLE: Single individual database.
  • RAC: Oracle RAC database.
  • RACONENODE: Oracle RAC One Node database.

We can also define the configuration values that we want to be different from the original using the -initParams parameter.

To define the storage we use the -storageType parameter that allows us to indicate FS or ASM and in conjunction with -datafileDestination and -useOMF we indicate the path and how we want the files to be created.

With -sysPassword we indicate the password of the sys user in source to perform the cloning.

As a last Important step we can decide if we create a new listener. We indicate that with the –createListener option.

Let’s see how cloning a database would be launched with all the complete steps:

./dbca -silent -createDuplicateDB -gdbName DB19NEW
-primaryDBConnectionString dbprod.gpsos.es:1522/DB19OLD -sid DB19NEW
-databaseConfigType SINGLE -initParams db_unique_name=DB19NEW -sysPassword syspass1234

-storageType ASM -datafileDestination +DATA1 -useOMF true -createListener LISTENER_DB19NEW:1525

The exit that we will see if everything goes well will be something like this:

 Prepare for db operation
 22% complete
 Listener config step
 44% complete
 Auxiliary instance creation
 67% complete
 RMAN duplicate
 89% complete
 Post duplicate database operations
 100% complete
  
 Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/DB19NEW/DB19NEW.log" for further details. 

How we have able to see the functionality is very interesting and in a simple way we can have a new instance created from an existing one.

Greetings and see you next time.

Source: http://oracledbatr.blogspot.com/2017/07/dataguard-12cr2-new-feature-using-dbca.html

If you do not want to miss more tips how this sign up for our newsletter

Comments are closed.