【ORA】ORA-00257 archiver error. 错误的处理方法

时间:2023-03-10 08:36:14
【ORA】ORA-00257 archiver error. 错误的处理方法

今天连接数据库,结果报错,ora-00257查看

[oracle@exam oracle]$ oerr ora 00257
00257, 00000, "archiver error. Connect internal only, until freed."
// *Cause:  The archiver process received an error while trying to archive
//       a redo log.  If the problem is not resolved soon, the database
//       will stop executing transactions. The most likely cause of this
//       message is the destination device is out of space to store the
//       redo log file.
// *Action:  Check archiver trace file for a detailed description
//        of the problem. Also verify that the
//       device specified in the initialization parameter
//       ARCHIVE_LOG_DEST is set up properly for archiving.

发现这和归档日志有关,查看相关的归档日志

SQL> show parameter recover


NAME                                 TYPE                      VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string              /u01/app/oracle/flash_recovery_area
db_recovery_file_dest_size           big integer       2G
recovery_parallelism                 integer                  0

如果是这样的话,可以直接找到归档日志的存放路径

但是有的时候show出来的不是这样的

NAME                                 TYPE                      VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string              
db_recovery_file_dest_size           big integer       0
recovery_parallelism                 integer                  0

如果是这样的话,可以继续查找

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /archivelog
Oldest online log sequence     728
Next log sequence to archive   730
Current log sequence

到归档的路径下,发现归档的磁盘已经满了

接下来这样做:

转移或者删除,但删除的时候,要保留最后几天的日志,不要全部删除或者转移

转移完成后,要用rman写入控制文件中

[oracle@exam archivelog]$ rman target /


Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 17 07:13:26 2018


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


connected to target database: ZHANG (DBID=2208666666)


检查一些无用的archivelog
RMAN> crosscheck archivelog all;

RMAN> delete expired archivelog all;

删除过期的归档

delete archivelog until time 'sysdate-1' ; 删除截止到前一天的所有archivelog

如果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;
archive log list;               
alter database open;
如果还不行,则删除一些archlog log
SQL> select group#,sequence# from v$log;
    GROUP# SEQUENCE#
---------- ----------
         1         62
         3         64
         2         63
原来是日志组一的一个日志不能归档
SQL> alter database clear unarchived logfile group 1;
alter database open;
最后,也可以指定位置Arch Log, 请按照如下配置
select name from v$datafile;
alter system set log_archive_dest='/opt/app/oracle/oradata/usagedb/arch' scope=spfile
或者修改大小
SQL> alter system set db_recovery_file_dest_size=3G scope=both;