小白可参考。
测试库很久没看,今天登录报错:
[oracle@ora01 19c]$ sqlplus jyc/jyc@jycdb
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 8月 17 10:48:34 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-00257: 归档程序错误。只有在解析完成后才以 AS SYSDBA 方式连接。
很明显,归档可能出现了问题:
检查alert日志,报ORA-19809: 超出了恢复文件数的限制。
[oracle@ora01 19c]$ cd $ORACLE_BASE/diag/rdbms/jyc/
i_1.mif jyc
[oracle@ora01 19c]$ cd $ORACLE_BASE/diag/rdbms/jyc/jyc/trace
[oracle@ora01 trace]$ tail -50 alert_jyc.log
ORA-19804: 无法回收 209715200 字节磁盘空间 (从 13350469632 字节限制中)
2023-08-17T10:45:25.516953+08:00
Errors in file /u01/app/oracle/diag/rdbms/jyc/jyc/trace/jyc_tt00_15306.trc:
ORA-19809: 超出了恢复文件数的限制
ORA-19804: 无法回收 209715200 字节磁盘空间 (从 13350469632 字节限制中)
2023-08-17T10:46:25.932977+08:00
Errors in file /u01/app/oracle/diag/rdbms/jyc/jyc/trace/jyc_tt00_15306.trc:
ORA-19809: 超出了恢复文件数的限制
ORA-19804: 无法回收 209715200 字节磁盘空间 (从 13350469632 字节限制中)
2023-08-17T10:47:26.349492+08:00
Errors in file /u01/app/oracle/diag/rdbms/jyc/jyc/trace/jyc_tt00_15306.trc:
ORA-19809: 超出了恢复文件数的限制
ORA-19804: 无法回收 209715200 字节磁盘空间 (从 13350469632 字节限制中)
2023-08-17T10:48:26.765097+08:00
Errors in file /u01/app/oracle/diag/rdbms/jyc/jyc/trace/jyc_tt00_15306.trc:
ORA-19809: 超出了恢复文件数的限制
ORA-19804: 无法回收 209715200 字节磁盘空间 (从 13350469632 字节限制中)
检查磁盘空间足够
[oracle@ora01 19c]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 33M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/mapper/ol-root 91G 32G 60G 35% /
/dev/sda1 1014M 184M 831M 19% /boot
tmpfs 768M 0 768M 0% /run/user/0
[oracle@ora01 19c]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 8月 17 10:49:37 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
连接到:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show parameter reco;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area
db_recovery_file_dest_size big integer 12732M
db_unrecoverable_scn_tracking boolean TRUE
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL> --db_recovery_file_dest_size 设置的12G
SQL>
SQL> set line 160
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES CON_ID
----------------------- ------------------ ------------------------- --------------- ----------
CONTROL FILE 0 0 0 0
REDO LOG 0 0 0 0
ARCHIVED LOG 98.97 0 151 0
BACKUP PIECE .43 0 3 0
IMAGE COPY 0 0 0 0
FLASHBACK LOG 0 0 0 0
FOREIGN ARCHIVED LOG 0 0 0 0
AUXILIARY DATAFILE COPY 0 0 0 0
已选择 8 行。
SQL>--恢复区ARCHIVED LOG占用超过了98.97%不足了。
–临时处理办法1:扩大恢复区空间
SQL> alter system set db_recovery_file_dest_size=30G;
系统已更改。
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES CON_ID
----------------------- ------------------ ------------------------- --------------- ----------
CONTROL FILE 0 0 0 0
REDO LOG 0 0 0 0
ARCHIVED LOG 42.71 0 154 0
BACKUP PIECE .18 0 3 0
IMAGE COPY 0 0 0 0
FLASHBACK LOG 0 0 0 0
FOREIGN ARCHIVED LOG 0 0 0 0
AUXILIARY DATAFILE COPY 0 0 0 0
已选择 8 行。
SQL> exit
再次运行正常:
[oracle@ora01 19c]$ sqlplus jyc/jyc@jycdb
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 8月 17 10:51:47 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
上次成功登录时间: 星期三 7月 19 2023 10:01:24 +08:00
连接到:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
–临时处理办法2:删除归档日志。
推荐在rman下操作:
DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE - 3';
如果采用操作系统命令rm archxxx.dbf则需在rman下做下交叉检查
crosscheck archivelog all;
delete noprompt expired archivelog all;
–更根本的处理办法:
设置定时删除归档日志的任务,制定备份策略,保留特定时间内的归档日志即可。