在备库上查询,发现日志没有被应用
SYS@test_stdby>select sequence#,applied from v$archived_log order by sequence#;
SEQUENCE# APPLIED
---------- ---------
19 YES
20 YES
21 YES
22 YES
23 YES
24 YES
25 YES
26 NO
27 NO
28 NO
29 NO
SEQUENCE# APPLIED
---------- ---------
30 NO
31 NO
32 NO
33 NO
34 NO
35 NO
36 NO
37 NO
38 NO
39 NO
40 NO
SEQUENCE# APPLIED
---------- ---------
41 NO
42 NO
43 NO
44 NO
45 NO
46 NO
28 rows selected.
SYS@test_stdby>
在主库上设置rman,并对归档日志进行备份,备份后删除归档日志,这里要设置成应用后,才删除归档
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL standby;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_test.f'; # default
RMAN>
backup archive logall delete input;
RMAN> backup archivelog all delete input;
Starting backup at 20-MAR-18
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=1 STAMP=963658959
......
archived log file name=/u01/archive_log/1_25_963738576.arc RECID=56 STAMP=971278002
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_26_963738576.arc thread=1 sequence=26
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_27_963738576.arc thread=1 sequence=27
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_28_963738576.arc thread=1 sequence=28
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_29_963738576.arc thread=1 sequence=29
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_30_963738576.arc thread=1 sequence=30
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_31_963738576.arc thread=1 sequence=31
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_32_963738576.arc thread=1 sequence=32
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_33_963738576.arc thread=1 sequence=33
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_34_963738576.arc thread=1 sequence=34
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_35_963738576.arc thread=1 sequence=35
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_36_963738576.arc thread=1 sequence=36
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_37_963738576.arc thread=1 sequence=37
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_38_963738576.arc thread=1 sequence=38
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_39_963738576.arc thread=1 sequence=39
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_40_963738576.arc thread=1 sequence=40
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_41_963738576.arc thread=1 sequence=41
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_42_963738576.arc thread=1 sequence=42
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_43_963738576.arc thread=1 sequence=43
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_44_963738576.arc thread=1 sequence=44
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_45_963738576.arc thread=1 sequence=45
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_46_963738576.arc thread=1 sequence=46
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/u01/archive_log/1_47_963738576.arc thread=1 sequence=47
Finished backup at 20-MAR-18
RMAN>
查看RMAN 状态 , 这下明白了completed with warnings是怎么回事了吧
SYS@test>select command_id, object_type,status from v$rman_status;
COMMAND_ID OBJECT_TYPE STATUS
--------------------------------- ------------- -----------------------
2018-03-20T15:34:50 ARCHIVELOG COMPLETED WITH WARNINGS
2017-12-25T11:34:42 COMPLETED
2018-03-20T15:34:50 RUNNING WITH ERRORS
更改RMAN配置 ,这里没有出错,在11.0.3的时候,可能会出错,需要设置一个隐含参数 _log_deletion_policy.
alter system set "_log_deletion_policy"=ALL scope=spfile. 重启后,在设置。就没有RMAN错误提示了。
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO shipped to all standby;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_test.f'; # default
RMAN>
再次备份,没有Warning了 ,归档日志也被删除了
backup archivelog all delete input;
RMAN> backup archivelog all delete input;
Starting backup at 20-MAR-18
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=26 RECID=60 STAMP=971278760
input archived log thread=1 sequence=27 RECID=62 STAMP=971278761
input archived log thread=1 sequence=28 RECID=64 STAMP=971278761
input archived log thread=1 sequence=29 RECID=66 STAMP=971278762
input archived log thread=1 sequence=30 RECID=67 STAMP=971278762
input archived log thread=1 sequence=31 RECID=69 STAMP=971278763
input archived log thread=1 sequence=32 RECID=72 STAMP=971278764
input archived log thread=1 sequence=33 RECID=74 STAMP=971278764
input archived log thread=1 sequence=34 RECID=76 STAMP=971278764
input archived log thread=1 sequence=35 RECID=78 STAMP=971278765
input archived log thread=1 sequence=36 RECID=80 STAMP=971278765
input archived log thread=1 sequence=37 RECID=82 STAMP=971278766
input archived log thread=1 sequence=38 RECID=84 STAMP=971278766
input archived log thread=1 sequence=39 RECID=86 STAMP=971278767
input archived log thread=1 sequence=40 RECID=89 STAMP=971278767
input archived log thread=1 sequence=41 RECID=90 STAMP=971278768
input archived log thread=1 sequence=42 RECID=92 STAMP=971278768
input archived log thread=1 sequence=43 RECID=94 STAMP=971278769
input archived log thread=1 sequence=44 RECID=96 STAMP=971278769
input archived log thread=1 sequence=45 RECID=98 STAMP=971278769
input archived log thread=1 sequence=46 RECID=100 STAMP=971278770
input archived log thread=1 sequence=47 RECID=102 STAMP=971278970
input archived log thread=1 sequence=48 RECID=104 STAMP=971279721
channel ORA_DISK_1: starting piece 1 at 20-MAR-18
channel ORA_DISK_1: finished piece 1 at 20-MAR-18
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/0dsu93b9_1_1 tag=TAG20180320T155521 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/archive_log/1_26_963738576.arc RECID=60 STAMP=971278760
archived log file name=/u01/archive_log/1_27_963738576.arc RECID=62 STAMP=971278761
archived log file name=/u01/archive_log/1_28_963738576.arc RECID=64 STAMP=971278761
archived log file name=/u01/archive_log/1_29_963738576.arc RECID=66 STAMP=971278762
archived log file name=/u01/archive_log/1_30_963738576.arc RECID=67 STAMP=971278762
archived log file name=/u01/archive_log/1_31_963738576.arc RECID=69 STAMP=971278763
archived log file name=/u01/archive_log/1_32_963738576.arc RECID=72 STAMP=971278764
archived log file name=/u01/archive_log/1_33_963738576.arc RECID=74 STAMP=971278764
archived log file name=/u01/archive_log/1_34_963738576.arc RECID=76 STAMP=971278764
archived log file name=/u01/archive_log/1_35_963738576.arc RECID=78 STAMP=971278765
archived log file name=/u01/archive_log/1_36_963738576.arc RECID=80 STAMP=971278765
archived log file name=/u01/archive_log/1_37_963738576.arc RECID=82 STAMP=971278766
archived log file name=/u01/archive_log/1_38_963738576.arc RECID=84 STAMP=971278766
archived log file name=/u01/archive_log/1_39_963738576.arc RECID=86 STAMP=971278767
archived log file name=/u01/archive_log/1_40_963738576.arc RECID=89 STAMP=971278767
archived log file name=/u01/archive_log/1_41_963738576.arc RECID=90 STAMP=971278768
archived log file name=/u01/archive_log/1_42_963738576.arc RECID=92 STAMP=971278768
archived log file name=/u01/archive_log/1_43_963738576.arc RECID=94 STAMP=971278769
archived log file name=/u01/archive_log/1_44_963738576.arc RECID=96 STAMP=971278769
archived log file name=/u01/archive_log/1_45_963738576.arc RECID=98 STAMP=971278769
archived log file name=/u01/archive_log/1_46_963738576.arc RECID=100 STAMP=971278770
archived log file name=/u01/archive_log/1_47_963738576.arc RECID=102 STAMP=971278970
archived log file name=/u01/archive_log/1_48_963738576.arc RECID=104 STAMP=971279721
Finished backup at 20-MAR-18
RMAN>
END