文档课题:备库归档日志文件的删除测试.
数据库:oracle 11.2.0.4
架构:rac(2节点)+dg(orcldg与sh_orcl)
场景描述:在该架构中,orcldg备库作为sh_orcl备库归档日志文件的来源,现测试以下两点:
          a、归档日志文件从orcldg备库传输到sh_orcl备库后先不应用,此时orcldg端是否能删除未应用的归档日志?
		  b、sh_orcl无法接收orcldg端的归档日志,此时在orcldg备库端是否能删除未传输的归档日志?
1、环境准备
--orcldg备库log_archive_dest_4配置
SYS@orcldg> show parameter log_archive_dest_4                                                                                                             

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_4                   string      SERVICE=sh_orcl COMPRESSION=EN
                                                 ABLE LGWR ASYNC VALID_FOR=(ONL
                                                 INE_LOGFILES,PRIMARY_ROLE) DB_
                                                 UNIQUE_NAME=sh_orcl
--修改log_archive_dest_4配置参数,将valid_for修改为ALL_LOGFILES,ALL_ROLES.												 
SYS@orcldg> alter system set log_archive_dest_4='SERVICE=sh_orcl COMPRESSION=ENABLE LGWR ASYNC VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sh_orcl';

System altered.
--将主库端log_archive_dest_3置空.
SYS@orcl1> alter system set log_archive_dest_3='' sid='*';

System altered.

