I have recently blogged about how to create a new PDB on ExaCC in a Data Guard environment, see https://www.dbi-services.com/blog/create-new-pdb-in-a-data-guard-environment-on-exacc/.
And what about if I clone a PDB on the primary CDB? Let’s see.
Read more: And what about cloning a PDB in a Data Guard environment on ExaCC?Clone PDB on the primary database
Let’s clone our previous NEWPDB into NEWPDB_2 with dbaascli.
oracle@ExaCC-chz1-cl01n1:~/ [MYCDB1 (CDB$ROOT)] dbaascli pdb localclone --pdbName NEWPDB --dbName MYCDB --targetPDBName NEWPDB_2 DBAAS CLI version 24.1.2.0.0 Executing command pdb localclone --pdbName NEWPDB --dbName MYCDB --targetPDBName NEWPDB_2 Job id: 584e3b45-7725-4132-a865-88b20a559e4e Session log: /var/opt/oracle/log/MYCDB/pdb/localClone/dbaastools_2024-05-31_10-56-38-AM_394962.log Loading PILOT... Session ID of the current execution is: 7855 Log file location: /var/opt/oracle/log/MYCDB/pdb/localClone/pilot_2024-05-31_10-56-49-AM_399103 ----------------- Running Plugin_initialization job Enter TDE_PASSWORD: ********************* Completed Plugin_initialization job ----------------- Running Validate_input_params job Completed Validate_input_params job ----------------- Running Validate_target_pdb_service_name job Completed Validate_target_pdb_service_name job ----------------- Running Perform_dbca_prechecks job Completed Perform_dbca_prechecks job Acquiring read lock: _u02_app_oracle_product_19.0.0.0_dbhome_2 Acquiring write lock: mycdb Acquiring write lock: newpdb_2 ----------------- Running PDB_creation job Completed PDB_creation job ----------------- Running Load_pdb_details job Completed Load_pdb_details job ----------------- Running Configure_pdb_service job Completed Configure_pdb_service job ----------------- Running Configure_tnsnames_ora job Completed Configure_tnsnames_ora job ----------------- Running Set_pdb_admin_user_profile job Completed Set_pdb_admin_user_profile job ----------------- Running Lock_pdb_admin_user job Completed Lock_pdb_admin_user job ----------------- Running Register_ocids job Skipping. Job is detected as not applicable. ----------------- Running Prepare_blob_for_standby_in_primary job Completed Prepare_blob_for_standby_in_primary job Releasing lock: newpdb_2 Releasing lock: mycdb Releasing lock: _u02_app_oracle_product_19.0.0.0_dbhome_2 ----------------- Running Generate_dbsystem_details job Acquiring native write lock: global_dbsystem_details_generation Releasing native lock: global_dbsystem_details_generation Completed Generate_dbsystem_details job ---------- PLUGIN NOTES ---------- Note: Pluggable database operation is performed on the primary database. In order to successfully complete the operation, the file /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar needs to be copied to the standby database node and additional steps need to be run on all standby databases. Refer to the Cloud Service documentation for the complete steps. ---------- END OF PLUGIN NOTES ---------- dbaascli execution completed
Checks
Let’s check new clone on the primary side:
oracle@ExaCC-chz1-cl01n1:~/ [MYCDB1 (CDB$ROOT)] sqh SQL*Plus: Release 19.0.0.0.0 - Production on Fri May 31 11:00:12 2024 Version 19.23.0.0.0 Copyright (c) 1982, 2023, Oracle. All rights reserved. Connected to: Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production Version 19.23.0.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 READ WRITE NO 5 PDB3 READ WRITE NO 6 NEWPDB READ WRITE NO 7 NEWPDB_2 READ WRITE NO SQL>
And on the standby side:
oracle@ExaCC-chz2-cl01n1:~/ [MYCDB1 (CDB$ROOT)] sqh SQL*Plus: Release 19.0.0.0.0 - Production on Fri May 31 11:00:41 2024 Version 19.23.0.0.0 Copyright (c) 1982, 2023, Oracle. All rights reserved. Connected to: Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production Version 19.23.0.0.0 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 READ ONLY NO 5 PDB3 READ ONLY NO 6 NEWPDB READ ONLY NO 7 NEWPDB_2 MOUNTED SQL> select name, total_size/1024/1024/1024 GB from v$pdbs; NAME GB -------------------- ---------- PDB$SEED 1.85546875 PDB1 2308.65039 PDB2 1534.89966 PDB3 1095.55273 NEWPDB 4.34375 NEWPDB_2 0 6 rows selected.
As expected the PDB clone on the standby side has been created with the Data Guard redo, but is empty.
Resolve the problem
Let’s transfer the BLOB file the initial commands provided us. The file is here:
[opc@ExaCC-chz2-cl01n1 ~]$ sudo mv /tmp/MYCDB_2024-05-31_10-56-49-AM_399103.tar /var/opt/oracle/log/reg_tmp_files/ [opc@ExaCC-chz2-cl01n1 ~]$ sudo chown oracle: /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar
With the blob file as reference, clone the PDB on the standby side. It is the exact same command used on the primary side, with just an additional command --standbyBlobFromPrimary
.
oracle@ExaCC-chz2-cl01n1:~/ [MYCDB1 (CDB$ROOT)] ls -ltrh /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar -rw-r--r-- 1 oracle oinstall 160K May 31 11:03 /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar oracle@ExaCC-chz2-cl01n1:~/ [MYCDB1 (CDB$ROOT)] dbaascli pdb localclone --pdbName NEWPDB --dbName MYCDB --targetPDBName NEWPDB_2 --standbyBlobFromPrimary /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar DBAAS CLI version 24.1.2.0.0 Executing command pdb localclone --pdbName NEWPDB --dbName MYCDB --targetPDBName NEWPDB_2 --standbyBlobFromPrimary /var/opt/oracle/log/reg_tmp_files/MYCDB_2024-05-31_10-56-49-AM_399103.tar Job id: eabccc30-af71-4d49-ba59-e3fce15c0619 Session log: /var/opt/oracle/log/MYCDB/pdb/localClone/dbaastools_2024-05-31_11-07-21-AM_398735.log Loading PILOT... Session ID of the current execution is: 5625 Log file location: /var/opt/oracle/log/MYCDB/pdb/localClone/pilot_2024-05-31_11-07-34-AM_1320 ----------------- Running Plugin_initialization job Enter SYS_PASSWORD: ************************ Enter TDE_PASSWORD: ********************* Completed Plugin_initialization job ----------------- Running Validate_input_params job Completed Validate_input_params job ----------------- Running Validate_target_pdb_service_name job Completed Validate_target_pdb_service_name job ----------------- Running Perform_dbca_prechecks job Completed Perform_dbca_prechecks job Acquiring read lock: _u02_app_oracle_product_19.0.0.0_dbhome_2 Acquiring write lock: mycdb Acquiring write lock: newpdb_2 ----------------- Running PDB_creation job Completed PDB_creation job ----------------- Running Load_pdb_details job Completed Load_pdb_details job ----------------- Running Configure_pdb_service job Completed Configure_pdb_service job ----------------- Running Configure_tnsnames_ora job Completed Configure_tnsnames_ora job ----------------- Running Set_pdb_admin_user_profile job Skipping. Job is detected as not applicable. ----------------- Running Lock_pdb_admin_user job Skipping. Job is detected as not applicable. ----------------- Running Register_ocids job Skipping. Job is detected as not applicable. ----------------- Running Prepare_blob_for_standby_in_primary job Skipping. Job is detected as not applicable. Releasing lock: newpdb_2 Releasing lock: mycdb Releasing lock: _u02_app_oracle_product_19.0.0.0_dbhome_2 ----------------- Running Generate_dbsystem_details job Acquiring native write lock: global_dbsystem_details_generation Releasing native lock: global_dbsystem_details_generation Completed Generate_dbsystem_details job dbaascli execution completed
Final checks
And the new cloned PDB is also now opened READ ONLY on the standby side.
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ ONLY NO 4 PDB2 READ ONLY NO 5 PDB3 READ ONLY NO 6 NEWPDB READ ONLY NO 7 NEWPDB_2 READ ONLY NO SQL>
And the Data Guard is in sync.
oracle@ExaCC-chz1-cl01n1:~/ [MYCDB1 (CDB$ROOT)] dgh DGMGRL for Linux: Release 19.0.0.0.0 - Production on Fri May 31 11:22:32 2024 Version 19.23.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect / Connected to "MYCDB_CHZ1" Connected as SYSDG. DGMGRL> show configuration lag Configuration - fsc Protection Mode: MaxAvailability Members: MYCDB_CHZ1 - Primary database MYCDB_CHZ2 - Physical standby database Transport Lag: 0 seconds (computed 0 seconds ago) Apply Lag: 0 seconds (computed 0 seconds ago) Fast-Start Failover: Disabled Configuration Status: SUCCESS (status updated 44 seconds ago)
BLOB file contents
Let’s see what contains the blob file. The file contains the metadata architecture that will be used to recreate the PDB on the standby side.
[opc@svl-sirip614 chk_blob_exacc_MYCDB]$ ls -ltrh total 132K -rw-r--r--. 1 opc opc 130K May 31 13:43 MYCDB_2024-05-31_09-52-53-AM_101724.tar [opc@svl-sirip614 chk_blob_exacc_MYCDB]$ tar xf MYCDB_2024-05-31_09-52-53-AM_101724.tar [opc@svl-sirip614 chk_blob_exacc_MYCDB]$ ls MYCDB_2024-05-31_09-52-53-AM_101724.tar db_wallet pwdmycdb_chz1.639.1169979391 wallet_root [opc@svl-sirip614 chk_blob_exacc_MYCDB]$ tar tvf MYCDB_2024-05-31_09-52-53-AM_101724.tar drwxr-x--- oracle/oinstall 0 2024-05-30 16:54 wallet_root/ drwxr-x--- oracle/oinstall 0 2024-05-31 09:54 wallet_root/tde/ -rw------- oracle/oinstall 15145 2024-05-31 09:54 wallet_root/tde/ewallet.p12 -rw------- oracle/oinstall 15190 2024-05-31 09:54 wallet_root/tde/cwallet.sso -rw------- oracle/oinstall 2553 2024-05-26 10:24 wallet_root/tde/ewallet_2024052608245022.p12 -rw------- oracle/oinstall 3993 2024-05-26 10:31 wallet_root/tde/ewallet_2024052608313060.p12 -rw------- oracle/oinstall 0 2024-05-26 17:37 wallet_root/tde/ewallet.p12.lck -rw------- oracle/oinstall 0 2024-05-26 17:37 wallet_root/tde/cwallet.sso.lck -rw------- oracle/asmadmin 5465 2024-05-26 17:38 wallet_root/tde/ewallet_2024052615380164.p12 -rw------- oracle/asmadmin 6953 2024-05-26 17:55 wallet_root/tde/ewallet_2024052615552711.p12 -rw------- oracle/asmadmin 8201 2024-05-29 14:25 wallet_root/tde/ewallet_2024052912250856.p12 -rw------- oracle/asmadmin 9689 2024-05-29 15:34 wallet_root/tde/ewallet_2024052913345698.p12 -rw------- oracle/asmadmin 10937 2024-05-29 17:39 wallet_root/tde/ewallet_2024052915390341.p12 -rw------- oracle/asmadmin 12409 2024-05-29 18:05 wallet_root/tde/ewallet_2024052916054502.p12 -rw------- oracle/asmadmin 13673 2024-05-31 09:54 wallet_root/tde/ewallet_2024053107541551.p12 -rw-r----- oracle/oinstall 326 2024-05-26 10:32 wallet_root/cdb_ocids.json_20240526161751 -rw-r----- oracle/oinstall 326 2024-05-26 16:17 wallet_root/cdb_ocids.json drwx------ oracle/oinstall 0 2024-05-27 16:22 wallet_root/195DC5B0E2F4976CE063021FA20AF881/ -rw-r----- oracle/oinstall 335 2024-05-27 16:22 wallet_root/195DC5B0E2F4976CE063021FA20AF881/pdb_ocids.json drwx------ oracle/oinstall 0 2024-05-29 16:51 wallet_root/19971A75AFAC7611E063021FA20A7BDE/ -rw-r----- oracle/oinstall 335 2024-05-29 16:51 wallet_root/19971A75AFAC7611E063021FA20A7BDE/pdb_ocids.json drwx------ oracle/oinstall 0 2024-05-30 16:54 wallet_root/1998B7B6E9770BF5E063021FA20A42A7/ -rw-r----- oracle/oinstall 335 2024-05-30 16:54 wallet_root/1998B7B6E9770BF5E063021FA20A42A7/pdb_ocids.json drwxr-xr-x oracle/oinstall 0 2024-05-26 10:35 db_wallet/ -rw------- oracle/oinstall 0 2024-05-26 10:35 db_wallet/cwallet.sso.lck -rw------- oracle/oinstall 619 2024-05-26 10:42 db_wallet/cwallet.sso -rw-r----- grid/oinstall 2560 2024-05-31 09:55 pwdmycdb_chz1.639.1169979391 [opc@svl-sirip614 chk_blob_exacc_MYCDB]$ cat wallet_root/1998B7B6E9770BF5E063021FA20A42A7/pdb_ocids.json { "tenancyOCID" : "ocid1.tenancy.oc1..aaaaaaaa52qxw***************************************************7wka", "compartmentOCID" : "ocid1.compartment.oc1..aaaaaaaadqt**************************************************7tqa", "resourceOCID" : "ocid1.pluggabledatabase.oc1.eu-zurich-1.an5he************************************************5na" } [opc@svl-sirip614 chk_blob_exacc_MYCDB]$ cat wallet_root/cdb_ocids.json { "tenancyOCID" : "ocid1.tenancy.oc1..aaaaaaaa52qxw**************************************************7wka", "compartmentOCID" : "ocid1.compartment.oc1..aaaaaaaadqt2s**************************************************7tqa", "resourceOCID" : "ocid1.database.oc1.eu-zurich-1.an5helj**************************************************a3mq" }
To wrap up
Clone a PDB in a CDB on ExaCC is the same procedure than creating a new PDB.