赞
踩
❑ archive_lag_target参数可以设置一个时间(单位s,合理取值范围在60 ~ 7200之间),通过时间限制,指定数据库强制进行Log Switch,进行归档。一旦设置了archive_lag_target初始化参数,数据库将会周期性的检查实例的当前重做日志。如果遇到下列情况,实例将会切换日志:
当前日志 n 秒前创建,当前日志的归档时间估计为 m 秒,n+m 的值超过archive_lag_target 参数设置。
当前日志包含重做记录。
❑ 在RAC环境中,实例总是使其它线程切换并归档它们的日志(如果它们滞后的话)。当集群中的一个实例比其它实例更空闲时,这是特别有用的。
❑ archive_lag_target 初始化参数指定在主数据库关闭或失效的事件中,备用数据库可以损失多少秒的重做数据(如果data guard 环境没有被配置为 no-data-loss 模式)。它同时也指定了主数据库的当前日志可以跨越的时间上限(秒)。因为归档时间是个估计数,所以这不是一个精准的日志切换时间。
❑ 以下语句设置日志切换间隔为10分钟(典型配置)
alter system set archive_lag_target=600;
❑ 该参数的默认值为零,表示禁用基于时间的日志切换功能;
❑ 即使没有备用数据库也可以设置 archive_lag_target 参数。
❑ archive_lag_target 是动态参数,应该使用 alter system 语句设置。
❑ 在RAC环境中,每个实例的 archive_lag_target 参数必须设置为相同的值。
❑ 如果想设置 archive_lag_target 参数,应该考虑下列因素:
切换日志(归档)的负载;
正常日志切换的频率;
备用数据库可以承受的重做数据丢失是多少。
❑ 如果自然的日志切换已经比指定的切换间隔更频繁,设置 archive_lag_target 可能并不是非常有用。然而,重做日志产生的速度不规则的情况下,间隔可以为当前日志的覆盖时间范围提供一个上限限制;
❑ 如果 archive_lag_target 被设置为很低的值,可能会影响性能。因为这样会强制频繁地切换日志;
❑ archive_lag_target 应该设置成一个不会降低主数据库性能的值。
在DataGuard环境中,为了减少故障时数据损失,我们可以设置ARCHIVE_LAG_TARGET参数,强制进行日志切换。
以下是我的一个测试环境的效果演示。
设置之前:
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; Session altered. SQL> col name for a80 SQL> set linesize 150 SQL> set pagesize 50 SQL> select name,COMPLETION_TIME from v$archived_log where name is not null; NAME COMPLETION_TIME ---------------------------------------------------------------------------------------------------- -------------------------------------------- /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_44_jj596985_.arc 2021-07-29 08:53:29 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_45_jj6bnd4w_.arc 2021-07-29 18:24:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_46_jj6q9cbb_.arc 2021-07-29 22:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_47_jj6sxkb1_.arc 2021-07-29 22:45:05 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_48_jj81htff_.arc 2021-07-30 10:00:26 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_49_jj913vj8_.arc 2021-07-30 19:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_50_jj9conk1_.arc 2021-07-30 22:00:20 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_51_jjb7sck9_.arc 2021-07-31 06:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_52_jjbp8vmt_.arc 2021-07-31 10:07:23 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_53_jjc4cmns_.arc 2021-07-31 14:07:47 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_54_jjcohoqt_.arc 2021-07-31 19:00:05 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_55_jjdbmjsg_.arc 2021-08-01 01:00:32 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_56_jjdw5kt9_.arc 2021-08-01 06:00:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_57_jjfk8tv2_.arc 2021-08-01 12:00:26 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_58_jjg6xqvw_.arc 2021-08-01 18:09:59 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_59_jjgo09wj_.arc 2021-08-01 22:10:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_60_jjhvd7yw_.arc 2021-08-02 09:05:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_61_jjk58p1q_.arc 2021-08-02 21:00:06 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_62_jjk8so1x_.arc 2021-08-02 22:00:21 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_63_jjlhgm2t_.arc 2021-08-03 09:00:03 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_64_jjmspd3q_.arc 2021-08-03 21:01:00 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_65_jjmx5k1t_.arc 2021-08-03 22:00:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_66_jjo3w965_.arc 2021-08-04 09:00:57 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_67_jjpg2681_.arc 2021-08-04 21:00:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_68_jjpkko8c_.arc 2021-08-04 22:00:21 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_69_jjqnqj9r_.arc 2021-08-05 08:00:48 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_70_jjrr97ob_.arc 2021-08-05 18:07:35 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_71_jjs5xdd7_.arc 2021-08-05 22:00:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_72_jjs9hddc_.arc 2021-08-05 23:01:00 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_73_jjtmo9gk_.arc 2021-08-06 11:00:57 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_74_jjvt98mc_.arc 2021-08-06 22:00:08 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_75_jjvtvgn5_.arc 2021-08-06 22:09:50 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_76_jjw47vj3_.arc 2021-08-07 00:50:03 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_77_jjwpfhkf_.arc 2021-08-07 06:00:15 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_78_jjx4jp55_.arc 2021-08-07 10:00:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_79_jjy0mvkz_.arc 2021-08-07 18:00:27 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_80_jjygrllq_.arc 2021-08-07 22:01:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_81_jjyhc4m0_.arc 2021-08-07 22:11:48 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_82_jjzbs9ms_.arc 2021-08-08 06:00:09 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_83_jjzkv1n2_.arc 2021-08-08 08:00:33 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_84_jk072tnv_.arc 2021-08-08 14:03:06 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_85_jk0rjcq1_.arc 2021-08-08 19:00:27 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_86_jk13tpny_.arc 2021-08-08 22:13:42
由于数据库并不繁忙,日志很久才会切换一次。
设置archive_lag_target参数:
SQL> alter system set archive_lag_target=600;
System altered.
SQL> show parameter archive_lag_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 600
这里设置成10分钟做日志切换。
10分钟后,再次查看日志切换时间:
SYS@rui1>select name,COMPLETION_TIME from v$archived_log where name is not null; NAME COMPLETION_TIME ---------------------------------------------------------------------------------------------------- ------------------------------------------ /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_44_jj596985_.arc 2021-07-29 08:53:29 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_45_jj6bnd4w_.arc 2021-07-29 18:24:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_46_jj6q9cbb_.arc 2021-07-29 22:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_29/o1_mf_1_47_jj6sxkb1_.arc 2021-07-29 22:45:05 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_48_jj81htff_.arc 2021-07-30 10:00:26 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_49_jj913vj8_.arc 2021-07-30 19:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_30/o1_mf_1_50_jj9conk1_.arc 2021-07-30 22:00:20 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_51_jjb7sck9_.arc 2021-07-31 06:00:11 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_52_jjbp8vmt_.arc 2021-07-31 10:07:23 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_53_jjc4cmns_.arc 2021-07-31 14:07:47 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_07_31/o1_mf_1_54_jjcohoqt_.arc 2021-07-31 19:00:05 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_55_jjdbmjsg_.arc 2021-08-01 01:00:32 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_56_jjdw5kt9_.arc 2021-08-01 06:00:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_57_jjfk8tv2_.arc 2021-08-01 12:00:26 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_58_jjg6xqvw_.arc 2021-08-01 18:09:59 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_01/o1_mf_1_59_jjgo09wj_.arc 2021-08-01 22:10:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_60_jjhvd7yw_.arc 2021-08-02 09:05:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_61_jjk58p1q_.arc 2021-08-02 21:00:06 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_02/o1_mf_1_62_jjk8so1x_.arc 2021-08-02 22:00:21 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_63_jjlhgm2t_.arc 2021-08-03 09:00:03 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_64_jjmspd3q_.arc 2021-08-03 21:01:00 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_03/o1_mf_1_65_jjmx5k1t_.arc 2021-08-03 22:00:17 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_66_jjo3w965_.arc 2021-08-04 09:00:57 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_67_jjpg2681_.arc 2021-08-04 21:00:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_04/o1_mf_1_68_jjpkko8c_.arc 2021-08-04 22:00:21 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_69_jjqnqj9r_.arc 2021-08-05 08:00:48 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_70_jjrr97ob_.arc 2021-08-05 18:07:35 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_71_jjs5xdd7_.arc 2021-08-05 22:00:12 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_05/o1_mf_1_72_jjs9hddc_.arc 2021-08-05 23:01:00 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_73_jjtmo9gk_.arc 2021-08-06 11:00:57 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_74_jjvt98mc_.arc 2021-08-06 22:00:08 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_06/o1_mf_1_75_jjvtvgn5_.arc 2021-08-06 22:09:50 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_76_jjw47vj3_.arc 2021-08-07 00:50:03 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_77_jjwpfhkf_.arc 2021-08-07 06:00:15 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_78_jjx4jp55_.arc 2021-08-07 10:00:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_79_jjy0mvkz_.arc 2021-08-07 18:00:27 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_80_jjygrllq_.arc 2021-08-07 22:01:54 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_07/o1_mf_1_81_jjyhc4m0_.arc 2021-08-07 22:11:48 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_82_jjzbs9ms_.arc 2021-08-08 06:00:09 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_83_jjzkv1n2_.arc 2021-08-08 08:00:33 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_84_jk072tnv_.arc 2021-08-08 14:03:06 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_85_jk0rjcq1_.arc 2021-08-08 19:00:27 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_08/o1_mf_1_86_jk13tpny_.arc 2021-08-08 22:13:42 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_09/o1_mf_1_87_jk1owyqf_.arc 2021-08-09 03:22:06 /oracle/app/fast_recovery_area/RUI1/archivelog/2021_08_09/o1_mf_1_88_jk1phsv4_.arc 2021-08-09 03:32:09
可以看到最后两条记录之间相差10分钟。
参考:https://unclewang.blog.csdn.net/article/details/79259337
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。