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;

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