Difference between revisions of "Create a refreshable PDB clone and switchover"
From Robs_Wiki
Qadmin wiki (talk | contribs) (Created page with "__TOC__ From Oracle Database 12.2 onward it is possible to refresh the contents of a remotely hot cloned PDB provided it is created as a refreshable PDB and has only ever been...") |
Qadmin wiki (talk | contribs) |
||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
+ | == Introduction == | ||
From Oracle Database 12.2 onward it is possible to refresh the contents of a remotely hot cloned PDB provided it is created as a refreshable PDB and has only ever been opened in read only mode. From 18c onwards it is also possible to switchover to the refreshable PDB, which basically means a role reversal between the source PDB and the refreshable PDB. | From Oracle Database 12.2 onward it is possible to refresh the contents of a remotely hot cloned PDB provided it is created as a refreshable PDB and has only ever been opened in read only mode. From 18c onwards it is also possible to switchover to the refreshable PDB, which basically means a role reversal between the source PDB and the refreshable PDB. | ||
+ | |||
+ | == Create a Refreshable PDB == | ||
+ | Step 1: In orcl: create a common user in the source database orcl with the required privileges: | ||
+ | <pre> | ||
+ | SQL> create user c##refresh identified by refresh; | ||
+ | |||
+ | SQL> grant dba, create pluggable database to c##refresh container=all; | ||
+ | </pre> | ||
+ | Step 2: create a database link in the container database which hosts the Source PDB: | ||
+ | <pre> | ||
+ | SQL> create public database link link_orcl connect to c##refresh identified by refresh using 'orcl'; | ||
+ | |||
+ | Database link created. | ||
+ | |||
+ | SQL> select * from dual@link_orcl; | ||
+ | |||
+ | D | ||
+ | - | ||
+ | X | ||
+ | </pre> | ||
+ | Step 3: create pluggable database pdb2_refreshed | ||
+ | <pre> | ||
+ | SQL> create pluggable database pdb2_ro from pdb2@link_orcl refresh mode every 5 minutes; | ||
+ | |||
+ | Pluggable database created. | ||
+ | |||
+ | SQL> select pdb_name, status from cdb_pdbs; | ||
+ | |||
+ | PDB_NAME STATUS | ||
+ | -------------------- ---------- | ||
+ | PDB$SEED NORMAL | ||
+ | ROBPDB1 NEW | ||
+ | PDB2_RO REFRESHING | ||
+ | </pre> | ||
+ | == Switchover to the refreshable PDB == |
Latest revision as of 10:54, 18 October 2020
Introduction
From Oracle Database 12.2 onward it is possible to refresh the contents of a remotely hot cloned PDB provided it is created as a refreshable PDB and has only ever been opened in read only mode. From 18c onwards it is also possible to switchover to the refreshable PDB, which basically means a role reversal between the source PDB and the refreshable PDB.
Create a Refreshable PDB
Step 1: In orcl: create a common user in the source database orcl with the required privileges:
SQL> create user c##refresh identified by refresh; SQL> grant dba, create pluggable database to c##refresh container=all;
Step 2: create a database link in the container database which hosts the Source PDB:
SQL> create public database link link_orcl connect to c##refresh identified by refresh using 'orcl'; Database link created. SQL> select * from dual@link_orcl; D - X
Step 3: create pluggable database pdb2_refreshed
SQL> create pluggable database pdb2_ro from pdb2@link_orcl refresh mode every 5 minutes; Pluggable database created. SQL> select pdb_name, status from cdb_pdbs; PDB_NAME STATUS -------------------- ---------- PDB$SEED NORMAL ROBPDB1 NEW PDB2_RO REFRESHING