Oracle日志文件常用操作
Oracle关于日志文件基本操作
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‘;
该命令用于不能用删除组及组成员命令删除日志时使用
8.查看归档日志占用空间:
SELECT space_limit/1024/1024/1024 AS "Quota_G",space_used/1024/1024 AS "Used_M",space_used/space_limit*100 "Used_%",space_reclaimable AS reclaimable,number_of_files AS files FROM v$recovery_file_dest ;
9.修改归档日志空间大小
alter system set DB_RECOVERY_FILE_DEST_SIZE=40g;
10.查看归档日志列表
RMAN> list archivelog all;
删除归档日志
RMAN> delete archivelog until time ‘sysdate-1‘ ;
双机下也可以用
delete obsolete;
crosscheck archivelog all;
delete expired archivelog all;
11. 用list expired看看是否有失效的archive log,证明没有失效的archive log:
RMAN> list expired archivelog all;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。