• Oracle 12C -- clone a remote pdb


    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 p4@clone_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                             MOUNTED
    
    SQL> 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 WRITE
    
    SQL> 
  • 相关阅读:
    C# 窗体间传值方法大汇总(转)
    STM32 配置PC13~PC15
    STM32的USART发送数据时如何使用TXE和TC标志
    STM32_NVIC寄存器详解
    protel99se 问题汇总(不定期更新)
    STM32串口IAP实验笔记
    Keil MDK下如何设置非零初始化变量(复位后变量值不丢失)
    STM32定时器配置(TIM1-TIM8)高级定时器+普通定时器,定时计数模式下总结
    帮助类-AD域操作
    GitHub贡献第一的公司是谁?微软开源软件列表
  • 原文地址:https://www.cnblogs.com/abclife/p/4925458.html
Copyright © 2020-2023  润新知