说明:以上配置在于主库停止传输归档日志文件到sh_orcl备库,转为由备库orcldg传输归档日志文件到sh_orcl备库.
2、备库日志应用情况
--orcldg备库日志应用情况。
SYS@orcldg> set line 200
SYS@orcldg> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),to_char(completion_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by 1,2;

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        327 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:11 YES
         1        328 2023-06-12 16:12:44 2023-06-12 16:12:51 2023-06-12 16:13:11 YES
         1        329 2023-06-12 16:12:51 2023-06-12 16:13:15 2023-06-12 16:13:15 YES
         1        330 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:33 YES
         1        331 2023-06-12 16:13:33 2023-06-12 16:22:32 2023-06-12 16:22:32 YES
         1        332 2023-06-12 16:22:32 2023-06-12 18:22:17 2023-06-12 18:22:17 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:16:53 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:11:56 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:11:56 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:11:56 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:16:53 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:16:54 NO
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:12:00 YES
         2        167 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        168 2023-06-12 16:12:44 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        169 2023-06-12 16:12:44 2023-06-12 16:12:46 2023-06-12 16:13:12 YES
         2        170 2023-06-12 16:12:46 2023-06-12 16:12:54 2023-06-12 16:13:12 YES
         2        171 2023-06-12 16:12:54 2023-06-12 16:13:15 2023-06-12 16:13:16 YES
         2        172 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:34 YES
         2        173 2023-06-12 16:13:33 2023-06-12 16:22:58 2023-06-12 16:22:58 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:11:56 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:11:55 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:16:53 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:11:59 YES

27 rows selected.

注意:此时orcldg备库相同序列号有两个,表名之前配置已生效.
--sh_orcl备库日志应用情况.
SYS@sh_orcl> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),to_char(completion_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by 1,2;

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        327 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:29 YES
         1        328 2023-06-12 16:12:44 2023-06-12 16:12:51 2023-06-12 16:13:29 YES
         1        329 2023-06-12 16:12:51 2023-06-12 16:13:15 2023-06-12 16:13:29 YES
         1        330 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:32 YES
         1        331 2023-06-12 16:13:33 2023-06-12 16:22:32 2023-06-12 16:22:30 YES
         1        332 2023-06-12 16:22:32 2023-06-12 18:22:17 2023-06-12 18:22:16 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:16:53 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:16:52 YES
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:16:52 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:16:53 NO
         2        167 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:29 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        168 2023-06-12 16:12:44 2023-06-12 16:12:44 2023-06-12 16:13:29 YES
         2        169 2023-06-12 16:12:44 2023-06-12 16:12:46 2023-06-12 16:13:29 YES
         2        170 2023-06-12 16:12:46 2023-06-12 16:12:54 2023-06-12 16:13:29 YES
         2        171 2023-06-12 16:12:54 2023-06-12 16:13:15 2023-06-12 16:13:29 YES
         2        172 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:32 YES
         2        173 2023-06-12 16:13:33 2023-06-12 16:22:58 2023-06-12 16:22:56 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:16:52 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:16:52 YES

20 rows selected.

3、开始测试
3.1、接收日志后不应用
3.1.1、产生新归档
--sh_orcl备库停止实时应用,但依然正常接收归档日志文件.
SYS@sh_orcl> alter database recover managed standby database cancel;

Database altered.

--主库生成新新归档.
LEO@orcl1> create table test01 as select * from dba_objects;

Table created.

LEO@orcl1> conn / as sysdba
Connected.
SYS@orcl1> alter system archive log current;

System altered.

3.1.2、备库日志应用情况
--orcldg应用情况
SYS@orcldg> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),to_char(completion_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by 1,2;

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        327 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:11 YES
         1        328 2023-06-12 16:12:44 2023-06-12 16:12:51 2023-06-12 16:13:11 YES
         1        329 2023-06-12 16:12:51 2023-06-12 16:13:15 2023-06-12 16:13:15 YES
         1        330 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:33 YES
         1        331 2023-06-12 16:13:33 2023-06-12 16:22:32 2023-06-12 16:22:32 YES
         1        332 2023-06-12 16:22:32 2023-06-12 18:22:17 2023-06-12 18:22:17 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:16:53 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:11:56 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:11:56 YES
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:11:56 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:16:53 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:16:54 NO
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:12:00 YES
         1        337 2023-06-12 22:11:58 2023-06-12 22:36:51 2023-06-12 22:36:52 YES
         1        337 2023-06-12 22:11:58 2023-06-12 22:36:51 2023-06-12 22:36:52 NO
         2        167 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        168 2023-06-12 16:12:44 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        169 2023-06-12 16:12:44 2023-06-12 16:12:46 2023-06-12 16:13:12 YES
         2        170 2023-06-12 16:12:46 2023-06-12 16:12:54 2023-06-12 16:13:12 YES
         2        171 2023-06-12 16:12:54 2023-06-12 16:13:15 2023-06-12 16:13:16 YES
         2        172 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:34 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        173 2023-06-12 16:13:33 2023-06-12 16:22:58 2023-06-12 16:22:58 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:11:56 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:11:55 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:16:53 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:11:59 YES
         2        177 2023-06-12 22:11:58 2023-06-12 22:36:53 2023-06-12 22:36:53 NO
         2        177 2023-06-12 22:11:58 2023-06-12 22:36:53 2023-06-12 22:36:53 IN-MEMORY

31 rows selected.
--sh_orcl应用情况
SYS@sh_orcl> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),to_char(completion_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by 1,2;

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        327 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:29 YES
         1        328 2023-06-12 16:12:44 2023-06-12 16:12:51 2023-06-12 16:13:29 YES
         1        329 2023-06-12 16:12:51 2023-06-12 16:13:15 2023-06-12 16:13:29 YES
         1        330 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:32 YES
         1        331 2023-06-12 16:13:33 2023-06-12 16:22:32 2023-06-12 16:22:30 YES
         1        332 2023-06-12 16:22:32 2023-06-12 18:22:17 2023-06-12 18:22:16 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:16:53 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:16:52 YES
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:16:52 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:16:53 NO
         1        337 2023-06-12 22:11:58 2023-06-12 22:36:51 2023-06-12 22:36:51 NO

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        167 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:29 YES
         2        168 2023-06-12 16:12:44 2023-06-12 16:12:44 2023-06-12 16:13:29 YES
         2        169 2023-06-12 16:12:44 2023-06-12 16:12:46 2023-06-12 16:13:29 YES
         2        170 2023-06-12 16:12:46 2023-06-12 16:12:54 2023-06-12 16:13:29 YES
         2        171 2023-06-12 16:12:54 2023-06-12 16:13:15 2023-06-12 16:13:29 YES
         2        172 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:32 YES
         2        173 2023-06-12 16:13:33 2023-06-12 16:22:58 2023-06-12 16:22:56 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:16:52 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:16:52 YES
         2        177 2023-06-12 22:11:58 2023-06-12 22:36:53 2023-06-12 22:36:52 NO

22 rows selected.
--系统层面归档日志文件情况.
[oracle@leo-shhisdbdg 2023_06_12]$ ll
total 69164
-rw-r----- 1 oracle oinstall     1024 Jun 12 16:13 o1_mf_1_327_l8fnx991_.arc
-rw-r----- 1 oracle oinstall    75264 Jun 12 16:13 o1_mf_1_328_l8fnx994_.arc
-rw-r----- 1 oracle oinstall   531456 Jun 12 16:13 o1_mf_1_329_l8fnx997_.arc
-rw-r----- 1 oracle oinstall    13824 Jun 12 16:13 o1_mf_1_330_l8fnxdf5_.arc
-rw-r----- 1 oracle oinstall   279040 Jun 12 16:22 o1_mf_1_331_l8fog6wf_.arc
-rw-r----- 1 oracle oinstall 13850112 Jun 12 18:22 o1_mf_1_332_l8fwgr15_.arc
-rw-r----- 1 oracle oinstall  7461888 Jun 12 22:16 o1_mf_1_333_l8gb6nxv_.arc
-rw-r----- 1 oracle oinstall     1024 Jun 12 22:16 o1_mf_1_334_l8gb6nbw_.arc
-rw-r----- 1 oracle oinstall    34816 Jun 12 22:16 o1_mf_1_335_l8gb6nc2_.arc
-rw-r----- 1 oracle oinstall 15705600 Jun 12 22:16 o1_mf_1_336_l8gb6nd4_.arc
-rw-r----- 1 oracle oinstall 14654464 Jun 12 22:36 o1_mf_1_337_l8gcd3gs_.arc
-rw-r----- 1 oracle oinstall   178176 Jun 12 16:13 o1_mf_2_166_l8fnx990_.arc
-rw-r----- 1 oracle oinstall     1024 Jun 12 16:13 o1_mf_2_167_l8fnx95n_.arc
-rw-r----- 1 oracle oinstall     1024 Jun 12 16:13 o1_mf_2_168_l8fnx95g_.arc
-rw-r----- 1 oracle oinstall     1024 Jun 12 16:13 o1_mf_2_169_l8fnx99d_.arc
-rw-r----- 1 oracle oinstall    57856 Jun 12 16:13 o1_mf_2_170_l8fnx999_.arc
-rw-r----- 1 oracle oinstall    43008 Jun 12 16:13 o1_mf_2_171_l8fnx9b7_.arc
-rw-r----- 1 oracle oinstall    10752 Jun 12 16:13 o1_mf_2_172_l8fnxdkk_.arc
-rw-r----- 1 oracle oinstall   291328 Jun 12 16:22 o1_mf_2_173_l8foh0ox_.arc
-rw-r----- 1 oracle oinstall 14983168 Jun 12 22:16 o1_mf_2_174_l8gb6n9o_.arc
-rw-r----- 1 oracle oinstall    48128 Jun 12 22:16 o1_mf_2_175_l8gb6n4f_.arc
-rw-r----- 1 oracle oinstall   249856 Jun 12 22:16 o1_mf_2_176_l8gb6n3p_.arc
-rw-r----- 1 oracle oinstall  2300928 Jun 12 22:36 o1_mf_2_177_l8gcd4or_.arc

说明:如上所示,o1_mf_1_336_l8gb6nc2_.arc、o1_mf_1_337_l8gcd3gs_.arc、o1_mf_2_177_l8gcd4or_.arc归档日志已传输到备库sh_orcl,但此时未应用.
3.1.3、删除测试
--在orcldg备库执行.
RMAN> delete noprompt archivelog until time 'sysdate-1/1440';

说明:可将未应用的归档日志文件o1_mf_1_336_l8gb6nc2_.arc o1_mf_1_337_l8gcd3gs_.arc删除,但却未能删除o1_mf_2_177_l8gcd4or_.arc.

RMAN> delete noprompt archivelog all;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=13 device type=DISK
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_2_177_l8gcd5td_.arc thread=2 sequence=177

说明:即使o1_mf_2_177_l8gcd4or_.arc在sh_orcl备库端显示已经应用,但orcldg端依然无法删除该归档日志.

3.2、无法接收日志
3.2.1、产生新归档
--以下测试无法传输归档日志文件的情况.
关闭sh_orcl数据库,使orcldg端的归档日志文件无法传输到备库sh_orcl.
SYS@sh_orcl> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

--主库产生新归档日志文件
SYS@orcl1> conn leo/leo;
Connected.
LEO@orcl1> insert into test01 select * from test01;

86305 rows created.

LEO@orcl1> commit;

Commit complete.

LEO@orcl1> conn / as sysdba
Connected.
SYS@orcl1> alter system archive log current;

System altered.

3.2.2、备库日志应用情况
--备库orcldg查看日志应用情况.
SYS@orcldg> select thread#,sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),to_char(completion_time,'yyyy-mm-dd hh24:mi:ss'),applied from v$archived_log where first_time>sysdate-1 order by 1,2;

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        327 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:11 YES
         1        328 2023-06-12 16:12:44 2023-06-12 16:12:51 2023-06-12 16:13:11 YES
         1        329 2023-06-12 16:12:51 2023-06-12 16:13:15 2023-06-12 16:13:15 YES
         1        330 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:33 YES
         1        331 2023-06-12 16:13:33 2023-06-12 16:22:32 2023-06-12 16:22:32 YES
         1        332 2023-06-12 16:22:32 2023-06-12 18:22:17 2023-06-12 18:22:17 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:11:56 YES
         1        333 2023-06-12 18:22:17 2023-06-12 22:11:02 2023-06-12 22:16:53 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:11:56 YES
         1        334 2023-06-12 22:11:02 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:11:56 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         1        335 2023-06-12 22:11:10 2023-06-12 22:11:16 2023-06-12 22:16:53 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:16:54 YES
         1        336 2023-06-12 22:11:16 2023-06-12 22:11:58 2023-06-12 22:12:00 YES
         1        337 2023-06-12 22:11:58 2023-06-12 22:36:51 2023-06-12 22:36:52 YES
         1        337 2023-06-12 22:11:58 2023-06-12 22:36:51 2023-06-12 22:36:52 YES
         1        338 2023-06-12 22:36:51 2023-06-12 22:55:55 2023-06-12 22:55:56 YES
         1        339 2023-06-12 22:55:55 2023-06-12 22:56:56 2023-06-12 22:56:56 IN-MEMORY
         2        167 2023-06-12 16:12:43 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        168 2023-06-12 16:12:44 2023-06-12 16:12:44 2023-06-12 16:13:12 YES
         2        169 2023-06-12 16:12:44 2023-06-12 16:12:46 2023-06-12 16:13:12 YES
         2        170 2023-06-12 16:12:46 2023-06-12 16:12:54 2023-06-12 16:13:12 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        171 2023-06-12 16:12:54 2023-06-12 16:13:15 2023-06-12 16:13:16 YES
         2        172 2023-06-12 16:13:15 2023-06-12 16:13:33 2023-06-12 16:13:34 YES
         2        173 2023-06-12 16:13:33 2023-06-12 16:22:58 2023-06-12 16:22:58 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:11:56 YES
         2        174 2023-06-12 16:22:58 2023-06-12 22:11:06 2023-06-12 22:16:53 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:11:55 YES
         2        175 2023-06-12 22:11:06 2023-06-12 22:11:10 2023-06-12 22:16:53 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:16:53 YES
         2        176 2023-06-12 22:11:10 2023-06-12 22:11:58 2023-06-12 22:11:59 YES
         2        177 2023-06-12 22:11:58 2023-06-12 22:36:53 2023-06-12 22:36:53 NO
         2        177 2023-06-12 22:11:58 2023-06-12 22:36:53 2023-06-12 22:36:53 YES

   THREAD#  SEQUENCE# TO_CHAR(FIRST_TIME, TO_CHAR(NEXT_TIME,' TO_CHAR(COMPLETION_ APPLIED
---------- ---------- ------------------- ------------------- ------------------- ---------
         2        178 2023-06-12 22:36:53 2023-06-12 22:55:55 2023-06-12 22:55:56 YES
         2        179 2023-06-12 22:55:55 2023-06-12 22:56:52 2023-06-12 22:56:53 YES

35 rows selected.

--系统层面归档日志文件情况
oracle@hisdbdg 2023_06_12]$ ll
total 13728
-rw-r----- 1 oracle oinstall 11013120 Jun 12 22:55 o1_mf_1_338_l8gdhwmq_.arc
-rw-r----- 1 oracle oinstall    55808 Jun 12 22:56 o1_mf_1_339_l8gdkrrp_.arc
-rw-r----- 1 oracle oinstall  2300928 Jun 12 22:36 o1_mf_2_177_l8gcd5td_.arc
-rw-r----- 1 oracle oinstall   648704 Jun 12 22:55 o1_mf_2_178_l8gdhwo3_.arc
-rw-r----- 1 oracle oinstall    29696 Jun 12 22:56 o1_mf_2_179_l8gdko3j_.arc

说明:节点1序列号为338、339,节点2序列号为178、179的归档日志文件为新增,其并未传输到sh_orcl备库.
3.2.3、删除测试
--备库orcldg端进行删除测试.
RMAN> delete noprompt archivelog until time 'sysdate-1/1440';

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=13 device type=DISK
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_1_338_l8gdhwmq_.arc thread=1 sequence=338
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_1_339_l8gdkrrp_.arc thread=1 sequence=339
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_2_177_l8gcd5td_.arc thread=2 sequence=177
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_2_178_l8gdhwo3_.arc thread=2 sequence=178
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/u01/app/oracle/fast_recovery_area/ORCLDG/archivelog/2023_06_12/o1_mf_2_179_l8gdko3j_.arc thread=2 sequence=179

说明:如上所示,orcldg备库端无法删除sh_orcl备库未接收的归档日志文件.