oracle归档日志
oracle归档日志
1.查看空间占用率:select * from v$flash_recovery_area_usage;
2.查看归档日志的存放地址:select * from v$recovery_file_dest;
3.查看所有归档,未删除的归档日志 :
select count(*) from v$archived_log where archived='YES' and deleted='NO';
4.查看空间占用率,如果 ARCHIVED LOG 超过90%,Oracle随时有宕机的危险:
select * from v$flash_recovery_area_usage;
5.查看归档日志大小及使用情况:select * from v$recovery_file_dest;
6.查看现有日志 :select group#, bytes, status from v$log;
7.列出所有归档redo日志文件的顺序和产生的时间:
select sequence#,first_time from v$loghist;
8.查看v$archive_log:select * from v$archived_log;
9.查看所有归档,未删除的归档日志:
select count(*) from v$archived_log where archived='YES' and deleted='NO';
oracle数据库怎么进入rman
在sql> 的命令下输入以下命令,回车:
(本地)SQL> $ rman target /
(远程)SQL> $ rman target USERNAME/PASSWORD@orcl
(命令行)输入 rman 回车即可
1.列出所有的归档日志文件: RMAN>list archivelog all;
2.与物理归档日志文件保持同步,之前移走了一部分文件,因此执行此命令后会
在/oracle目录下找不到的归档日志标记为expired
RMAN>crosscheck archivelog all;
3.列出所有expired(过期)的归档日志文件,此时你就可看到移走的归档日志文件均被标记为expired
RMAN>list expired archivelog all;
4.删除所有过期归档日志: RMAN>delete expired archivelog all;
5.删除三天之前的归档日志:RMAN>delete archivelog until time 'sysdate-3';
1.查看规定日志是否打开
select log_mode,force_logging from v$database;
2.开启归档日志
关闭数据库重新启动到mount阶段
shutdown immediate
startup mount
alter database archivelog;
alter database force logging;
3.归档日志自动备份删除脚本
11G RMANBAK 脚本
vi /u01/rmanbak/rmanbak.sh
#!/bin/bash
. ~/.bash_profile
echo -------------------------start-----------------------;date
rman target/<<EOF
backup as compressed backupset database include current controlfile format '/u01/rmanbak/full_%U.bak';
delete noprompt obsolete;
delete noprompt force archivelog all completed before 'sysdate-7';
exit;
EOF
echo -------------------------end-----------------------;date
crontab -e
0 0 * * * /u01/rmanbak/rmanbak.sh > rmanbak.log 2>&1