ITPub博客

[20181010]12c clone pdb.txt

原创 Oracle 作者:lfree 时间:2018-10-11 07:48:33 0 删除 编辑

[20181010]12c clone pdb.txt

--//从来没有测试过这个功能,测试看看.

1.环境:
SCOTT@test01p> @ ver1
PORT_STRING                    VERSION        BANNER                                                                               CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0           12.2.0.1.0     Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production              0

SYS@test> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TEST01P                        READ WRITE NO

SYS@test> select FILE_NAME,FILE_ID,TABLESPACE_NAME,CON_ID from cdb_data_files;
FILE_NAME                                             FILE_ID TABLESPACE_NAME          CON_ID
-------------------------------------------------- ---------- -------------------- ----------
D:\APP\ORACLE\ORADATA\TEST\TEST01P\UNDOTBS01.DBF           10 UNDOTBS1                      3
D:\APP\ORACLE\ORADATA\TEST\TEST01P\SYSAUX01.DBF             9 SYSAUX                        3
D:\APP\ORACLE\ORADATA\TEST\TEST01P\USERS01.DBF             11 USERS                         3
D:\APP\ORACLE\ORADATA\TEST\TEST01P\SYSTEM01.DBF             8 SYSTEM                        3
D:\APP\ORACLE\ORADATA\TEST\SYSTEM01.DBF                     1 SYSTEM                        1
D:\APP\ORACLE\ORADATA\TEST\SYSAUX01.DBF                     3 SYSAUX                        1
D:\APP\ORACLE\ORADATA\TEST\UNDOTBS01.DBF                    5 UNDOTBS1                      1
D:\APP\ORACLE\ORADATA\TEST\USERS01.DBF                      7 USERS                         1
8 rows selected.

2.克隆插件数据库看看.

SYS@test>  alter pluggable database test01p close;
Pluggable database altered.

SYS@test> create pluggable database test02p from test01p FILE_NAME_CONVERT =('D:\APP\ORACLE\ORADATA\TEST\TEST01P\','D:\APP\ORACLE\ORADATA\TEST\TEST02P\') ;
create pluggable database test02p from test01p FILE_NAME_CONVERT =('D:\APP\ORACLE\ORADATA\TEST\TEST01P\','D:\APP\ORACLE\ORADATA\TEST\TEST02P\')
*
ERROR at line 1:
ORA-65036: pluggable database TEST01P not open in required mode

SYS@test> alter pluggable database test01p open read only ;
Pluggable database altered.

SYS@test> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TEST01P                        READ ONLY  NO

SYS@test> create pluggable database test02p from test01p FILE_NAME_CONVERT =('D:\APP\ORACLE\ORADATA\TEST\TEST01P\','D:\APP\ORACLE\ORADATA\TEST\TEST02P\') ;
Pluggable database created.

SYS@test> alter pluggable database test02p open read only ;
alter pluggable database test02p open read only
*
ERROR at line 1:
ORA-65085: cannot open pluggable database in read-only mode

SYS@test> alter pluggable database test02p open  ;
Pluggable database altered.

$ sqlplus scott/btbtms@127.0.0.1:1521/test02p
SQL*Plus: Release 12.2.0.1.0 Production on Wed Oct 10 21:33:59 2018
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Last Successful login time: Wed Oct 10 2018 21:00:55 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SCOTT@127.0.0.1:1521/test02p> select * from dept;

    DEPTNO DNAME                LOC
---------- -------------------- -------------
        10 ACCOUNTING           NEW YORK
        20 RESEARCH             DALLAS
        30 SALES                CHICAGO
        40 OPERATIONS           BOSTON

SYS@test> select FILE_NAME,FILE_ID,TABLESPACE_NAME,CON_ID from cdb_data_files order by file_id;
FILE_NAME                                             FILE_ID TABLESPACE_NAME          CON_ID
-------------------------------------------------- ---------- -------------------- ----------
D:\APP\ORACLE\ORADATA\TEST\SYSTEM01.DBF                     1 SYSTEM                        1
D:\APP\ORACLE\ORADATA\TEST\SYSAUX01.DBF                     3 SYSAUX                        1
D:\APP\ORACLE\ORADATA\TEST\UNDOTBS01.DBF                    5 UNDOTBS1                      1
D:\APP\ORACLE\ORADATA\TEST\USERS01.DBF                      7 USERS                         1
D:\APP\ORACLE\ORADATA\TEST\TEST02P\SYSTEM01.DBF            20 SYSTEM                        5
D:\APP\ORACLE\ORADATA\TEST\TEST02P\SYSAUX01.DBF            21 SYSAUX                        5
D:\APP\ORACLE\ORADATA\TEST\TEST02P\UNDOTBS01.DBF           22 UNDOTBS1                      5
D:\APP\ORACLE\ORADATA\TEST\TEST02P\USERS01.DBF             23 USERS                         5
8 rows selected.

SYS@test> alter pluggable database test02p close ;
Pluggable database altered.

SYS@test> alter pluggable database test02p open read only ;
Pluggable database altered.

--//经历一次open以后,就可以以open read only 打开.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2215930/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-03

  • 博文量
    2164
  • 访问量
    5932227