19c dataguard 环境插入新的pdb

举报
snowofsummer 发表于 2021/05/27 10:04:06 2021/05/27
【摘要】 备机恢复日志:2021-05-27T18:06:44.306643+08:00 rfs (PID:3451): Opened log for T-1.S-94 dbid 1610045937 branch 10730606592021-05-27T18:06:44.444853+08:00PR00 (PID:3265): Media Recovery Log /u01/app/19.3/db...

备机恢复日志:

2021-05-27T18:06:44.306643+08:00
 rfs (PID:3451): Opened log for T-1.S-94 dbid 1610045937 branch 1073060659
2021-05-27T18:06:44.444853+08:00
PR00 (PID:3265): Media Recovery Log /u01/app/19.3/dbs/arch1_93_1073060659.dbf
Recovery created pluggable database PDB001
Recovery attempting to copy datafiles for pdb-PDB001 from           source dir-/data/bak
Recovery copied files for tablespace SYSTEM
Recovery successfully copied file /data/SBCDB01/86B637B62FDF7A65E053F706E80A27CA/datafile/o1_mf_system_jbyvrpk5_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-SYSTEM_FNO-29_0jvvtr6v
PDB001(7):Successfully added datafile 168 to media recovery
PDB001(7):Datafile #168: '/data/SBCDB01/86B637B62FDF7A65E053F706E80A27CA/datafile/o1_mf_system_jbyvrpk5_.dbf'
2021-05-27T18:06:46.852697+08:00
Recovery copied files for tablespace SYSAUX
Recovery successfully copied file /data/SBCDB01/C34DE8D06B978160E053E603A8C0C096/datafile/o1_mf_sysaux_jbyvrpk7_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-SYSAUX_FNO-30_0ivvtr6s
PDB001(7):Successfully added datafile 169 to media recovery
PDB001(7):Datafile #169: '/data/SBCDB01/C34DE8D06B978160E053E603A8C0C096/datafile/o1_mf_sysaux_jbyvrpk7_.dbf'
2021-05-27T18:06:48.446727+08:00
Recovery copied files for tablespace UNDOTBS1
Recovery successfully copied file /data/SBCDB01/C34DE8D06B978160E053E603A8C0C096/datafile/o1_mf_undotbs1_jbyvrpk8_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-UNDOTBS1_FNO-31_0kvvtr72
PDB001(7):Successfully added datafile 170 to media recovery
PDB001(7):Datafile #170: '/data/SBCDB01/C34DE8D06B978160E053E603A8C0C096/datafile/o1_mf_undotbs1_jbyvrpk8_.dbf'


通过备机日志可以发现,备数据库是通过standby_pdb_source_file_directory参数寻找到要恢复的文件,然后使用rman进行恢复操作。

1,主备数据需要设置OMF管理方式。

2,备机设置standby_pdb_source_file_directory指定rman备份文件。

源:
alter pluggable database pdb02 unplug into '/data/bak/pdb02.xml';
backup as copy pluggable database pdb02 format '/data/bak/%U';
#把备份文件拷贝到备。(/data/bak)
#源数据文件拷贝到主。(xml描述的位置)

备:
alter system set standby_pdb_source_file_directory='/data/bak';


主备共同设置:OMF
show parameter db_create_file_dest;

SQL> show parameter create
db_create_file_dest                  string      /data


主数据库导入pdb:(拷贝xml数据文件到OMF路径)

create pluggable database pdb001 as clone using '/data/bak/pdb02.xml' copy;


主命令和日志:

SQL> c/05/02/
  1* create pluggable database pdb100 as clone using '/data/bak/pdb02.xml' copy
SQL> /

Pluggable database created.

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.


