102 lines
3.6 KiB
Markdown
102 lines
3.6 KiB
Markdown
|
|
Clone PDB from a remote CDB using RMAN "from active database"
|
||
|
|
-------------------------------------------------------------
|
||
|
|
|
||
|
|
On target CDB, set the source CDB archivelog location:
|
||
|
|
|
||
|
|
alter system set REMOTE_RECOVERY_FILE_DEST='/fra' scope=MEMORY sid='*';
|
||
|
|
|
||
|
|
Run RMAN duplicate command:
|
||
|
|
|
||
|
|
rman target='sys/"*****"@taris/ASTYPRD' auxiliary='sys/"*****"@mandalore/ELLOPRD'
|
||
|
|
|
||
|
|
run
|
||
|
|
{
|
||
|
|
allocate auxiliary channel aux01 device type disk;
|
||
|
|
allocate auxiliary channel aux02 device type disk;
|
||
|
|
allocate auxiliary channel aux03 device type disk;
|
||
|
|
allocate auxiliary channel aux04 device type disk;
|
||
|
|
allocate auxiliary channel aux05 device type disk;
|
||
|
|
allocate auxiliary channel aux06 device type disk;
|
||
|
|
allocate auxiliary channel aux07 device type disk;
|
||
|
|
allocate auxiliary channel aux08 device type disk;
|
||
|
|
allocate auxiliary channel aux09 device type disk;
|
||
|
|
allocate auxiliary channel aux10 device type disk;
|
||
|
|
duplicate pluggable database WEDGEPRD as ANTILLESPRD
|
||
|
|
from active database using compressed backupset section size 400M;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
Clone PDB from a remote CDB through a database link
|
||
|
|
---------------------------------------------------
|
||
|
|
|
||
|
|
On source CDB create an user to be use by the database link:
|
||
|
|
|
||
|
|
create user c##adminpdb identified by adminpdb container=ALL;
|
||
|
|
grant create session, create pluggable database to c##adminpdb container=all;
|
||
|
|
|
||
|
|
|
||
|
|
On target CDB create the database link and clone the remote PDB.
|
||
|
|
|
||
|
|
create database link ASTYPRD connect to c##adminpdb identified by "adminpdb" using 'taris/ASTYPRD';
|
||
|
|
select * from dual@ASTYPRD;
|
||
|
|
|
||
|
|
create pluggable database ANTILLESPRD from WEDGEPRD@ASTYPRD parallel 10;
|
||
|
|
alter pluggable database ANTILLESPRD open;
|
||
|
|
|
||
|
|
|
||
|
|
> Note that in both method we can choose the parallelism degree.
|
||
|
|
|
||
|
|
|
||
|
|
Clone PDB from a remote CDB using a RMAN backup
|
||
|
|
-----------------------------------------------
|
||
|
|
|
||
|
|
Beacause in Oracle 21c is is still not possible to duplicate a pluggable database directly from a backup (aka *duplicate backup location*), wi will perform this operation in 2 steps:
|
||
|
|
1. duplicate from location the *root* PDB + source PDB into an auxiliary CDB
|
||
|
|
2. unplug the PDB from auxiliary CDB and plug it on target PDB
|
||
|
|
|
||
|
|
|
||
|
|
> A *set until time* clause can be specified in duplicate command.
|
||
|
|
|
||
|
|
Start AUXCDB CDB instance using a basic spfile, therefore run the duplicate command:
|
||
|
|
|
||
|
|
rman auxiliary /
|
||
|
|
|
||
|
|
run
|
||
|
|
{
|
||
|
|
allocate auxiliary channel aux01 device type disk;
|
||
|
|
allocate auxiliary channel aux02 device type disk;
|
||
|
|
allocate auxiliary channel aux03 device type disk;
|
||
|
|
allocate auxiliary channel aux04 device type disk;
|
||
|
|
allocate auxiliary channel aux05 device type disk;
|
||
|
|
allocate auxiliary channel aux06 device type disk;
|
||
|
|
allocate auxiliary channel aux07 device type disk;
|
||
|
|
allocate auxiliary channel aux08 device type disk;
|
||
|
|
allocate auxiliary channel aux09 device type disk;
|
||
|
|
allocate auxiliary channel aux10 device type disk;
|
||
|
|
set until time "TIMESTAMP'2021-11-08 15:40:00'";
|
||
|
|
duplicate database to AUXCDB
|
||
|
|
pluggable database WEDGEPRD,root
|
||
|
|
backup location '/mnt/yavin4/tmp/_oracle_/orabackup/ASTY';
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
Unplug PDB from auxiliary CDB:
|
||
|
|
|
||
|
|
alter pluggable database WEDGEPRD close immediate;
|
||
|
|
alter pluggable database WEDGEPRD open read only;
|
||
|
|
|
||
|
|
|
||
|
|
alter session set container=WEDGEPRD;
|
||
|
|
exec DBMS_PDB.DESCRIBE('/mnt/yavin4/tmp/_oracle_/tmp/WEDGE.xml');
|
||
|
|
alter pluggable database WEDGEPRD close immediate;
|
||
|
|
|
||
|
|
|
||
|
|
Plug in PDB on target CDB (with copy, move or nocopy option):
|
||
|
|
|
||
|
|
create pluggable database ANTILLESPRD using '/mnt/yavin4/tmp/_oracle_/tmp/WEDGE.xml' move;
|
||
|
|
alter pluggable database ANTILLESPRD open;
|
||
|
|
alter pluggable database ANTILLESPRD save state;
|
||
|
|
|
||
|
|
|
||
|
|
At this momment we can destroy auxiliary CDB.
|