IMPDP 时遇 ORA-31623、ORA-06512 错误解决一例

今天将一个测试库中的数据导到另一个测试库中,遇到了ORA-31623和ORA-06512错误,以下是大致过程的记录:

源库为10.2.0.3 64bit,目标库为新装的11.2.0.4 64bit,采用expdp方式开4个并行,并按schema的方式来导出数据,语句为:


expdp system/oracle parallel=4 directory=exppump dumpfile=sisver_20150831_%u.DMP schemas=sc1,sc2 logfile=expdp_sisver_20150831.log

 

导出没有什么问题,16g左右的数据大概在10分钟完成,然后将生成的4个DMP文件ftp到目标端,再通过IMPDP导入,以下是导入语句:


impdp system/oracle parallel=4 remap_schema=sc1:sc1new,sc2:sc2new directory=impdppump remap_tablespace=sc1tbs:sc1newtbs,sc2tbs:sc2newtbs dumpfile=sisver_20150831_%u.DMP full=y cluster=no logfile=impdp_sisver_20150831.log

 

导入前还做好了准备工作,如:在测试库建好相应的表空间和用户,设置用户权限、设置用户默认表空间、分配对默认表空间的quota等,当然其实只要创建表空间就可以了,因为使用remap_schema时会自动创建相应用户。


当在目标端进行导入的时候,就遇到了点问题:
Import: Release 11.2.0.4.0 - Production on Mon Aug 31 13:10:00 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

UDI-31623: operation generated ORACLE error 31623
ORA-31623: a job is not attached to this session via the specified handle
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3326
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4551
ORA-06512: at line 1

 

开始以为是版本的问题,因为源端是10g的库,而目标端是11g的库,但其实只有在exp方式导出的时候可能需要考虑加上version参数导出,expdp是不需要的
然后又想到是不是因为system用户是否对directory没有权限,但对相应的directory加上read,write权限后,依然报相同的错,于是查看了一下alert日志:

 

[oracle@sisdb:~]tail -100f /oracle/diag/rdbms/siststdb/siststdb/trace/alert_siststdb.log

Mon Aug 31 13:01:37 2015
Errors in file /oracle/diag/rdbms/siststdb/siststdb/trace/siststdb_ora_43843686.trc  (incident=36272):
ORA-04031: unable to allocate 56 bytes of shared memory ("streams pool","unknown object","streams pool","fixed allocation callback")
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Aug 31 13:01:40 2015
Sweep [inc][36272]: completed
Mon Aug 31 13:01:51 2015
Errors in file /oracle/diag/rdbms/siststdb/siststdb/trace/siststdb_ora_43843690.trc  (incident=48001):
ORA-04031: unable to allocate 56 bytes of shared memory ("streams pool","unknown object","streams pool","fixed allocation callback")
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Aug 31 13:02:20 2015
Errors in file /oracle/diag/rdbms/siststdb/siststdb/trace/siststdb_ora_327938.trc  (incident=48002):
ORA-04031: unable to allocate 56 bytes of shared memory ("streams pool","unknown object","streams pool","fixed allocation callback")
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Aug 31 13:02:40 2015
Sweep [inc][48002]: completed
Sweep [inc][48001]: completed
Mon Aug 31 13:10:00 2015
Errors in file /oracle/diag/rdbms/siststdb/siststdb/trace/siststdb_ora_42205274.trc  (incident=36281):
ORA-04031: unable to allocate 56 bytes of shared memory ("streams pool","unknown object","streams pool","fixed allocation callback")
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Aug 31 13:10:01 2015
Sweep [inc][36281]: completed

 

在alert日志中发现,在执行IMPDP导入的时候,数据库报了ORA-04031的错误,我们都知道这是和SGA内存相关的一个报错,而且后面很清楚的提示了是由于SGA中的一个组件“stream pool”出现了内存不足,使用IMPDP竟然还会用到流池,这个是我没有想到的,一直以为只有用sream和AQ技术时才会使用到流池,那么再来看一下流池的大小:

 

SQL> set line 200 pages 200
SQL> select * from v$sgainfo;

NAME                                  BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size                      2263488 No
Redo Buffers                        9707520 No
Buffer Cache Size                 134217728 Yes
Shared Pool Size                  436207616 Yes
Large Pool Size                           0 Yes
Java Pool Size                     16777216 Yes
Streams Pool Size                         0 Yes
Shared IO Pool Size                       0 Yes
Granule Size                       16777216 No
Maximum SGA Size                 8551575552 No
Startup overhead in Shared Pool   363476736 No
Free SGA Memory Available        7952400384

 

由于这个库安装的时候只设置了MEMORY_MAX_TARGET=9G,而未设置SGA_TARGET(即,SGA_TARGET=0,不采用10g的内存自动管理)和MEMORY_TARGET的值(即,也未采用了11g的ASMM方式),因此流池默认大小也是0

 

SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 9G
memory_target                        big integer 0
shared_memory_address                integer     0

SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 8G
sga_target                           big integer 0

SQL>  select name,issys_modifiable from v$parameter where name like '%pool%';

