standby_pdb_source_file_dblink参数设置

举报
snowofsummer 发表于 2021/05/20 14:14:11 2021/05/20
【摘要】 standby_pdb_source_file_dblink

当将PDB创建为远程克隆时,用户负责将数据文件复制到备用数据库上的Oracle Managed Files(OMF)位置。

为了解决该不足,该STANDBY_PDB_SOURCE_FILE_DBLINK参数指定数据库链接的名称,该数据库链接将用于尝试从数据库链接指向的源PDB复制数据文件。仅当数据库链接指向源PDB并且源PDB以只读模式打开时,才完成文件复制。否则,用户仍然负责将数据文件复制到备用数据库上的OMF位置。

在备用数据库上不存在源PDB的文件的情况下,也可以使用此参数尝试复制文件。例如,源PDB可能已创建为standbys = NONE。在这种情况下,STANDBY_PDB_SOURCE_FILE_DBLINK如果设置了到主数据库的数据库链接,则该参数可使备用数据库从主数据库复制文件。

参考手册:

Using standby_pdb_source_file_dblink and standby_pdb_source_file_directory to Maintain Standby Databases when Performing PDB Remote Clones or Plugins (Doc ID 2274735.1)

//需要在源数据库read only.

//主备数据库db link 测试全部成功。

//备需要设置standby_pdb_source_file_dblink。

#该设置之后,备可以成功复制pdb。

本次测试版本19.11

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

备数据库:

SQL> show parameter STANDBY_PDB_SOURCE_FILE_DBLINK;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_pdb_source_file_dblink       string


主执行克隆pdb

SQL> alter session set pdb_file_name_convert='/u01/app/oracle/oradata/ORCL/pdb01/','/data2/CDB01/pdb02/';

Session altered.

SQL> create pluggable database PDB002 from PDB01@dblink_clone STANDBYS=ALL;

Pluggable database created.

 log info:

2021-05-20T22:11:03.723649+08:00
create pluggable database PDB002 from PDB01@dblink_clone STANDBYS=ALL
2021-05-20T22:11:03.875778+08:00
Opatch validation is skipped for PDB PDB002 (con_id=4)
2021-05-20T22:11:11.770196+08:00
PDB002(4):Endian type of dictionary set to little
****************************************************************
Pluggable Database PDB002 with pdb id - 4 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
****************************************************************
PDB002(4):Pluggable database PDB002 pseudo opening
PDB002(4):SUPLOG: Initialize PDB SUPLOG SGA, old value 0x0, new value 0x18
PDB002(4):Autotune of undo retention is turned on.
PDB002(4):Undo initialization recovery: Parallel FPTR complete: start:23280831 end:23280832 diff:1 ms (0.0 seconds)
PDB002(4):Undo initialization recovery: err:0 start: 23280831 end: 23280833 diff: 2 ms (0.0 seconds)
PDB002(4):[31957] Successfully onlined Undo Tablespace 2.
PDB002(4):Undo initialization online undo segments: err:0 start: 23280833 end: 23280857 diff: 24 ms (0.0 seconds)
PDB002(4):Undo initialization finished serial:0 start:23280831 end:23280858 diff:27 ms (0.0 seconds)
PDB002(4):Database Characterset for PDB002 is AL32UTF8
PDB002(4):Pluggable database PDB002 pseudo closing
PDB002(4):JIT: pid 31957 requesting stop
PDB002(4):Closing sequence subsystem (23280919311).
PDB002(4):Buffer Cache flush started: 4
2021-05-20T22:11:12.815732+08:00
PDB002(4):Buffer Cache flush finished: 4
Completed: create pluggable database PDB002 from PDB01@dblink_clone STANDBYS=ALL

备日志信息:----日志应用进程中断,同步失败。

2021-05-20T22:12:51.169432+08:00
 rfs (PID:73149): Archived Log entry 17 added for B-1073060659.T-1.S-38 ID 0x5ff78af1 LAD:2
2021-05-20T22:12:51.313475+08:00
 rfs (PID:92804): krsr_rfs_atc: Identified database type as 'PHYSICAL STANDBY': Client is ASYNC (PID:81491)
 rfs (PID:92804): Primary database is in MAXIMUM PERFORMANCE mode
 rfs (PID:92804): No SRLs created
2021-05-20T22:12:51.318732+08:00
 rfs (PID:92804): Opened log for T-1.S-39 dbid 1610045937 branch 1073060659
2021-05-20T22:12:51.990848+08:00
PR00 (PID:75455): Media Recovery Log /u01/app/19.3/dbs/arch1_38_1073060659.dbf
Resize operation completed for file# 3, old size 675840K, new size 686080K
Recovery created pluggable database PDB002
PR00 (PID:75455): MRP0: Background Media Recovery terminated with error 1274
2021-05-20T22:12:52.376520+08:00
Errors in file /u01/app/oracle/diag/rdbms/sbcdb01/sbcdb01/trace/sbcdb01_pr00_75455.trc:
ORA-01274: cannot add data file that was originally created as '/data2/CDB01/pdb02/system01.dbf'
ORA-01565: error in identifying file '/data2/CDB01/pdb02/system01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
Recovery interrupted!

