重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2052|回复: 1
打印 上一主题 下一主题

12c dg主备库PDB同步测试

[复制链接]
跳转到指定楼层
楼主
发表于 2017-8-28 18:37:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
实验目的:主库创建pdb,测试备库能否成功同步。

1、主库采用热克隆的方式创建orclpdb2
SQL> create pluggable database orclpdb2 from orclpdb;

Pluggable database created.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCLPDB2                       MOUNTED
         4 ORCLPDB                        READ WRITE NO
                 
SQL> alter pluggable database orclpdb2 open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCLPDB2                       READ WRITE NO
         4 ORCLPDB                        READ WRITE NO

SQL> alter system switch logfile;


2、查看备库:
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY WITH APPLY

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCLPDB2                       MOUNTED
         4 ORCLPDB                        MOUNTED

备库打开orclpdb2
SQL> alter pluggable database orclpdb2 open;
alter pluggable database orclpdb2 open
*
ERROR at line 1:
ORA-65011: Pluggable database ORCLPDB2 does not exist.


SQL>

此时alter日志报错:

2017-08-28T18:25:25.750191+08:00
Errors in file /u01/app/oracle/diag/rdbms/dg_standby/sztech/trace/sztech_mrp0_66563.trc:
ORA-01274: cannot add data file that was originally created as '+DGDATA/SZTECH/57CE1CD8388BB670E05384E5A8C0D4DD/DATAFILE/system.264.953230989'
ORA-01565: error in identifying file '/u01/app/oracle/oradata/DG_STANDBY/57ce1cd8388bb670e05384e5a8c0d4dd/datafile/system.264.953230989'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
2017-08-28T18:25:25.750353+08:00
MRP0: Background Media Recovery process shutdown (sztech)

启动备库的日志恢复进程,发现无法启动:
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL>



出现这种错误是由于在主库创建orclpdb2的时候,采用的是热克隆的方式。语句如下:

SQL> create pluggable database orclpdb2 from orclpdb;

Pluggable database created.

这种方式创建的pdb共享一个数据文件存放目录。数据文件位置如下:
SQL> select con_id,name from v$datafile;

    CON_ID NAME
---------- ------------------------------------------------------------------------------------------
         1 +DGDATA/SZTECH/DATAFILE/system.301.949663919
         1 +DGDATA/SZTECH/DATAFILE/sysaux.302.949663971
         1 +DGDATA/SZTECH/DATAFILE/undotbs1.303.949663995
         2 +DGDATA/SZTECH/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/system.310.949664113
         2 +DGDATA/SZTECH/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/sysaux.309.949664113
         1 +DGDATA/SZTECH/DATAFILE/users.304.949663997
         2 +DGDATA/SZTECH/4700A987085B3DFAE05387E5E50A8C7B/DATAFILE/undotbs1.311.949664113
         1 +DGDATA/SZTECH/DATAFILE/undotbs2.313.949664459
         4 +DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/system.318.953216303
         4 +DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/sysaux.319.953216305
         4 +DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/undotbs1.320.953216303
         4 +DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/users.256.953219839
         4 +DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/test.317.953219929
         3 +DGDATA/SZTECH/57C9813E83016BCFE05384E5A8C01DEE/DATAFILE/system.260.953227383
         3 +DGDATA/SZTECH/57C9813E83016BCFE05384E5A8C01DEE/DATAFILE/sysaux.258.953227383
         3 +DGDATA/SZTECH/57C9813E83016BCFE05384E5A8C01DEE/DATAFILE/undotbs1.263.953227383
         3 +DGDATA/SZTECH/57C9813E83016BCFE05384E5A8C01DEE/DATAFILE/users.259.953227383
         3 +DGDATA/SZTECH/57C9813E83016BCFE05384E5A8C01DEE/DATAFILE/test.257.953227383

所以备库无法同步文件且无法启用日志应用

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2017-8-29 17:41:50 | 只看该作者
如果想使用热克隆方式创建pdb且保证数据文件存放在不同位置,创建pdb的时候指定file_name_convert参数即可
例如:
SQL> create pluggable database orclpdb3 from orclpdb file_name_convert=(
  2  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/system.318.953216303','+DGDATA/SZTECH/ORCLPDB3/system01.dbf',
  3  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/sysaux.319.953216305','+DGDATA/SZTECH/ORCLPDB3/sysaux01.dbf',
  4  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/undotbs1.320.953216303','+DGDATA/SZTECH/ORCLPDB3/undotbs01.dbf',
  5  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/users.256.953219839','+DGDATA/SZTECH/ORCLPDB3/users01.dbf',
  6  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/DATAFILE/test.317.953219929','+DGDATA/SZTECH/ORCLPDB3/test01.dbf',
  7  '+DGDATA/SZTECH/57C9813E82EC6BCFE05384E5A8C01DEE/TEMPFILE/temp.321.953216325','+DGDATA/SZTECH/ORCLPDB3/temp01.dbf');

Pluggable database created.

SQL>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-28 16:18 , Processed in 0.080497 second(s), 18 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表