重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1430|回复: 0
打印 上一主题 下一主题

[Oracle] 主库log_archive_dest_state_2为defer与enable的测试

[复制链接]
跳转到指定楼层
楼主
发表于 2022-9-28 11:02:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
文档课题:主库log_archive_dest_state_2deferenable的测试.
主库:CentOS7.9 64+ oracle 11.2.0.4 64
备库:CentOS7.9 64+ oracle 11.2.0.4 64
1、主库归档
主库查看归档日志.
>select sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss') asTIME,round(sum(blocks*block_size)/1024/1024) as "Size(M)",name fromv$archived_log where first_time between to_date('2022-08-27 1','yyyy-mm-ddhh24') and to_date('2022-09-26 14','yyyy-mm-dd hh24') and dest_id=1 group byfirst_time,name,sequence# order by 1 desc;
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        30 2022-09-26 13:14:39         39/u01/app/oracle/fast_recovery_area/archivelog/1_30_1101942938.dbf
        29 2022-09-26 13:14:35         39/u01/app/oracle/fast_recovery_area/archivelog/1_29_1101942938.dbf
        28 2022-09-26 13:14:32         39 /u01/app/oracle/fast_recovery_area/archivelog/1_28_1101942938.dbf
        27 2022-09-26 13:12:41         39/u01/app/oracle/fast_recovery_area/archivelog/1_27_1101942938.dbf
        26 2022-09-26 13:12:40         33/u01/app/oracle/fast_recovery_area/archivelog/1_26_1101942938.dbf
        25 2022-09-26 13:09:32         39/u01/app/oracle/fast_recovery_area/archivelog/1_25_1101942938.dbf
        24 2022-09-26 13:07:10         19/u01/app/oracle/fast_recovery_area/archivelog/1_24_1101942938.dbf
        23 2022-09-26 13:07:08         39 /u01/app/oracle/fast_recovery_area/archivelog/1_23_1101942938.dbf
        22 2022-09-26 11:57:44         31/u01/app/oracle/fast_recovery_area/archivelog/1_22_1101942938.dbf
        21 2022-09-26 11:57:26          0/u01/app/oracle/fast_recovery_area/archivelog/1_21_1101942938.dbf
        20 2022-09-26 11:57:22          0/u01/app/oracle/fast_recovery_area/archivelog/1_20_1101942938.dbf
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        19 2022-08-28 23:27:25          0/u01/app/oracle/fast_recovery_area/archivelog/1_19_1101942938.dbf
        18 2022-08-28 23:27:22          0/u01/app/oracle/fast_recovery_area/archivelog/1_18_1101942938.dbf
        17 2022-08-28 23:07:19          0/u01/app/oracle/fast_recovery_area/archivelog/1_17_1101942938.dbf
        16 2022-08-28 23:06:07          0 /u01/app/oracle/fast_recovery_area/archivelog/1_16_1101942938.dbf
        15 2022-08-28 23:05:52          0/u01/app/oracle/fast_recovery_area/archivelog/1_15_1101942938.dbf
        14 2022-08-28 23:00:19          0/u01/app/oracle/fast_recovery_area/archivelog/1_14_1101942938.dbf
