Dataguard环境下archivelog删除测试的设置

RMAN> show  ARCHIVELOG DELETION POLICY ;

RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

SQL> set linesize 200;
 select * from v$flash_recovery_area_usage where FILE_TYPE='ARCHIVED LOG';

FILE_TYPE		PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES	 CON_ID
----------------------- ------------------ ------------------------- --------------- ----------
ARCHIVED LOG			     12.27			   0		  21	      0

重新设置archivelog的删除策略

RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;


SQL> set linesize 200;
 select * from v$flash_recovery_area_usage where FILE_TYPE='ARCHIVED LOG';
SQL> 
FILE_TYPE		PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES	 CON_ID
----------------------- ------------------ ------------------------- --------------- ----------
ARCHIVED LOG			     12.27		       12.27		  21	      0

我们可以看到随着我们改变归档日志的删除策略PERCENT_SPACE_RECLAIMABLE这个字段从0变成了12.27%。
需要说明的是可以被自动删除的归档日志不会在 report obsolete中报告。
下面的sql可以查询所有在备库上应用的归档日志:

select a.thread#, a.sequence#, a.applied from v$archived_log a, v$database d
where a.activation# = d.activation# and a.applied='YES';

如果在中有FRA,空间压力,这些日志将被自动删除,在数据库的alert.log 从将会看到类似下面的提示:

Deleted Oracle managed file /opt/app/oracle/FRA/<DB_NAME>/archivelog/2020_05_30/o1_mf_1_151_6y71q675_.arc
Deleted Oracle managed file /opt/app/oracle/FRA/<DB_NAME>/archivelog/2020_05_31/o1_mf_1_151_6y87pzg4_.arc
姚远ACE CSDN认证博客专家 ACE 华为云 MVP
Oracle ACE,华为云 MVP,Oracle10g,12c OCM; MySQL 5.6,5.7,8.0 OCP;CCNA; EMC Certified; IBM P Certified; RHCE; SQLServer 764; DB2 Certified; TOEIC 890;获得过两次国家部级科技进步奖;发明过两项计算机专利。微信:yaoyuanace 邮箱:yaoyuanace(at)qq.com
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页