码迷,mamicode.com
首页 > 数据库 > 详细

Oracle日志文件常用操作

时间:2015-03-31 14:21:31      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

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;

Oracle日志文件常用操作

标签:

原文地址:http://www.cnblogs.com/rusking/p/4380473.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!