归档日志小试

查看归档模式
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /ora/ora10g/archivelog/
Oldest online log sequence 14 --最旧的归档日志编号
Next log sequence to archive 16 --下个归档的日志编号
Current log sequence 16 --当前正在写的日志编号


可以看到与上面显示的一致,14为最旧的归档编号,16为当前正在写的日志,也是下个
会被归档的日志

INACTIVE 已归档
CURRENT 当前正在写

SQL> select group#,sequence#,archived,status from v$log;

GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 14 YES INACTIVE
2 15 YES INACTIVE
3 16 NO CURRENT

查看在线日志文件位置
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/ora/ora10g/product/10.2.0/oradata/orcl/redo03.log
/ora/ora10g/product/10.2.0/oradata/orcl/redo02.log
/ora/ora10g/product/10.2.0/oradata/orcl/redo01.log

查看归档日志文件位置


修改归档日志多路保存
SQL> ho mkdir /ora/ora10g/archivelog_2
SQL> alter system set log_archive_dest_2='location=/ora/ora10g/archivelog_2';
System altered.

再次查看归档日志路径2已经出现
SQL> show parameter log_archive_dest;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string location=/ora/ora10g/archivelo
g/
log_archive_dest_10 string
log_archive_dest_2 string location=/ora/ora10g/archivelo
g_2
手动归档当前是日志
SQL> alter system archive log current;
System altered.
或切换日志
SQL> alter system switch logfile;
System altered.
这里我试过好几次,不管有没有修改数据,只要手动归档或切换日志,就会产生新的归档文件,同时当前日志编号会向前累加

再次查看日志情况,序列号与之前未手动归档时不同

归档前:
SQL> select group#,sequence#,archived,status from v$log;

GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 14 YES INACTIVE
2 15 YES INACTIVE
3 16 NO CURRENT

归档后:
原16号为当前的在手动归档后变为了已归档状态
自动开始17为当前日志编号

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 17 52428800 1 NO CURRENT
775588 20-JUN-13

2 1 15 52428800 1 YES INACTIVE
745746 18-JUN-13

3 1 16 52428800 1 YES ACTIVE
772732 20-JUN-13

在指定的第二路归档路径下已经能看到手动归档后的日志文件
SQL> ho ls /ora/ora10g/archivelog_2 -al
total 3036
drwxr-xr-x. 2 oracle oinstall 4096 Jun 20 12:05 .
drwxr-xr-x. 7 oracle oinstall 4096 Jun 20 11:54 ..
-rw-r-----. 1 oracle oinstall 3058176 Jun 20 12:02 1_16_817239329.dbf
-rw-r-----. 1 oracle oinstall 20992 Jun 20 12:04 1_17_817239329.dbf
-rw-r-----. 1 oracle oinstall 15360 Jun 20 12:05 1_18_817239329.dbf

posted on 2013-06-21 00:25  doclaim  阅读(191)  评论(0编辑  收藏  举报