克隆创建PDB--(3)远程克隆NON-CDB创建PDB


orcl是NON-CDB

[oracle@12cr2 dbs]$ export ORACLE_SID=orcl
[oracle@12cr2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 4 18:08:15 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size                  8621232 bytes
Variable Size            1040188240 bytes
Database Buffers          553648128 bytes
Redo Buffers                8155136 bytes
Database mounted.
Database opened.
SQL> show pdbs;
SQL> select name,cdb,con_id from v$database;
NAME      CDB     CON_ID
--------- --- ----------
ORCL      NO           0

1. 配置目标端的监听

[oracle@12cr2 admin]$ vi tnsnames.ora
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.81)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

[oracle@12cr2 admin]$ tnsping orcl
TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 04-JUN-2017 18:12:24
Copyright (c) 1997, 2016, Oracle.  All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.81)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
OK (30 msec)

[oracle@12cr2 admin]$ sqlplus system/Highgo123@orcl
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 4 18:14:07 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>

2. 目标端创建DBLINK

[oracle@12cr2 admin]$ export ORACLE_SID=newcdb
[oracle@12cr2 admin]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 4 18:16:27 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> create public database link orcl_link connect to system identified by Highgo123 using 'orcl';
Database link created.

SQL> select name,cdb,con_id from v$database@orcl_link;
NAME      CDB     CON_ID
--------- --- ----------
ORCL      NO           0

3. 远程克隆NON-CDB

SQL> CREATE PLUGGABLE DATABASE noncdb_new FROM orcl@orcl_link
  2  file_name_convert=('/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/newcdb/noncdb_new');
Pluggable database created.

SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TESTPDB_NEWCDB                 MOUNTED
         4 NONCDB_NEW                     MOUNTED

SQL> alter session set container=NONCDB_NEW;
Session altered.

SQL> @?/rdbms/admin/noncdb_to_pdb.sql

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值