一、需求,测试12c DG 新建、删除PDB是否导致DG连通性中断
有同事之前沟通过说,搭建完成12c dg之后,由于新建、删除维护PDB,从而导致DG的中断,本篇博客对使用这种场景进行模拟测试,达到学习目的。
二、测试
2.1 主库新建一个pdb
SQL> CREATE PLUGGABLE DATABASE ypdb1 ADMIN USER ypdb1 IDENTIFIED BY oracle FILE_NAME_CONVERT =('/picclife/app/oracle/oradata/orcl/pdbseed','/picclife/app/oracle/oradata/orcl/ypdb1'); SQL> select file_name from cdb_data_files where con_id=4; FILE_NAME ---------------------------------------------------------------- /picclife/app/oracle/oradata/orcl/ypdb1/system01.dbf /picclife/app/oracle/oradata/orcl/ypdb1/sysaux01.dbf /picclife/app/oracle/oradata/orcl/ypdb1/undotbs01.dbf db_file_name_convert /picclife/app/oracle/oradata/orcl/pdbseed/, /picclife/app/oracle/oradata/orcldg/pdbseeddg/, /picclife/app/oracle/oradata/orcl/c11pdb/, /picclife/app/oracle/oradata/orcldg/c11pdbdg/, /picclife/app/oracle/oradata/orcl/, /picclife/app/oracle/oradata/orcldg/ $ pwd /picclife/app/oracle/oradata/orcldg/ypdb1 SYS@c12>select file_name from cdb_data_files where con_id=4; FILE_NAME ------------------------------------------------------------------------------------- /picclife/app/oracle/oradata/orcldg/ypdb1/system01.dbf /picclife/app/oracle/oradata/orcldg/ypdb1/sysaux01.dbf /picclife/app/oracle/oradata/orcldg/ypdb1/undotbs01.dbf
测试确认无异常,DG同步OK !
也就是说DG 配置好完善的convert参数的情况下,会根据主库的路径自动进行转换。
例如本例中,将主库的orcl =>dg 转换为orcldg
然而PDB的名称ypdb1在搭建dg时没有,因此没有配置这个路径的转换? 那么Oracle是如何做的,没转换就默认dg也使用这个目录!
并且新建pdb时,oracle自动在主库新建了这个文件目录,dg也同样如此!
2.2 测试pdb删除
primary drop pdb ok select con_id,pdb_name,status from cdb_pdbs; alter pluggable database YPDB1 close; drop pluggable database YPDB1 including datafiles; standby MRP0: Background Media Recovery terminated with error 65112 2021-04-20T09:24:00.069282+08:00 Errors in file /picclife/app/oracle/diag/rdbms/orcldg/c12/trace/c12_mrp0_58401.trc: ORA-65112: 未在备用数据库的所有实例上关闭可插入数据库 YPDB1 Managed Standby Recovery not using Real Time Apply Recovery interrupted! Standby recovery stopped due to failure in applying recovery marker (opcode 17.35). Datafiles are recovered to a consistent state at change 1895988 but controlfile is ahead at change 1895993. Database remains open for continuous queries. Please continue recovery. 2021-04-20T09:24:00.127559+08:00 Errors in file /picclife/app/oracle/diag/rdbms/orcldg/c12/trace/c12_mrp0_58401.trc: ORA-65112: 未在备用数据库的所有实例上关闭可插入数据库 YPDB1 2021-04-20T09:24:00.127647+08:00 MRP0: Background Media Recovery process shutdown (c12) SYS@c12> alter pluggable database YPDB1 close; SYS@c12>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 C11PDB READ ONLY NO 4 YPDB1 MOUNTED recover managed standby database using current logfile disconnect;
确认删除正常!
那么对于PDB 的12c dg convert 参数有什么需要注意的事项?
与11g一样,只要是主库与备库路径不修改,可以不配置dg convert参数;
只要涉及路径不一致的,都进行转换!
如果由于参数配置不正确,导致dg路径不一致,与11g处理类似,重新修改调整dg convert参数,完成路径转换的目的!
另外一个需要注意的是! 主库删除pdb,DG环境 PDB可能是read only状态,MRP进程应用drop pdb 报错,MRP进程abend,造成dg同步中断!
再次重新测试一遍PDB,新建、删除,此时dg 默认新建的pdb not open,因此主库再次删除时,dg 未报错!
发现另外一个可能会遇到的问题,主库删除pdb后,再次使用相同pdb名称新建pdb, dg库可能show pdbs看不到新建的pdb,并且切换容器也看不到要重启!!!
小伙伴们是不是惊呆了???重启大法宝