OBJECT_ID與DATA_OBJECT_ID不一致,造成impdp導入[0 rows]



今天開發組的DBLINK環境發生一個奇怪的現象,一個分區表通過DBLINK進行數據插入時,

原表的近萬條數據沒有被插入就正常結束了。導入的結果是[0 rows] 正常結束。

在MOS上查了一下,這個現象,找到了下面的文檔

DataPump Expdp Or Impdp With NETWORK_LINK Returns No Rows Exported Or

Imported For Partitioned Table (Doc ID 1381419.1)


按文檔的說明,在Oracle11.2.0.1環境中,通過DBLINK實現impdp(expdp)時,由於

OBJECT_ID與DATA_OBJECT_ID不一致,造成這個分區的數據無法正常導出(導入)。


解決方法就是升級到11.2.0.2。


爲此,我做如下的實驗


--在主表側做一個實現用的表

SQL> create table test_tab

(

  deptno          number,

  deptname        varchar2(20),

  quarterly_sales number(10, 2),

  state           varchar2(2)

)

partition by list (state)

(

  partition northwest    values ('OR', 'WA'),

  partition southwest    values ('AZ', 'UT', 'NM'),

  partition northeast    values ('NY', 'VM', 'NJ'),

  partition southeast    values ('FL', 'GA'),

  partition northcentral values ('SD', 'WI'),

  partition southcentral values ('OK', 'TX')

);  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16


表が作成されました。


SQL> insert into test_tab values (11, 'support',   111, 'WA');


1行が作成されました。


SQL> commit;


コミットが完了しました。


SQL> insert into tab_test values (11, 'support',   111, 'WA');


1行が作成されました。


SQL> commit;


コミットが完了しました。


SQL> select owner,SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID, OBJECT_TYPE

 2  from   dba_objects

 3  where  object_name = 'TEST_TAB' and owner='CN31TEST';


OWNER      SUBOBJECT_NAME       OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE

---------- -------------------- --------- -------------- ---------------

CN31TEST                            82437                TABLE

CN31TEST   NORTHCENTRAL             82442          82442 TABLE PARTITION

CN31TEST   NORTHEAST                82440          82440 TABLE PARTITION

CN31TEST   NORTHWEST                82438          82468 TABLE PARTITION 

                 ★OBJECT_IDとDATA_OBJECT_IDが異なる環境

CN31TEST   SOUTHCENTRAL             82443          82443 TABLE PARTITION

CN31TEST   SOUTHEAST                82441          82441 TABLE PARTITION

CN31TEST   SOUTHWEST                82439          82439 TABLE PARTITION


7行が選択されました。


--在遠程庫做一個實驗用戶

SQL> create user cn31test identified by cn31;


User created.


SQL> grant connect, resource, CREATE DATABASE LINK, CREATE VIEW, CREATE MATERIALIZED

VIEW  to cn31test;


Grant succeeded.


--在遠程庫做一個DBLINK

SQL> conn cn31test/cn31

Connected.

SQL> create database link cn11 connect to cn31test identified by cn31 using 'TEST01';


Database link created.

--在遠程庫做一個相同結構的表

SQL> create table test_tab

(

  deptno          number,

  deptname        varchar2(20),

  quarterly_sales number(10, 2),

  state           varchar2(2)

)

partition by list (state)

(

  partition northwest    values ('OR', 'WA'),

  partition southwest    values ('AZ', 'UT', 'NM'),

  partition northeast    values ('NY', 'VM', 'NJ'),

  partition southeast    values ('FL', 'GA'),

  partition northcentral values ('SD', 'WI'),

  partition southcentral values ('OK', 'TX')

);  2    3    4    5    6    7    8    9   10   11   12   13   14   15   16


Table created.


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@localhost admin]$ impdp cn31test/cn31 content=data_only network_link=cn11

tables=test_tab:northwest


Import: Release 11.2.0.4.0 - Production on Tue Mar 4 10:16:01 2014


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

Starting "CN31TEST"."SYS_IMPORT_TABLE_01":  cn31test/******** content=data_only

network_link=cn11


tables=test_tab:northwest

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

. . imported "CN31TEST"."TEST_TAB":"NORTHWEST"                0 rows ★錯誤發生

Job "CN31TEST"."SYS_IMPORT_TABLE_01" successfully completed at Tue Mar 4 10:16:21

2014 elapsed 0 00:00:19


--再次追加一條新的記錄

SQL> insert into test_tab values (20, 'technical', 200, 'NM');


1行が作成されました。


SQL> commit;


--導入實驗

[oracle@localhost admin]$ impdp cn31test/cn31 content=data_only network_link=cn11

tables=test_tab:southwest


Import: Release 11.2.0.4.0 - Production on Tue Mar 4 10:18:07 2014


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

Starting "CN31TEST"."SYS_IMPORT_TABLE_01":  cn31test/******** content=data_only

network_link=cn11


tables=test_tab:southwest

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

. . imported "CN31TEST"."TEST_TAB":"SOUTHWEST"                1 rows

Job "CN31TEST"."SYS_IMPORT_TABLE_01" successfully completed at Tue Mar 4 10:18:14

2014 elapsed 0 00:00:06


--主表側

SQL> col DEPTNAME for a15

SQL> select * from cn31test.test_tab;


   DEPTNO DEPTNAME        QUARTERLY_SALES STATE

---------- --------------- --------------- ------

       11 support                     111 WA

       20 technical                   200 NM


--遠程庫

[oracle@localhost admin]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 4 10:32:53 2014


Copyright (c) 1982, 2013, Oracle.  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


SQL> select * from cn31test.test_tab;


   DEPTNO DEPTNAME             QUARTERLY_SALES ST

---------- -------------------- --------------- --

       20 technical                        200 NM


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章