IM on ADG: Start of Empty Journal

IM on ADG: End of Empty Journal
Recovered data files to a consistent state at change 2982755
Stopping change tracking
2021-05-20T22:12:52.699651+08:00
Errors in file /u01/app/oracle/diag/rdbms/sbcdb01/sbcdb01/trace/sbcdb01_pr00_75455.trc:
ORA-01274: cannot add data file that was originally created as '/data2/CDB01/pdb02/system01.dbf'
ORA-01565: error in identifying file '/data2/CDB01/pdb02/system01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
2021-05-20T22:12:52.824646+08:00
Background Media Recovery process shutdown (sbcdb01)

设置standby_pdb_source_file_dblink并重启应用日志

alter system set standby_pdb_source_file_dblink='pdb01';

alter database recover managed standby database using current logfile disconnect;

备pdb002成功创建:---日志成功应用

2021-05-20T22:16:13.893493+08:00
ALTER SYSTEM SET standby_pdb_source_file_dblink='pdb01' SCOPE=BOTH;
2021-05-20T22:16:14.418721+08:00
Warning: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE has been deprecated.
alter database recover managed standby database using current logfile disconnect
WARNING: There are no standby redo logs.
Standby redo logs should be configured for real time apply. Real time apply will be ignored.
2021-05-20T22:16:14.419741+08:00
Attempt to start background Managed Standby Recovery process (sbcdb01)
Starting background process MRP0
2021-05-20T22:16:14.437104+08:00
MRP0 started with pid=66, OS id=94385
2021-05-20T22:16:14.438597+08:00
Background Managed Standby Recovery process started (sbcdb01)
2021-05-20T22:16:19.460398+08:00
 Started logmerger process
2021-05-20T22:16:19.470109+08:00

IM on ADG: Start of Empty Journal

IM on ADG: End of Empty Journal
PR00 (PID:94424): Managed Standby Recovery not using Real Time Apply
max_pdb is 5
2021-05-20T22:16:19.598154+08:00
Parallel Media Recovery started with 8 slaves
2021-05-20T22:16:19.617231+08:00
Stopping change tracking
2021-05-20T22:16:19.669265+08:00
PR00 (PID:94424): Media Recovery Log /u01/app/19.3/dbs/arch1_38_1073060659.dbf
Recovery attempting to copy datafiles for pdb-PDB002 from           source pdb-PDB01 at dblink-pdb01
2021-05-20T22:16:20.443376+08:00
Completed: alter database recover managed standby database using current logfile disconnect
2021-05-20T22:16:22.416843+08:00
Recovery copied files for tablespace SYSTEM
Recovery successfully copied file /data2/CDB01/pdb02/system01.dbf from /u01/app/oracle/oradata/ORCL/pdb01/system01.dbf
PDB002(4):WARNING: File being created with same name as in
PDB002(4):primary. Existing file may be overwritten
PDB002(4):Recovery created file /data2/CDB01/pdb02/system01.dbf
PDB002(4):Successfully added datafile 28 to media recovery
PDB002(4):Datafile #28: '/data2/CDB01/pdb02/system01.dbf'
2021-05-20T22:16:26.100387+08:00
Recovery copied files for tablespace SYSAUX
Recovery successfully copied file /data2/CDB01/pdb02/sysaux01.dbf from /u01/app/oracle/oradata/ORCL/pdb01/sysaux01.dbf
PDB002(4):WARNING: File being created with same name as in
PDB002(4):primary. Existing file may be overwritten
PDB002(4):Recovery created file /data2/CDB01/pdb02/sysaux01.dbf
PDB002(4):Successfully added datafile 29 to media recovery
PDB002(4):Datafile #29: '/data2/CDB01/pdb02/sysaux01.dbf'
Recovery copied files for tablespace UNDOTBS1
Recovery successfully copied file /data2/CDB01/pdb02/undotbs01.dbf from /u01/app/oracle/oradata/ORCL/pdb01/undotbs01.dbf
PDB002(4):WARNING: File being created with same name as in
PDB002(4):primary. Existing file may be overwritten
PDB002(4):Recovery created file /data2/CDB01/pdb02/undotbs01.dbf
PDB002(4):Successfully added datafile 30 to media recovery
PDB002(4):Datafile #30: '/data2/CDB01/pdb02/undotbs01.dbf'
Recovery copied files for tablespace USERS
Recovery successfully copied file /data2/CDB01/pdb02/users01.dbf from /u01/app/oracle/oradata/ORCL/pdb01/users01.dbf
PDB002(4):WARNING: File being created with same name as in
PDB002(4):primary. Existing file may be overwritten
PDB002(4):Recovery created file /data2/CDB01/pdb02/users01.dbf
PDB002(4):Successfully added datafile 31 to media recovery
PDB002(4):Datafile #31: '/data2/CDB01/pdb02/users01.dbf'
2021-05-20T22:16:27.139043+08:00
PR00 (PID:94424): Media Recovery Waiting for T-1.S-39 (in transit)

备 open  pdb002:

SQL> alter pluggable database pdb002 open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB                            READ ONLY  NO
         4 PDB002                         READ ONLY  NO


 






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

评论(0

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

全部回复

上滑加载中

设置昵称

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

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

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