今天在测试数据库中对一个表插入了大量的数据, 导致数据库卡死 hang 住, 重启数据库后报错如下:

C:\Documents and Settings\davidd>sqlplus "/ as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 5 08:50:23 2014
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             478152104 bytes
Database Buffers          293601280 bytes
Redo Buffers                5259264 bytes
Database mounted.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 3416
Session ID: 5 Serial number: 3

SQL> show parameter background_dump

NAME                                         TYPE        VALUE
------------------------------------ ----------- ---------------------------------------------------------------
background_dump_dest       string      g:\app\davidd\diag\rdbms\david\david\trace

在 background_dump_dest 目录下查看日志文件

************************************************************************************************************************************************
Errors in file g:\app\davidd\diag\rdbms\david\david\trace\david_arc1_4260.trc:
ORA-19809: 超過復原檔案限制
ORA-19804: 無法回收 41098240 個位元組的磁碟空間, 從 5218762752 限制
ARC1: Error 19809 Creating archive log file to 'G:\APP\DAVIDD\DAVID\ARCHIVELOG\2014_12_05\O1_MF_1_404_%U_.ARC'
Errors in file g:\app\davidd\diag\rdbms\david\david\trace\david_ora_3416.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 5218762752 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************************************************************************************
You have following choices to free up space from recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
   then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
   BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
   reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
   system command was used to delete files, then use RMAN CROSSCHECK and
   DELETE EXPIRED commands.
************************************************************************************************************************************************

原来是大批量的数据插入导致闪回空间不足, 最常用的办法删除不需要的归档日志文件或者增加闪回空间大小(db_recovery_file_dest_size)

查看闪回空间大小(db_recovery_file_dest_size)

SQL> show parameter db_recovery_file_dest_size

NAME                                 TYPE        VALUE
------------------------------------ ----------- -------------------
db_recovery_file_dest_size           big integer 4977M

查看 rman 设定

RMAN> show all;

RMAN configuration parameters for database with db_unique_name DAVID are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'g:\oracle\backup\%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'G:\APP\DAVIDD\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFDAVID.ORA'; # default

将备份策略改为基于冗余数量的备份策略

RMAN> configure retention policy to redundancy 5;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters for database with db_unique_name DAVID are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'g:\oracle\backup\%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'G:\APP\DAVIDD\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFDAVID.ORA'; # default

手动删除不需要的归档日志文件 (删除 3 天以前的日志记录)

rman> delete archivelog all completed before 'sysdate - 3'

另外一种方法, 增加 db_recovery_file_dest_size 大小

SQL> alter system set db_recovery_file_dest_size=2000M;

System altered.

SQL> show parameter db_recovery_file_dest_size

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest_size           big integer 2000M

最后打开数据库,成功

SQL> alter database open;

Database altered.

原文地址:https://blog.csdn.net/dataminer_2007/article/details/41775257


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!