Oracle日志文件管理与查看

时间:2021-11-07 08:11:48
1.查询系统使用的是哪一组日志文件:

  select * from v$log;

  2.查询正在使用的组所对应的日志文件:

  select * from v$logfile;

  3.强制日志切换:

  alter system switch logfile;

  4.查询历史日志:

  select * from v$log_history;

  5.查询日志的归档模式:

  select dbid,name,created,log_mode from v$database;

  6.查询归档日志的信息:

  select recid,stamp,thread#,sequence#,name from v$archived_log;

  7.增加与删除日志文件组

  alter database add logfile group 1 ('/home1/oracle/oradata/ora8i/log1a.log'),'/home2/oracle/oradata/ora8i/log1b.log') size 100M;

  alter database drop logfile group 1;

  8.增加与删除日志成员

  alter database add logfile member '/home1/oracle/oradata/ora8i/log1a.log' to group 1,'/home1/oracle/oradata/ora8i/log2a.log' to group 2;

  alter database drop logfile member '/home1/oracle/oradata/ora8i/log1a.log' ;

  9.日志文件移动

  alter database rename file '/home1/oracle/oradata/ora8i/log1a.log' to '/home2/oracle/oradata/ora8i/log1a.log';

  执行该命令之前必须保证该日志文件物理上已经移动到新目录

  10.清除日志文件

  alter database clear logfile '/home1/oracle/oradata/ora8i/log1a.log';

  该命令用于不能用删除组及组成员命令删除日志时使用

参见http://hi.baidu.com/shuker/item/25ee611ee960c7426826bb1f