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
Post a Comment