ORACLE清理归档日志
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
清理归档日志:
archive log日志已满
ORA-00257:archiver error.Connect internal only,until freed错误的处理方法
1.用sys用户登录
sqlplus sys/pass@tt as sysdba
2.看看archiv log所在位置
SQL>show parameter log_archive_dest;
NAME TYPE VALUE
-----------------------------------------------------------------------------
log_archive_dest string
log_archive_dest_1string
log_archive_dest_10string
3.一般VALUE为空时,可以用archive log list;检查一下归档目录和log sequence SQL>archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence360
Next log sequence to archive360
Current log sequence362
4.检查flash recovery area的使用情况,可以看见archivelog已经很大了,达到96.62 SQL>select*from V$FLASH_RECOVERY_AREA_USAGE;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
----------------------------------------------------------------------
CONTROLFILE.1301
ONLINELOG 2.9303
ARCHIVELOG96.620141
BACKUPPIECE000
IMAGECOPY000
FLASHBACKLOG000
5.计算flash recovery area已经占用的空间
SQL>select sum(percent_space_used)*3/100from v$flash_recovery_area_usage;
SUM(PERCENT_SPACE_USED)*3/100
-----------------------------
2.9904
6.找到recovery目录,show parameter recover
SQL>show parameter recover;
NAME TYPE VALUE
-----------------------------------------------------------------------------
db_recovery_file_dest string/u01/app/oracle/flash_recovery_area
db_recovery_file_dest_size big integer5G
recovery_parallelism integer0
7上述结果告诉我们,归档位置用的是默认值,放在flash_recovery_area下(db_recovery_file_dest 目录=/u01/app/oracle/flash_recovery_area)
[root@sha310.2.0]#echo$ORACLE_BASE
/u01/app/oracle
[root@sha310.2.0]#cd$ORACLE_BASE/flash_recovery_area/tt/archivelog
转移或清除对应的归档日志,删除一些不用的日期目录的文件,注意保留最后几个文件(比如360以后的)
---------------------------------------------------------------------------------------
注意:
在删除归档日志后,必须用RMAN维护控制文件,否则空间显示仍然不释放。
---------------------------------------------------------------------------------------
8.rman target sys/pass
[root@sha3oracle]#rman target sys/pass
Recovery Manager:Release10.2.0.4.0-Production on Tue Jan2001:41:262009
Copyright(c)1982,2007,Oracle.All rights reserved.
connected to target database:tt(DBID=4147983671)
9.检查一些无用的archivelog
RMAN>crosscheck archivelog all;
10.删除过期的归档
RMAN>delete expired archivelog all;
delete archivelog until time'sysdate-1';删除截止到前一天的所有archivelog
11.再次查询,发现使用率正常,已经降到23.03
SQL>select*from V$FLASH_RECOVERY_AREA_USAGE;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE
NUMBER_OF_FILES
----------------------------------------------------------------------
CONTROLFILE.1301
ONLINELOG 2.9303
ARCHIVELOG23.03036
BACKUPPIECE000
IMAGECOPY000
FLASHBACKLOG000
其它有用的Command:
----------------------------------
如果archive log模式下不能正常startup,则先恢复成noarchive log,startup成功后,再shutdown; shutdown immediate;
startup mount;
alter database noarchivelog;
alter database open;
shutdown immediate;
再次startup以archive log模式
shutdown immediate;
startup mount;
show parameter log_archive_dest;
alter database archivelog;