1.查询当前闪回区剩余空间:select * from v$flash_recovery_area_usage;
2.查询占用“缓存”执行语句:
SELECT OSUSER 电脑登录身份,
PROGRAM 发起请求的程序,
USERNAME 登录系统的用户名,
SCHEMANAME,
B.CPU_TIME 花费CPU的时间,
STATUS,
MACHINE 计算机名,
B.SQL_TEXT 执行的SQL
FROM V$SESSION A
LEFT JOIN V$SQL B
ON A.SQL_ADDRESS = B.ADDRESS
AND A.SQL_HASH_VALUE = B.HASH_VALUE
ORDER BY B.CPU_TIME DESC;
3.crosscheck archivelog all;#检查所有归档日志
delete expired archivelog all #删除过期归档日志
或者清理指定时间之前的日志(archivelog):
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';(指定删除7天前的归档日志);
不提示删除:DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
不提示的删除指定日期归档:DELETE NOPROMPT ARCHIVELOG UNTIL TIME "TO_DATE('XXXX-XX-XX','YYYY-MM-DD')";
ONEYEAR=date +%Y-%m-%d
ONEHOURS=date +%H:%M:%S
delete noprompt archivelog all completed before "to_date('$ONEYEAR $ONEHOURS','yyyy-mm-dd hh24:mi:ss')";
#sql 'alter session set nls_date_format="YYYY-MM-DD HH24:MI:SS"'; #设置参数格式
delete archivelog from time "2012-12-01" until time "2013-02-28";
4.列出所有归档日志:list archivelog all;
列出过期的归档:list expired archivelog all;
5.部署计划定时任务:
结合crontab+rman写脚本