Files
notes/PDB_clone/clone_PDB_from_non-CDB_01.txt

41 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2026-03-12 22:01:38 +01:00
# clone non-CDB to PDB using database link
##########################################
# Note: source is ARCHIVELOG mode and READ-WRITE state
# on source (non-CDB) database, create the user to use for the database link
create user CLONE_USER identified by "m007jgert221PnH@A";
grant create session, create pluggable database to CLONE_USER;
# on target (CDB) database, create the database link
create database link CLONE_NON_CDB
connect to CLONE_USER identified by "m007jgert221PnH@A"
using '//togoria:1521/ANDOPRD';
select * from dual@CLONE_NON_CDB;
# drop target database if exists
alter pluggable database WOMBAT close immediate instances=ALL;
drop pluggable database WOMBAT including datafiles;
# clone PDB from database link
create pluggable database WOMBAT from NON$CDB@CLONE_NON_CDB parallel 4;
# the PDB should be on MOUNT state
show pdbs
# if the version of TARGET DB > version of SOURCE DB, the PDB should be upgrade
dbupgrade -l /home/oracle/tmp -c "WOMBAT"
# convert to PDB before openning
alter session set container=WOMBAT;
@$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
# after convversion, open the PDB and save state
alter pluggable database WOMBAT open instances=ALL;
alter pluggable database WOMBAT save state;