Skip to main content

HOT CLONE PDB FROM 12c TO19c : ORACLE DATABASE MULTITENANT

 HOT CLONE PDB from 12c è 19c :

 

1 -- Compatibility checks: Ensure that any features or options used in the 12c PDB are compatible with the 19c CDB

SQL> SELECT name, value FROM parameter WHERE name='compatible';

 

2 -- Prepare the Target 19c CDB

Ensure that the target 19c CDB is up and running, and configure a TNS listener to allow connectivity between the source and target databases.

 

3  -- Ensure the common user has required privileges to clone the PDB.

SQL> CREATE USER c##borg IDENTIFIED BY oracle DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp CONTAINER=ALL;

SQL> GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE, SYSOPER TO c##borg CONTAINER = ALL;

 

3 -- Create a Database Link on Target (19c CDB)

From the 19c CDB, create a database link to the source 12c CDB.

SQL> CREATE DATABASE LINK clone_link CONNECT TO <user_with_sufficient_privileges> IDENTIFIED BY "<password>" USING '<12c_TNS>';

 

 

5 -- Create public database link on Target database

CREATE public DATABASE link clonemypdb CONNECT TO c##borg IDENTIFIED BY oracle USING 'CDB1';

 

6 -- Create Pluggable database like below from target database.

CREATE PLUGGABLE DATABASE PDB1 FROM PDB1@clonemypdb file_name_convert=('CDB1','CDB2');

 

7 -- Open Pluggable database in upgrade mode.

ALTER PLUGGABLE DATABASE PDB1 OPEN UPGRADE;

 

8 – PDB Upgrade.

Then I need to open PDB1 in CDB2 in UPGRADE mode because its dictionary is still an Oracle 12.2.0.1 dictionary whereas it operates now within a 19c database. We need to upgrade it.

 

9 -- Upgrade PDB1 like below

$ dbupgrade -c "PDB1" -l /home/oracle/logs

$ORACLE_HOME/rdbms/admin/catctl.pl -d \

$ORACLE_HOME/rdbms/admin -c 'FIDONEW' -l $ORACLE_BASE catupgrd.sql

10 -- Once upgrade is completed OPEN PDB1 and run utlrp

 

SQL> alter pluggable database PDB1 open;

SQL> alter pluggable database PDB1 save state;

 

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -c 'PDB1' -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql

 

11 -- $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -c 'PDB1' -l /home/oracle/logs -b utltz_upg_check -d $ORACLE_HOME/rdbms/admin  utltz_upg_check.sql

 

Automatically creating directories for the clone PDB's database files if they don't already exist

 

SAVE STATE:

 

SAVE STATE: This command ensures that the current state of the PDB (whether it’s open or closed) is saved. If the container database (CDB) is restarted, the saved state of the PDB will automatically be restored.

 

Practical Usage:

If PDB1 is currently open and you run ALTER PLUGGABLE DATABASE PDB1 SAVE STATE;, Oracle will remember that PDB1 was open. After a CDB restart, PDB1 will be automatically opened again without manual intervention.

Similarly, if PDB1 was closed, Oracle will remember this state and keep it closed after the CDB restarts.

 

SELECT name, value FROM v$parameter WHERE name LIKE '_%seed_cdb%';

 

 

Comments

Popular posts from this blog

ORA-28007: THE PASSWORD CANNOT NE REUSED

             - Here will see how to deal with  => ORA-28007: the password cannot be reused -  I got a request from client user, stating his account has been locked. When I check the status of the account I found the below. connect to SYS user & execute the below query of that database. SQL> select password,username,account_status,profile from dba_users where username='TEST'; PASSWORD               USERNAME   ACCOUNT_STATUS                 PROFILE ------------------             ----------------  -------------------------------           -------------------- AB2Aa8AC9971521e3     TEST       EXPIRED(GRACE)&LOCKED    NONAPP_USERS So, then I have unlocked the account and checked the same again & I found the below results. ...

ORA-39014: One or more workers have prematurely exited.ORA-00018: maximum number of sessions exceeded

ERROR: I was Performing a full database import and during the import I faced the below error. ORA-39014: One or more workers have prematurely exited. ORA-39029: worker 6 with process name "DW07" prematurely terminated ORA-31672: Worker process DW07 died unexpectedly. Job "SYSTEM"."SYS_IMPORT_FULL_04" stopped due to fatal error at 00:59:40 ORA-39014: One or more workers have prematurely exited. SOLUTION:  Run the import with fewer parallel processes, like PARALLEL=2 instead of 8. I was able to run the import successfully. NOTE 1: This errors occurs when there are less session allocation in the database. check the session,process parameters and increase them accordingly. To avoid such errors again. NOTE 2 : Note: Increasing processes parameter increases the amount of shared memory that needs to be reserved & the OS must be configured to support the larger amount of shared memory. So here we first need to increase the Memory & SG...