17 rowsselected.
2、备库归档
备库查看归档日志.
>select sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss') asTIME,round(sum(blocks*block_size)/1024/1024) as "Size(M)",name fromv$archived_log where first_time between to_date('2022-08-27 1','yyyy-mm-ddhh24') and to_date('2022-09-26 14','yyyy-mm-dd hh24') and dest_id=1 group byfirst_time,name,sequence# order by 1 desc;
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        30 2022-09-26 13:14:39         39/u01/app/oracle/fast_recovery_area/archivelog1_30_1101942938.dbf
        29 2022-09-26 13:14:35         39/u01/app/oracle/fast_recovery_area/archivelog1_29_1101942938.dbf
        28 2022-09-26 13:14:32         39/u01/app/oracle/fast_recovery_area/archivelog1_28_1101942938.dbf
        27 2022-09-26 13:12:41         39/u01/app/oracle/fast_recovery_area/archivelog1_27_1101942938.dbf
        26 2022-09-26 13:12:40         33/u01/app/oracle/fast_recovery_area/archivelog1_26_1101942938.dbf
        25 2022-09-26 13:09:32         39/u01/app/oracle/fast_recovery_area/archivelog1_25_1101942938.dbf
        24 2022-09-26 13:07:10         19/u01/app/oracle/fast_recovery_area/archivelog1_24_1101942938.dbf
        23 2022-09-26 13:07:08         39/u01/app/oracle/fast_recovery_area/archivelog1_23_1101942938.dbf
        22 2022-09-26 11:57:44         31/u01/app/oracle/fast_recovery_area/archivelog1_22_1101942938.dbf
        21 2022-09-26 11:57:26          0 /u01/app/oracle/fast_recovery_area/archivelog1_21_1101942938.dbf
        19 2022-08-28 23:27:25          0/u01/app/oracle/fast_recovery_area/archivelog1_19_1101942938.dbf
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        18 2022-08-28 23:27:22          0/u01/app/oracle/fast_recovery_area/archivelog1_18_1101942938.dbf
        17 2022-08-28 23:07:19          0 /u01/app/oracle/fast_recovery_area/archivelog1_17_1101942938.dbf
        16 2022-08-28 23:06:07          0/u01/app/oracle/fast_recovery_area/archivelog1_16_1101942938.dbf
14 rowsselected.
3、修改参数
将主库log_archive_dest_state_2设置为defer,此后观察主库新产生的归档日志是否会传递到备库.
主库设置:
>alter system set log_archive_dest_state_2=defer;
>create table t1 as select * from all_objects;
>insert into t1 select * from t1;
……(省略若干insert)
>select count(*) from t1;
  COUNT(*)
----------
   2700640
>commit;
4、查询归档4.1、主库查询
>select sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss') asTIME,round(sum(blocks*block_size)/1024/1024) as "Size(M)",name fromv$archived_log where first_time between to_date('2022-08-27 1','yyyy-mm-ddhh24') and to_date('2022-09-26 14','yyyy-mm-dd hh24') and dest_id=1 group byfirst_time,name,sequence# order by 1 desc;
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        38 2022-09-26 13:42:43         39/u01/app/oracle/fast_recovery_area/archivelog/1_38_1101942938.dbf
        37 2022-09-26 13:42:40         39/u01/app/oracle/fast_recovery_area/archivelog/1_37_1101942938.dbf
        36 2022-09-26 13:42:36         39 /u01/app/oracle/fast_recovery_area/archivelog/1_36_1101942938.dbf
        35 2022-09-26 13:42:33         39/u01/app/oracle/fast_recovery_area/archivelog/1_35_1101942938.dbf
        34 2022-09-26 13:42:30         39/u01/app/oracle/fast_recovery_area/archivelog/1_34_1101942938.dbf
        33 2022-09-26 13:42:29         39/u01/app/oracle/fast_recovery_area/archivelog/1_33_1101942938.dbf
        32 2022-09-26 13:42:28         29/u01/app/oracle/fast_recovery_area/archivelog/1_32_1101942938.dbf
        31 2022-09-26 13:14:42         39 /u01/app/oracle/fast_recovery_area/archivelog/1_31_1101942938.dbf
        30 2022-09-26 13:14:39         39/u01/app/oracle/fast_recovery_area/archivelog/1_30_1101942938.dbf
        29 2022-09-26 13:14:35         39/u01/app/oracle/fast_recovery_area/archivelog/1_29_1101942938.dbf
        28 2022-09-26 13:14:32         39/u01/app/oracle/fast_recovery_area/archivelog/1_28_1101942938.dbf
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------- -----------------------------------------------------------------
        27 2022-09-26 13:12:41         39/u01/app/oracle/fast_recovery_area/archivelog/1_27_1101942938.dbf
        26 2022-09-26 13:12:40         33/u01/app/oracle/fast_recovery_area/archivelog/1_26_1101942938.dbf
        25 2022-09-26 13:09:32         39/u01/app/oracle/fast_recovery_area/archivelog/1_25_1101942938.dbf
        24 2022-09-26 13:07:10         19/u01/app/oracle/fast_recovery_area/archivelog/1_24_1101942938.dbf
        23 2022-09-26 13:07:08         39 /u01/app/oracle/fast_recovery_area/archivelog/1_23_1101942938.dbf
        22 2022-09-26 11:57:44         31/u01/app/oracle/fast_recovery_area/archivelog/1_22_1101942938.dbf
        21 2022-09-26 11:57:26          0/u01/app/oracle/fast_recovery_area/archivelog/1_21_1101942938.dbf
        20 2022-09-26 11:57:22          0/u01/app/oracle/fast_recovery_area/archivelog/1_20_1101942938.dbf
        19 2022-08-28 23:27:25          0/u01/app/oracle/fast_recovery_area/archivelog/1_19_1101942938.dbf
        18 2022-08-28 23:27:22          0/u01/app/oracle/fast_recovery_area/archivelog/1_18_1101942938.dbf
        17 2022-08-28 23:07:19          0/u01/app/oracle/fast_recovery_area/archivelog/1_17_1101942938.dbf
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        16 2022-08-28 23:06:07          0/u01/app/oracle/fast_recovery_area/archivelog/1_16_1101942938.dbf
        15 2022-08-28 23:05:52          0/u01/app/oracle/fast_recovery_area/archivelog/1_15_1101942938.dbf
        14 2022-08-28 23:00:19          0/u01/app/oracle/fast_recovery_area/archivelog/1_14_1101942938.dbf
