eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« Oracle Open World上OTN Lounge的活动安排 | Blog首页 | Oracle OTN Lounge的活动安排 »

Archive Log Current及Archive Log路线图
modb.pro

如果没看到Archive Log的这张路线图,也许你没有想到Archive Log还有这么多学问。
下图来自Oracle10gR2的文档

在RAC环境中,使用Current子句时,如果不指定Thread,则数据库会归档所有Thread,这在实际中是需要注意的。

当发出archive log current命令时,注意不同Thread同时被归档增进:

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 85 52428800 1 NO CURRENT 3578047 03-JUN-06
2 1 84 52428800 1 YES ACTIVE 3545972 03-JUN-06
3 2 25 52428800 1 NO CURRENT 3578044 03-JUN-06
4 2 24 52428800 1 YES INACTIVE 3481897 02-JUN-06

SQL> alter system archive log current;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 85 52428800 1 YES ACTIVE 3578047 03-JUN-06
2 1 86 52428800 1 NO CURRENT 3578082 03-JUN-06
3 2 25 52428800 1 YES INACTIVE 3578044 03-JUN-06
4 2 26 52428800 1 NO CURRENT 3578079 03-JUN-06

而如果我们只是想归档个别Thread,那么只需要加入Thread号码即可:

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 87 52428800 1 NO CURRENT 3578781 03-JUN-06
2 1 86 52428800 1 YES INACTIVE 3578082 03-JUN-06
3 2 25 52428800 1 YES INACTIVE 3578044 03-JUN-06
4 2 26 52428800 1 NO CURRENT 3578079 03-JUN-06

SQL> alter system archive log thread 1 current;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 87 52428800 1 YES ACTIVE 3578781 03-JUN-06
2 1 88 52428800 1 NO CURRENT 3580768 03-JUN-06
3 2 25 52428800 1 YES INACTIVE 3578044 03-JUN-06
4 2 26 52428800 1 NO CURRENT 3578079 03-JUN-06

Oracle文档中这样描述Current语句:

Specify CURRENT to manually archive the current redo log file group of the specified thread, forcing a log switch. If you omit the THREAD parameter, then Oracle Database archives all redo log file groups from all enabled threads, including logs previous to current logs. You can specify CURRENT only when the database is open.

而Swith Logfile被如下定义:

The SWITCH LOGFILE clause lets you explicitly force Oracle Database to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. When you force a log switch, Oracle Database begins to perform a checkpoint but returns control to you immediately rather than when the checkpoint is complete. To use this clause, your instance must have the database open.

我们可以看到这两者的区别,Switch Logfile只是强制写新的日志组,并且触发一个检查点,然后控制权立即转回给调用者;而Archive Log Current需要等候完成归档。

SQL> select thread# from v$instance;
THREAD#
----------
2

Elapsed: 00:00:00.01
SQL> alter system switch logfile;

System altered.

Elapsed: 00:00:00.03

SQL> alter system archive log thread 2 current;

System altered.

Elapsed: 00:00:10.14


我们注意到switch logfile要比archive log current快得多。

-The End-


历史上的今天...
    >> 2013-07-25文章:

By eygle on 2007-07-25 17:17 | Comments (8) | FAQ | 1513 |

8 Comments

前段时间的一个朋友,在RAC 执行alter system archive log thread n current的时候hang住了,ORACLE 一个BUGBug 5388364 ,说是执行该操作的时候被阻塞了,此时才另外一个节点执行alter system switch log file就可以了,看来ORACLE BUG 还不少呀,eygle大师和ORACLE 的人比较熟悉,问一下11G什么时候能够下载呀,诸多令人神往的新特性,叫人心动不已。

ORACLE 11G什么时候能下载,看来很多人都很关注啊。

Oracle11g 9.18日在北京举行Oracle China Lanuch大会。

EYGLE大师,咨询一个问题,我们的计费系统IBM P595准备做RAC,操作系统的版本是AIX 5300-06,HACMP 5.4,ORACLE 版本是9.2.0.8,计费系统的特点是从每15分钟交换机处,将话单文件传到应用服务器,然后insert 到数据库服务器,在月初的时候,提供当月话单的查询量很大,从体系架构上,我们打算做如下的考虑:
1、绑定4个1000M 以太网卡做CHANNEL,用以interconnect,尽可能增打UDP_SENDSPCE和UDP_RECVSPCE,以增加globl cache cr request的吞吐量。
2、根说AIX 5300-06-CSP有问题,准备降低到5300-04
3、两个INSTANCE,一个做INSERT 的话单入库操作,另外一个做当月清单的查询操作。
4、最好是将应用能分开,由于将应用分的很细,现在已经来不及了。
5、数据文件使用裸设备,为conncuurent vg方式。
能否请您提供一些建议:
邮箱:xjmayitong@126.com,谢谢!

Hi,eygle:
我最近在ORACLE9204 RAC上遇到一个问题,在其中一个节点上执行alter system archive log current命令,大概等了3个小时才完,请问这个是不是BUG?

楼上,我看你说的并不是BUG,而是的你重做日志设置的过大,引起归档的时间过长,或者由于I/O引起的争用。

alter system archive log current;如果这是有其他尚未归档的日志,是否也归档这些未归档的日志呢?

如果其他日志尚未归档,是需要归档其他日志的。


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com