Oracle 建立PDB-本地克隆

chenoracle發表於2020-03-30

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章