25 rowsselected.
说明:sequence#3138号为主库新产生归档日志.
4.2、备库查询
>select sequence#,to_char(first_time,'yyyy-mm-dd hh24:mi:ss') asTIME,round(sum(blocks*block_size)/1024/1024) as "Size(M)",name fromv$archived_log where first_time between to_date('2022-08-27 1','yyyy-mm-ddhh24') and to_date('2022-09-26 14','yyyy-mm-dd hh24') and dest_id=1 group byfirst_time,name,sequence# order by 1 desc;
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        31 2022-09-26 13:14:42         39/u01/app/oracle/fast_recovery_area/archivelog1_31_1101942938.dbf
        30 2022-09-26 13:14:39         39/u01/app/oracle/fast_recovery_area/archivelog1_30_1101942938.dbf
        29 2022-09-26 13:14:35         39/u01/app/oracle/fast_recovery_area/archivelog1_29_1101942938.dbf
        28 2022-09-26 13:14:32         39/u01/app/oracle/fast_recovery_area/archivelog1_28_1101942938.dbf
        27 2022-09-26 13:12:41         39/u01/app/oracle/fast_recovery_area/archivelog1_27_1101942938.dbf
        26 2022-09-26 13:12:40         33/u01/app/oracle/fast_recovery_area/archivelog1_26_1101942938.dbf
        25 2022-09-26 13:09:32         39/u01/app/oracle/fast_recovery_area/archivelog1_25_1101942938.dbf
        24 2022-09-26 13:07:10         19 /u01/app/oracle/fast_recovery_area/archivelog1_24_1101942938.dbf
        23 2022-09-26 13:07:08         39/u01/app/oracle/fast_recovery_area/archivelog1_23_1101942938.dbf
        22 2022-09-26 11:57:44         31/u01/app/oracle/fast_recovery_area/archivelog1_22_1101942938.dbf
        21 2022-09-26 11:57:26          0/u01/app/oracle/fast_recovery_area/archivelog1_21_1101942938.dbf
SEQUENCE# TIME                   Size(M) NAME
----------------------------- ---------------------------------------------------------------------------
        19 2022-08-28 23:27:25          0/u01/app/oracle/fast_recovery_area/archivelog1_19_1101942938.dbf
        18 2022-08-28 23:27:22          0/u01/app/oracle/fast_recovery_area/archivelog1_18_1101942938.dbf
        17 2022-08-28 23:07:19          0/u01/app/oracle/fast_recovery_area/archivelog1_17_1101942938.dbf
        16 2022-08-28 23:06:07          0 /u01/app/oracle/fast_recovery_area/archivelog1_16_1101942938.dbf
15 rowsselected.
5、测试结论
主库新产生的归档日志并未传递到备库.后将log_archive_dest_state_2恢复为enable,在备库未开启日志实时应用的情况下,主库新产生的归档日志并不会主动传递到备库.

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-16 11:12 , Processed in 0.092078 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表