NAME                                                                             ISSYS_MOD
-------------------------------------------------------------------------------- ---------
shared_pool_size                                                                 IMMEDIATE
large_pool_size                                                                  IMMEDIATE
java_pool_size                                                                   IMMEDIATE
streams_pool_size                                                                IMMEDIATE
shared_pool_reserved_size                                                        FALSE
buffer_pool_keep                                                                 FALSE
buffer_pool_recycle                                                              FALSE
global_context_pool_size                                                         FALSE
olap_page_pool_size                                                              DEFERRED

SQL>

 

可以看到,streams_pool_size的issys_modifiable的值是“IMMEDIATE”,说明是动态参数(无须重启数据库生效),那么就手动分配给它一个值,我给了100M

 

SQL> alter system set streams_pool_size=100m scope=both;

System altered.

SQL> select * from v$sgainfo;

NAME                                  BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size                      2263488 No
Redo Buffers                        9707520 No
Buffer Cache Size                 134217728 Yes
Shared Pool Size                  436207616 Yes
Large Pool Size                           0 Yes
Java Pool Size                     16777216 Yes
Streams Pool Size                 117440512 Yes
Shared IO Pool Size                       0 Yes
Granule Size                       16777216 No
Maximum SGA Size                 8551575552 No
Startup overhead in Shared Pool   363476736 No
Free SGA Memory Available        7834959872

SQL>

 

现在再来试一下刚才的导入命令,发现已经可以顺利执行下去了

 

[oracle@sisdb:~]impdp system/oracle parallel=4remap_schema=sc1:sc1new,sc2:sc2newdirectory=impdppumpremap_tablespace=sc1tbs:sc1newtbs,sc2tbs:sc2newtbsdumpfile=sisver_20150831_%u.DMP full=y cluster=no logfile=impdp_sisver_20150831.log

Import: Release 11.2.0.4.0 - Production on Mon Aug 31 13:32:07 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** parallel=4 remap_schema=cpibusi:cpibusitst,picsbusi:picsbusitst directory=impdppump remap_tablespace=CPIDATATBS:cpibusitsttbs,PICSDATATBS:picsbusitsttbs dumpfile=ccicver_20150831_%u.DMP full=y cluster=no logfile=impdp_ccicver_20150831.log
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"PICSBUSITST" already exists  --由于是先创建了用户才执行的IMPDP导入,因此可以忽略
ORA-31684: Object type USER:"CPIBUSITST" already exists

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SC1NEW"."T_CPIMAIN_EXTEND"            604.1 MB  289303 rows
. . imported "SC1NEW"."T_CPIPROFIT_DETAIL"          316.8 MB 2286932 rows
......(略)


由于11g中加强了DATA PUMP在告警日志中的信息,此时继续跟踪alert日志可以发现,当增加了sreams pool的内存后,成功启动了DM进程,开始进行导入操作了:

 

Mon Aug 31 13:31:13 2015
ALTER SYSTEM SET streams_pool_size='100M' SCOPE=BOTH;
Mon Aug 31 13:32:08 2015
DM00 started with pid=37, OS id=50593928, job SYSTEM.SYS_IMPORT_FULL_01
Mon Aug 31 13:32:09 2015
DW00 started with pid=38, OS id=31654248, wid=1, job SYSTEM.SYS_IMPORT_FULL_01
Mon Aug 31 13:32:18 2015
DW01 started with pid=39, OS id=19071422, wid=2, job SYSTEM.SYS_IMPORT_FULL_01
Mon Aug 31 13:32:18 2015
DW02 started with pid=40, OS id=40501314, wid=3, job SYSTEM.SYS_IMPORT_FULL_01
Mon Aug 31 13:32:18 2015
DW03 started with pid=41, OS id=29163926, wid=4, job SYSTEM.SYS_IMPORT_FULL_01
XDB installed.
XDB initialized.
Mon Aug 31 13:32:22 2015
Thread 1 advanced to log sequence 10 (LGWR switch)
  Current log# 1 seq# 10 mem# 0: /oradata/siststdb/redo01.log
Mon Aug 31 13:32:27 2015
Archived Log entry 2 added for thread 1 sequence 9 ID 0xffffffff80ef0332 dest 1:
Thread 1 cannot allocate new log, sequence 11
Private strand flush not complete
  Current log# 1 seq# 10 mem# 0: /oradata/siststdb/redo01.log
Thread 1 advanced to log sequence 11 (LGWR switch)
  Current log# 2 seq# 11 mem# 0: /oradata/siststdb/redo02.log
Mon Aug 31 13:32:30 2015
Archived Log entry 3 added for thread 1 sequence 10 ID 0xffffffff80ef0332 dest 1:
Mon Aug 31 13:32:38 2015

 

最后用了13分钟左右,完成了sc1new和sc2new这2个schema的导入,最后来看一下导入结果

 

SQL> select owner,tablespace_name,round(sum(bytes/1024/1024/1024),2) "Size(Gb)" from dba_segments where owner in ('SC1NEW','SC2NEW ') group by owner,tablespace_name;

OWNER                          TABLESPACE_NAME                  Size(Gb)
------------------------------ ------------------------------ ----------
SC1NEW                         SC1NEWTBS                       15.39
SC2NEW                         SC2NEWTBS                       1.09

可以看到,16g的数据都已经导入了目标端的测试环境,任务顺利完成。

你可能感兴趣的:(oracle,Stream,size,impdp,pool,ORA-31623,ora-06512)