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. ...

CHANGING DBID FOR ORACLE DATABASE 11G

C:\Users\computer>sqlplus SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 10 21:03:33 2013 Copyright (c) 1982, 2008, Oracle.  All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select dbid from v$database;       DBID ---------- 2188161033 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options C:\Users\computer>nid DBNEWID: Release 11.1.0.7.0 - Production on Thu Sep 10 21:04:44 2013 Copyright (c) 1982, 2007, Oracle.  All rights reserved. Keyword     Description                    (Default) ---------------------------------------------------- TARGET ...