ITPub博客

首页 > 数据库 > Oracle > Oracle 创建PDB-本地克隆

Oracle 创建PDB-本地克隆

原创 Oracle 作者:chenoracle 时间:2020-03-30 10:48:03 0 删除 编辑

Oracle 创建PDB- 本地克隆

一:本地克隆

--- 连接cjcpdb02

SQL > conn sys / oracle @ cjcpdb02 as sysdba

Connected.

--- 授权

SQL > grant connect , resource , dba to cjc ;

Grant succeeded.

--- 连接cjcpdb02创建测试数据

SQL > conn cjc / oracle @ cjcpdb02

Connected.

SQL > create table t1 as select level as id from dual connect by level <= 10 ;

Table created.

SQL > select * from t1 ;

        ID

----------

          1

          2

          3

          4

          5

          6

          7

          8

          9

        10

10 rows selected.

--- 创建目录

[oracle @ cjcos oradata]$ pwd

/ u01 / app / oracle12 / oradata

[oracle @ cjcos oradata]$ mkdir cjcpdb03

---clone pdb

SQL > conn / as sysdba

Connected.

SQL >

CREATE PLUGGABLE DATABASE cjcpdb03 FROM cjcpdb02

  FILE_NAME_CONVERT = ( '/u01/app/oracle12/oradata/cjcpdb02/' ,

                  '/u01/app/oracle12/oradata/cjcpdb03/' );

--- 对应告警日志

---alert

2020 - 03 - 30 T09 : 33 : 13.671843 + 08 : 00

CREATE PLUGGABLE DATABASE cjcpdb03 FROM cjcpdb02

 FILE_NAME_CONVERT = ( '/u01/app/oracle12/oradata/cjcpdb02/' ,

                      '/u01/app/oracle12/oradata/cjcpdb03/' )

2020 - 03 - 30 T09 : 33 : 14.246808 + 08 : 00

CJCPDB02 ( 4 ): AUDSYS.AUD$UNIFIED ( SQL_TEXT ) - CLOB populated

2020 - 03 - 30 T09 : 34 : 19.768496 + 08 : 00

CJCPDB03 ( 5 ): Endian type of dictionary set to little

2020 - 03 - 30 T09 : 34 : 21.685283 + 08 : 00

****************************************************************

Pluggable Database CJCPDB03 with pdb id - 5 is created as UNUSABLE.

If any errors are encountered before the pdb is marked as NEW ,

then the pdb must be dropped

local undo - 1 , localundoscn - 0 x00000000000000e1

****************************************************************

CJCPDB03 ( 5 ): Media Recovery Start

2020 - 03 - 30 T09 : 34 : 21.972065 + 08 : 00

CJCPDB03 ( 5 ): Serial Media Recovery started

CJCPDB03 ( 5 ): max_pdb is 5

2020 - 03 - 30 T09 : 34 : 22.336660 + 08 : 00

CJCPDB03 ( 5 ): Recovery of Online Redo Log : Thread 1 Group 1 Seq 91 Reading mem 0

CJCPDB03 ( 5 ):   Mem# 0 : / u01 / app / oracle12 / oradata / cjcdb01 / redo01.log

2020 - 03 - 30 T09 : 34 : 22.575875 + 08 : 00

CJCPDB03 ( 5 ): Incomplete Recovery applied until change 6667097 time 03 / 30 / 2020 09 : 34 : 16

2020 - 03 - 30 T09 : 34 : 22.693447 + 08 : 00

CJCPDB03 ( 5 ): Media Recovery Complete ( cjcdb01 )

CJCPDB03 ( 5 ): Autotune of undo retention is turned on.

2020 - 03 - 30 T09 : 34 : 24.377316 + 08 : 00

CJCPDB03 ( 5 ): Undo initialization recovery : err : 0 start : 1164547948 end : 1164547980 diff : 32 ms ( 0.0 seconds )

CJCPDB03 ( 5 ): [ 10627 ] Successfully onlined Undo Tablespace 2 .

CJCPDB03 ( 5 ): Undo initialization online undo segments : err : 0 start : 1164547981 end : 1164547990 diff : 9 ms ( 0.0 seconds )

CJCPDB03 ( 5 ): Undo initialization finished serial : 0 start : 1164547948 end : 1164547993 diff : 45 ms ( 0.0 seconds )

CJCPDB03 ( 5 ): Database Characterset for CJCPDB03 is AL32UTF8

CJCPDB03 ( 5 ): JIT : pid 10627 requesting stop

CJCPDB03 ( 5 ): Buffer Cache flush started : 5

CJCPDB03 ( 5 ): Buffer Cache flush finished : 5

2020 - 03 - 30 T09 : 34 : 26.281633 + 08 : 00

Completed : CREATE PLUGGABLE DATABASE cjcpdb03 FROM cjcpdb02

 FILE_NAME_CONVERT = ( '/u01/app/oracle12/oradata/cjcpdb02/' ,

                      '/u01/app/oracle12/oradata/cjcpdb03/' )

--- 查看pdb状态                       

SQL > show pdbs

    CON_ID CON_NAME                       OPEN MODE   RESTRICTED

---------- ------------------------------ ---------- ----------

          2 PDB$SEED                       READ ONLY   NO

          3 CJCPDB01                       READ WRITE NO

          4 CJCPDB02                       READ WRITE NO

          5 CJCPDB03                       MOUNTED

---open cjcpdb03

SQL > alter session set container = cjcpdb03 ;

Session altered.

SQL > startup

Pluggable Database opened.

[oracle @ cjcos admin ]$ pwd

/ u01 / app / oracle19 / product / 19.0 .0 / dbhome_1 / network / admin

[oracle @ cjcos admin ]$ vim tnsnames.ora

......

CJCPDB03 =

  ( DESCRIPTION =

    ( ADDRESS = ( PROTOCOL = TCP )( HOST = cjcos )( PORT = 1521 ))

    ( CONNECT_DATA =

      ( SERVER = DEDICATED )

      ( SERVICE_NAME = cjcpdb03 )

    )

  )

SQL > conn cjc / oracle @ cjcpdb03

Connected.

SQL > select * from t1 ;

        ID

----------

          1

          2

          3

          4

          5

          6

          7

          8

          9

        10

10 rows selected.

欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!!

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

全部评论
Oracle 11g OCP、Oracle 11g OCM、OCMU 用户组成员,微信公众号"IT小Chen"

注册时间:2014-08-05

  • 博文量
    537
  • 访问量
    982105