您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > ORACLE清理归档日志
清理归档日志:archivelog日志已满ORA-00257:archivererror.Connectinternalonly,untilfreed错误的处理方法1.用sys用户登录sqlplussys/pass@ttassysdba2.看看archivlog所在位置SQLshowparameterlog_archive_dest;NAMETYPEVALUE-----------------------------------------------------------------------------log_archive_deststringlog_archive_dest_1stringlog_archive_dest_10string3.一般VALUE为空时,可以用archiveloglist;检查一下归档目录和logsequenceSQLarchiveloglist;DatabaselogmodeArchiveModeAutomaticarchivalEnabledArchivedestinationUSE_DB_RECOVERY_FILE_DESTOldestonlinelogsequence360Nextlogsequencetoarchive360Currentlogsequence3624.检查flashrecoveryarea的使用情况,可以看见archivelog已经很大了,达到96.62SQLselect*fromV$FLASH_RECOVERY_AREA_USAGE;FILE_TYPEPERCENT_SPACE_USEDPERCENT_SPACE_RECLAIMABLENUMBER_OF_FILES----------------------------------------------------------------------CONTROLFILE.1301ONLINELOG2.9303ARCHIVELOG96.620141BACKUPPIECE000IMAGECOPY000FLASHBACKLOG0005.计算flashrecoveryarea已经占用的空间SQLselectsum(percent_space_used)*3/100fromv$flash_recovery_area_usage;SUM(PERCENT_SPACE_USED)*3/100-----------------------------2.99046.找到recovery目录,showparameterrecoverSQLshowparameterrecover;NAMETYPEVALUE-----------------------------------------------------------------------------db_recovery_file_deststring/u01/app/oracle/flash_recovery_areadb_recovery_file_dest_sizebiginteger5Grecovery_parallelisminteger07上述结果告诉我们,归档位置用的是默认值,放在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.rmantargetsys/pass[root@sha3oracle]#rmantargetsys/passRecoveryManager:Release10.2.0.4.0-ProductiononTueJan2001:41:262009Copyright(c)1982,2007,Oracle.Allrightsreserved.connectedtotargetdatabase:tt(DBID=4147983671)9.检查一些无用的archivelogRMANcrosscheckarchivelogall;10.删除过期的归档RMANdeleteexpiredarchivelogall;deletearchiveloguntiltime'sysdate-1';删除截止到前一天的所有archivelog11.再次查询,发现使用率正常,已经降到23.03SQLselect*fromV$FLASH_RECOVERY_AREA_USAGE;FILE_TYPEPERCENT_SPACE_USEDPERCENT_SPACE_RECLAIMABLENUMBER_OF_FILES----------------------------------------------------------------------CONTROLFILE.1301ONLINELOG2.9303ARCHIVELOG23.03036BACKUPPIECE000IMAGECOPY000FLASHBACKLOG000其它有用的Command:----------------------------------如果archivelog模式下不能正常startup,则先恢复成noarchivelog,startup成功后,再shutdown;shutdownimmediate;startupmount;alterdatabasenoarchivelog;alterdatabaseopen;shutdownimmediate;再次startup以archivelog模式shutdownimmediate;startupmount;showparameterlog_archive_dest;alterdatabasearchivelog;archiveloglist;alterdatabaseopen;如果还不行,则删除一些archloglogSQLselectgroup#,sequence#fromv$log;GROUP#SEQUENCE#--------------------162364263原来是日志组一的一个日志不能归档SQLalterdatabaseclearunarchivedlogfilegroup1;alterdatabaseopen;最后,也可以指定位置ArchLog,请按照如下配置selectnamefromv$datafile;altersystemsetlog_archive_dest='/opt/app/oracle/oradata/usagedb/arch'scope=spfile或者修改大小SQLaltersystemsetdb_recovery_file_dest_size=3Gscope=both;
本文标题:ORACLE清理归档日志
链接地址:https://www.777doc.com/doc-6940141 .html