根據http://blog.csdn.net/u011364306/article/details/49276717的博客整理
解決 設置數據庫爲歸檔模式時沒有設置log_archive_dest_1參數,導致
Oracle錯誤——ORA-03113:通信通道的文件結尾 即閃回區空間滿了
首先,在linux系統中,如何一個文件被進程所佔用,這個時候即使將文件移走或刪除,空間其實仍然是被佔用的。遇到上述情況空間未釋放可能有這方面的原因,將相關的程序殺掉即可,但是這可能會影響Oracle的運行。這時我們通過更改歸檔日誌的路徑大小來解決這種問題。
windows版本的話,如果是默認安裝後沒有設置環境變量。當oarcle實例停止後,由於沒有oracle_sid 會導致用sqlplus連接時出現錯誤,無效監聽ora-1524錯誤。此時要麼設置環境變量要麼通過服務啓動實例,即使啓動失敗,這樣就可以用sqlplus連接了。
Oracle11g版本,ORACLE默認的日誌歸檔路徑爲閃回恢復區($ORACLE_BASE/fast_recovery_area)。對於這個路徑,Oracle有一個限制,就是默認只有4G的空間,而且不只是歸檔日誌的默認路徑,也是備份文件和閃回日誌的默認地址,這樣的話歸檔日誌鎖使用的空間就達不到4G,在沒有設置好這個路徑大小的情況下,很多系統都遇到過歸檔日誌滿而無法歸檔導致數據庫夯住的問題。
Oracle出現錯誤,一般去錯誤日誌裏去找問題根源:在e:\app\kang\diag\rdbms\oracle\oracle\trace\文件夾下找文件,打開顯示錯誤日誌:
- Trace filee:\app\kang\diag\rdbms\oracle\oracle\trace\oracle_ora_6320.trc
- Oracle Database 11gEnterprise Edition Release 11.2.0.1.0 - 64bit Production
- With thePartitioning, OLAP, Data Mining and Real Application Testing options
- Windows NT VersionV6.1 Service Pack 1
- CPU : 4 - type 8664, 2 PhysicalCores
- Process Affinity : 0x0x0000000000000000
- Memory (Avail/Total):Ph:2805M/6087M, Ph+PgF:6761M/12173M
- Instance name: oracle
- Redo thread mountedby this instance: 1
- Oracle processnumber: 19
- Windows thread id:6320, image: ORACLE.EXE (SHAD)
- *** 2014-08-1608:18:55.461
- *** SESSIONID:(191.3) 2014-08-16 08:18:55.461
- *** CLIENT ID:()2014-08-16 08:18:55.461
- *** SERVICE NAME:()2014-08-16 08:18:55.461
- *** MODULENAME:(sqlplus.exe) 2014-08-16 08:18:55.461
- *** ACTION NAME:()2014-08-16 08:18:55.461
- ORA-19815: 警告:db_recovery_file_dest_size 字節 (共 4102029312 字節) 已使用 100.00%, 尚有 0 字節可用。
- ************************************************************************
- You have followingchoices to free up space from recovery area:
- 1. Consider changingRMAN RETENTION POLICY. If you are using Data Guard,
- then consider changing RMAN ARCHIVELOGDELETION POLICY.
- 2. Back up files totertiary device such as tape using RMAN
- BACKUP RECOVERY AREA command.
- 3. Add disk space andincrease db_recovery_file_dest_size parameter to
- reflect the new space.
- 4. Delete unnecessaryfiles using RMAN DELETE command. If an operating
- system command was used to delete files,then use RMAN CROSSCHECK and
- DELETE EXPIRED commands.
- ************************************************************************
- ORA-19809:超出了恢復文件數的限制
- ORA-19804: 無法回收33961984 字節磁盤空間 (從 4102029312 限制中)
- *** 2014-08-1608:18:55.502 4132 krsh.c
- ARCH: Error 19809Creating archive log file to'E:\APP\KANG\FLASH_RECOVERY_AREA\ORACLE\ARCHIVELOG\2014_08_16\O1_MF_1_159_%U_.ARC'
- *** 2014-08-1608:18:55.502 2747 krsi.c
- krsi_dst_fail: dest:1err:19809 force:0 blast:1
- DDE: Problem Key 'ORA312' was flood controlled (0x1) (no incident)
- ORA-00312: 聯機日誌 3 線程1: 'E:\APP\KANG\ORADATA\ORACLE\REDO03.LOG'
- ORA-16038: 日誌 3sequence# 159 無法歸檔
- ORA-19809:超出了恢復文件數的限制
- ORA-00312: 聯機日誌 3 線程1: 'E:\APP\KANG\ORADATA\ORACLE\REDO03.LOG'
- *** 2014-08-1608:18:55.565
- USER (ospid: 6320):terminating the instance due to error 16038
1.查看歸檔日誌路徑
- SQL> archive log list
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination USE_DB_RECOVERY_FILE_DEST
- Oldest online log sequence 4
- Next log sequence to archive 6
- Current log sequence 6
2.查看DB_RECOVERY_FILE_DEST路徑
- SQL> show parameter db_recovery
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_recovery_file_dest string /u01/oracle/fast_recovery_area
- db_recovery_file_dest_size big integer 4G
查看閃回區使用情況
SQL> select * from v$recovery_file_dest;
NAME SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------- ---------- ----------------- --------------- ---------------
/opt/oracle/app/fast_recovery_area 4322230272 0 0 0
默認情況下,歸檔日誌會存放到閃回恢復區($ORACLE_BASE/fast_recovery_area)內,如果閃回恢復區已經使用到4G,歸檔日誌就有可能無法繼續歸檔,數據庫夯住。
1)解決方法一
通常的解決方法是增大閃回恢復區,可以用以下SQL實現。
- --修改語句
- SQL> alter system set db_recovery_file_dest_size=10G scope=both;
- System altered.
- --再次查看
- SQL> show parameter db_recovery
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_recovery_file_dest string /u01/oracle/fast_recovery_area
- db_recovery_file_dest_size big integer 10G
scope選項spfile保存到spfile裏面需要重啓生效,both表示立即生效並保存到spfile文件,如果不保存到spfile裏面下次重啓數據庫
要重新設置。
2)解決方法二
修改歸檔日誌的路徑,將歸檔日誌放到其他不受限制的路徑下來解決這個問題,可通過下面的SQL來修改歸檔日誌的存放路徑。
- --修改log_archive_dest_1值來重新制定路徑
- SQL> alter system set log_archive_dest_1='location=/u01/oracle/archive' scope=both;
- System altered.
立即生效,查看歸檔路徑是否修改成功
- --再次查看,修改成功
- SQL> archive log list
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination /u01/oracle/archive
- Oldest online log sequence 4
- Next log sequence to archive 6
- Current log sequence 6
- SQL> alter system switch logfile;
- System altered.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- [oracle@cancer oracle]$ ll /u01/oracle/archive/
- total 36540
- -rw-r----- 1 oracle oinstall 9608704 Oct 20 14:39 1_6_893515662.dbf
- SQL> show parameter log_archive_format
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- log_archive_format string %t_%s_%r.dbf