Oracle 12C -- clone a remote pdb

來源:互聯網
上載者:User

標籤:

Connect to the remote CDB and prepare the remote PDB for cloning.

SQL> select con_id,dbid,name,open_mode from v$pdbs;    CON_ID       DBID NAME                           OPEN_MODE---------- ---------- ------------------------------ ----------         2 1258043702 PDB$SEED                       READ ONLY         3 3749525766 PDB1                           READ ONLY         4 2192587015 P4                             MOUNTED         5  255759235 PDB_TEST                       READ WRITE

 

Create a user in the remote database for use with the database link. In this case, we will use a local user in the remote PDB.

SQL> alter session set container=p4;SQL> alter pluggable database p4 open;SQL> create user remote_clone_user identified by remote_clone_user ;SQL> grant create session,create pluggable database to remote_clone_user;

 

Open the remote PDB in read-only mode.

SQL> alter pluggable database p4 close;SQL> alter pluggable database p4 open read only;

 

Connect to the local database to initiate the clone.

SQL> select con_id,dbid,name,open_mode from v$pdbs;    CON_ID       DBID NAME                           OPEN_MODE---------- ---------- ------------------------------ ----------         2 3671494824 PDB$SEED                       READ ONLY

 

Create a database link in the local database, pointing to the remote database.

SQL> create database link clone_link connect to remote_clone_user identified by remote_clone_user using ‘p4‘;

 

Create a new PDB in the local database by cloning the remote PDB.

SQL> create pluggable database p4 from [email protected]_link create_file_dest=‘/u12/app/oracle/oradata/p4‘;

 

The PDB is opened in read-write mode to complete the process.

SQL>  select con_id,dbid,name,open_mode from v$pdbs;    CON_ID       DBID NAME                           OPEN_MODE---------- ---------- ------------------------------ ----------         2 3671494824 PDB$SEED                       READ ONLY         3 2880590083 P4                             MOUNTEDSQL> alter pluggable database p4 open;SQL> select con_id,dbid,name,open_mode from v$pdbs;    CON_ID       DBID NAME                           OPEN_MODE---------- ---------- ------------------------------ ----------         2 3671494824 PDB$SEED                       READ ONLY         3 2880590083 P4                             READ WRITESQL> 

 

Oracle 12C -- clone a remote pdb

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.