2021-05-27T20:36:36.660301+08:00
create pluggable database pdb100 as clone using '/data/bak/pdb02.xml' copy
2021-05-27T20:36:47.767113+08:00
PDB100(3):Endian type of dictionary set to little
****************************************************************
Pluggable Database PDB100 with pdb id - 3 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-0x0000000000000118
****************************************************************
PDB100(3):Pluggable database PDB100 pseudo opening
PDB100(3):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
PDB100(3):Autotune of undo retention is turned on.
PDB100(3):Undo initialization recovery: Parallel FPTR complete: start:13727499 end:13727500 diff:1 ms (0.0 seconds)
PDB100(3):Undo initialization recovery: err:0 start: 13727499 end: 13727500 diff: 1 ms (0.0 seconds)
PDB100(3):[50926] Successfully onlined Undo Tablespace 2.
PDB100(3):Undo initialization online undo segments: err:0 start: 13727500 end: 13727527 diff: 27 ms (0.0 seconds)
PDB100(3):Undo initialization finished serial:0 start:13727499 end:13727529 diff:30 ms (0.0 seconds)
PDB100(3):Database Characterset for PDB100 is AL32UTF8
PDB100(3):Pluggable database PDB100 pseudo closing
PDB100(3):JIT: pid 50926 requesting stop
PDB100(3):Closing sequence subsystem (13727605094).
PDB100(3):Buffer Cache flush started: 3
PDB100(3):Buffer Cache flush finished: 3
Completed: create pluggable database pdb100 as clone using '/data/bak/pdb02.xml' copy
2021-05-27T20:36:52.102144+08:00
Thread 1 advanced to log sequence 104 (LGWR switch),  current SCN: 4340911
  Current log# 2 seq# 104 mem# 0: /data2/CDB01/redo02.log
2021-05-27T20:36:52.135238+08:00
ARC1 (PID:2753): Archived Log entry 170 added for T-1.S-103 ID 0x5ff78af1 LAD:1

备日志:

2021-05-27T20:36:53.110119+08:00
 rfs (PID:3451): Archived Log entry 40 added for B-1073060659.T-1.S-103 ID 0x5ff78af1 LAD:2
 rfs (PID:3451): No SRLs created
2021-05-27T20:36:53.116008+08:00
 rfs (PID:3451): Opened log for T-1.S-104 dbid 1610045937 branch 1073060659
2021-05-27T20:36:53.902363+08:00
PR00 (PID:3265): Media Recovery Log /u01/app/19.3/dbs/arch1_103_1073060659.dbf
Recovery created pluggable database PDB100
Recovery attempting to copy datafiles for pdb-PDB100 from           source dir-/data/bak
Recovery copied files for tablespace SYSTEM
Recovery successfully copied file /data/SBCDB01/86B637B62FDF7A65E053F706E80A27CA/datafile/o1_mf_system_jbz4lno4_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-SYSTEM_FNO-29_0jvvtr6v
PDB100(3):Successfully added datafile 171 to media recovery
PDB100(3):Datafile #171: '/data/SBCDB01/86B637B62FDF7A65E053F706E80A27CA/datafile/o1_mf_system_jbz4lno4_.dbf'
2021-05-27T20:36:55.885274+08:00
Recovery copied files for tablespace SYSAUX
Recovery successfully copied file /data/SBCDB01/C35002945707C6EEE053E603A8C061DD/datafile/o1_mf_sysaux_jbz4lno6_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-SYSAUX_FNO-30_0ivvtr6s
PDB100(3):Successfully added datafile 172 to media recovery
PDB100(3):Datafile #172: '/data/SBCDB01/C35002945707C6EEE053E603A8C061DD/datafile/o1_mf_sysaux_jbz4lno6_.dbf'
Recovery copied files for tablespace UNDOTBS1
Recovery successfully copied file /data/SBCDB01/C35002945707C6EEE053E603A8C061DD/datafile/o1_mf_undotbs1_jbz4lno7_.dbf from /data/bak/data_D-ORCL_I-1600853364_TS-UNDOTBS1_FNO-31_0kvvtr72
2021-05-27T20:36:57.195360+08:00
PDB100(3):Successfully added datafile 173 to media recovery
PDB100(3):Datafile #173: '/data/SBCDB01/C35002945707C6EEE053E603A8C061DD/datafile/o1_mf_undotbs1_jbz4lno7_.dbf'
PR00 (PID:3265): Media Recovery Waiting for T-1.S-104 (in transit)

主open之后,切换日志,备才可以open:

备:打开可能报错,需要主先open.

SQL>  alter pluggable database pdb100 open;
 alter pluggable database pdb100 open
*
ERROR at line 1:
ORA-65085: cannot open pluggable database in read-only mode


SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB100                         MOUNTED
         4 PDB002                         READ ONLY  NO
         6 PDB003                         READ ONLY  NO
         7 PDB001                         READ ONLY  NO
SQL>  alter pluggable database pdb100 open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB100                         READ ONLY  NO
         4 PDB002                         READ ONLY  NO
         6 PDB003                         READ ONLY  NO
         7 PDB001                         READ ONLY  NO
SQL>

主:

SQL>
SQL> alter pluggable database pdb100 open;

Pluggable database altered.

SQL> alter system switch logfile;

System altered.
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。