导入一个大表过程中,报错如下:
ORA-00257: archiver error. Connect internal only, until freed. (DBD ERROR: OCISessionBegin)
原因是imp产生的大量归档日志导致快速恢复区满了,需要增大快速恢复区或者删除归档,具体操作如下:
1、查看快速恢复区相关参数:
SQL> show parameter db_recovery;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +FRA
db_recovery_file_dest_size big integer 4182M
可以看到快速恢复区位于FRA磁盘组,大小为4G。
2、查看快速恢复区使用情况
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILE
-------------------- ------------------ ------------------------- --------------
CONTROL FILE .1 0
REDO LOG 2.48 0
ARCHIVED LOG 65.41 0 10
BACKUP PIECE 3.06 0
IMAGE COPY 27.67 0 1
FLASHBACK LOG 0 0
FOREIGN ARCHIVED LOG 0 0
7 rows selected.
SQL> select sum(percent_space_used) from v$flash_recovery_area_usage;
SUM(PERCENT_SPACE_USED)
-----------------------
99.3
可以看到快速恢复区已经使用了99.3%,其中归档日志使用65%。
3、查看FRA的大小
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 4194304 20472 6772 0 6772 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 10236 5410 0 5410 0 N FRA/
可以看到FRA磁盘组为10G,将快速恢复区设置为10G。
SQL> alter system set db_recovery_file_dest_size=10G;
System altered.
增大快速恢复区后,imp继续,不过一会又提示ORA-00257,没办法了,只能删除归档了。
4、删除归档
[oracle@linuxserver ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 18 17:55:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: STONE (DBID=2987622029)
RMAN> delete archivelog all ;
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 18 17:55:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: STONE (DBID=2987622029)
RMAN> delete archivelog all ;
由于我是测试环境,故删除了全部归档,生产环境请慎重。
SQL> select sum(PERCENT_SPACE_USED) from v$flash_recovery_area_usage;
SUM(PERCENT_SPACE_USED)
-----------------------
36.14
再次查看快速恢复区,使用率降到了36%,imp又恢复导入了。
如果在导入的过程中,再次出现ORA-00257,就只能再次删除归档。
总结一下,使用IMP导入大表建议如下:
(1)将数据库修改为非归档模式
(2)增大数据库内存,因为在导入过程中会占用大量内存,会出现ASM实例被关闭的情况。
[grid@linuxserver ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 18 17:45:41 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 1245194
Additional information: 1619001344
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 18 17:45:41 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 1245194
Additional information: 1619001344