ORA-00257: archiver error. Connect internal only, until freed 错误的处理方法

ORA-00257: archiver error. Connect internal only, until freed 错误的处理方法


背景: 最近总是在捣鼓oracle数据库,前几天给公司的一台oracle数据库做了实时同步功能,同步必须要打开归档日志功能,由于生产数据量比较大,不到1天的时间就把oracle日志空间占满了。报如下错误:ORA-00257: archiver error. Connect internal only, until freed


wKiom1XursDhekvsAATWJ_VoGWM204.jpg


1. 用sys用户登录
  sqlplus sys/password as sysdba;

 

2. 看看archiv log有那些日志
SQL> show parameter log_archive_dest;
NAME                                     TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest                   string
log_archive_dest_1               string
log_archive_dest_10             string




 

3. 可以用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 sequence     1892
Next log sequence to archive  1894
Current log sequence              1894

 

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                 .13                        0               1
ONLINELOG                  2.93                        0               3
ARCHIVELOG                96.62                       0              141
BACKUPPIECE                   0                         0               0
IMAGECOPY                      0                         0               0
FLASHBACKLOG                0                         0               0

 

5. 计算flash recovery area已经占用的空间
SQL> select sum(percent_space_used)*3/100 from v$flash_recovery_area_usage;

SUM(PERCENT_SPACE_USED)*3/100
-----------------------------
                       2.9904
                      
6.

查看日志所在目录及日志空间设置的最大值:

SQL> show parameter db_recovery_file_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      D:\app\Administrator\flash_rec
                                                 overy_area
db_recovery_file_dest_size           big integer 3912M



                      
7 上述结果告诉我们,归档位置用的是默认值,放在flash_recovery_area下(db_recovery_file_dest目录=D:\app\Administrator\flash_recovery_area


 


用Rman转移或清除对应的归档日志, 删除一些不用的日期目录的文件,注意保留最后几个文件

 

---------------------------------------------------------------------------------------
注意:
如果直接删除归档日志后,必须用RMAN维护控制文件,否则空间显示仍然不释放。
---------------------------------------------------------------------------------------

8. rman target sys/pass
[root@sha3 oracle]# rman target sys/pass

Recovery Manager: Release 10.2.0.4.0 - Production on Tue Jan 20 01:41:26 2009

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                 .13                         0               1
ONLINELOG                  2.93                         0               3
ARCHIVELOG                23.03                         0              36
BACKUPPIECE                   0                         0               0
IMAGECOPY                     0                         0               0
FLASHBACKLOG                  0                         0               0

 

 

======================================================


下面的命令用于校验归档日志的有效性,列出无效的归档日志,以及以何种方式清除归档日志,列出几种常用的:

crosscheck archivelog all;                            --->校验日志的可用性

list expired archivelog all;                          --->列出所有失效的归档日志

delete archivelog until sequence 16;                  --->删除log sequence为16及16之前的所有归档日志

delete archivelog all completed before 'sysdate-7';    --->删除系统时间7天以前的归档日志,不会删除闪回区有效的归档日志

delete archivelog all completed before 'sysdate - 1';  --->同上,1天以前的

delete archivelog from time 'sysdate-1';              --->注意这个命令,删除系统时间1天以内到现在的归档日志

delete noprompt archivelog all completed before 'sysdate';  --->该命令清除所有的归档日志

delete noprompt archivelog all;                              --->同上一命令



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 

 

其它有用的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;
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='D:\app\Administrator\backup' scope=spfile

或者修改大小
SQL> alter system set db_recovery_file_dest_size=100G scope=both;



备注:

应该是scope=both和scope=spfile
Oracle 里面有个叫做spfile的东西,就是动态参数文件,里面设置了Oracle 的各种参数。所谓的动态,就是说你可以在不关闭数据库的情况下,更改数据库参数,记录在spfile里面。更改参数的时候,有4种scope选项。scope就是范围
++ scope=spfile 仅仅更改spfile里面的记载,不更改内存,也就是不立即生效,而是等下次数据库启动生效。有一些参数只允许用这种方法更改
++ scope=memory 仅仅更改内存,不改spfile。也就是下次启动就失效了
++ scope=both 内存和spfile都更改
++ 不指定scope参数,等同于scope=both.



你可能感兴趣的:(oracle,数据库,管理,日志归档,空间满了)