2026-03-12 21:01:38
This commit is contained in:
40
PDB_clone/clone_PDB_from_non-CDB_01.txt
Normal file
40
PDB_clone/clone_PDB_from_non-CDB_01.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user