Home » SQL & PL/SQL » SQL & PL/SQL » accessing dmp via external table. (oracle XE 10.2.0.1.0, on winXP OS)
- accessing dmp via external table. [message #518626] Fri, 05 August 2011 02:43 Go to next message
misragopal
Messages: 125
Registered: June 2005
Location: New Delhi, india
Senior Member

Hi, when i am writing dump from external table, it is accessing records from dump.but when i am trying to access other dumps(create thru expdp) it is giving error.the logic i am following is mentioned below-

CREATE OR REPLACE DIRECTORY "DIR_GMS" AS 'D:\Gopal_works\test_env_files'

GRANT READ ON DIRECTORY dir_gms TO gopal;
GRANT WRITE ON DIRECTORY dir_gms TO gopal;


-- creating dump file in directory
CREATE TABLE emp_ext
  ORGANIZATION EXTERNAL
   (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY dir_gms
     LOCATION ('emp_ext_dmp.dmp')
   )
   AS SELECT * FROM hr.employees;


CREATE TABLE emp_xt (
  EMPLOYEE_ID     NUMBER(5),
  FIRST_NAME     VARCHAR2(50),
  LAST_NAME       VARCHAR2(50))
  ORGANIZATION EXTERNAL (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY dir_gms
     LOCATION ('emp_ext_dmp.dmp')
  );

i am able to see records.

New point:
-- taking export thru expdb
expdp hr/hr tables=EMPLOYEES directory=DIR_GMS dumpfile=HR_EMP.dmp logfile=expdpEMP.log

then i created one EXTERNAL TABLE TO access it.
CREATE TABLE emp_xt (
  EMPLOYEE_ID     NUMBER(5),
  FIRST_NAME     VARCHAR2(50),
  LAST_NAME       VARCHAR2(50))
  ORGANIZATION EXTERNAL (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY dir_gms
     LOCATION ('HR_EMP.DMP')
  );

while accessing, it is giving error:
SELECT * FROM EMP_XT
  
ORA-29913: error IN executing ODCIEXTTABLEOPEN callout
ORA-31619: invalid DUMP FILE "D:\Gopal_works\test_env_files\HR_EMP.DMP"
ORA-06512: AT "SYS.ORACLE_DATAPUMP", line 19

you guys must face this problem earlier,Please suggest what i am doing wrong?

- Re: accessing dmp via external table. [message #518684 is a reply to message #518626] Fri, 05 August 2011 08:06 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
I see that your filenames do not match case.
- Re: accessing dmp via external table. [message #518692 is a reply to message #518684] Fri, 05 August 2011 08:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
In Windows this does not matter, I tried the same example in 10.2.0.4 (with proper case in names) and got the same error.
Found nothing on Metalink.
I never used datapump, if someone knows the answer...

By the way, I also tried to export with data_only and got the same error.

Regards
Michel

- Re: accessing dmp via external table. [message #518694 is a reply to message #518626] Fri, 05 August 2011 08:44 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3305
Registered: January 2010
Location: Connecticut, USA
Senior Member
Don't confuse access driver for TYPE ORACLE_DATAPUMP with EXPDP/IMPDP. Dump files produced by the two have different structure. To deal with EXPDP dump files from PL/SQL use DBMS_DATAPUMP package.

SY.

[Updated on: Fri, 05 August 2011 08:48]

Report message to a moderator

- Re: accessing dmp via external table. [message #518698 is a reply to message #518694] Fri, 05 August 2011 08:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Don't confuse access driver for TYPE ORACLE_DATAPUMP with EXPDP/IMPDP. Dump files produced by the two have different structure.

That was the information I missed, thanks.
What a silly idea to give the same name for 2 things that are incompatible.

Regards
Michel
- Re: accessing dmp via external table. [message #518699 is a reply to message #518698] Fri, 05 August 2011 09:02 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
However in http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm, it is said:
Quote:
Data Pump supports two access methods to load and unload table row data: direct path and external tables. Because both methods support the same external data representation, data that is unloaded with one method can be loaded using the other method.

And
Quote:
Data Pump provides an external tables access driver (ORACLE_DATAPUMP) that reads and writes files. The format of the files is the same format used with the direct path method.


Regards
Michel
- Re: accessing dmp via external table. [message #518701 is a reply to message #518698] Fri, 05 August 2011 09:03 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3305
Registered: January 2010
Location: Connecticut, USA
Senior Member
Michel Cadot wrote on Fri, 05 August 2011 09:53
What a silly idea to give the same name for 2 things that are incompatible.

yes & no. In general, datapump is interface. Oracle can use it to produce files of pretty-much any file structure. EXPDP is tool using datapump interface to produce export files of some proprietary structure. ORACLE_DATAPUMP is access driver using datapump interface to produce files external table structure.

SY.
- Re: accessing dmp via external table. [message #518714 is a reply to message #518701] Fri, 05 August 2011 10:43 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I think if something is misleading then it is wrong (just my opinion).
But the documentation does not agree with your assertion (which nevertheless explains what OP and I saw).

Regards
Michel
- Re: accessing dmp via external table. [message #518724 is a reply to message #518699] Fri, 05 August 2011 11:54 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3305
Registered: January 2010
Location: Connecticut, USA
Senior Member
Michel Cadot wrote on Fri, 05 August 2011 10:02
However in http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm, it is said:


The way I understand it:

Direct path and external table are two data access methods (BTW, there is a hidden undocumented parameter ACCESS_METHOD=EXTERNAL_TABLE/DIRECT_PATH to force one or the other) - it has nothing to do with dump file format. Internally ACCESS_METHOD=EXTERNAL_TABLE creates (behind the scenes) an external table that maps the dump file data for the database table. The SQL engine is then used to move the data. AFAIU ACCESS_METHOD=EXTERNAL_TABLE/DIRECT_PATH has nothing to do with access driver ORACLE_DATAPUMP.

SY.
- Re: accessing dmp via external table. [message #518725 is a reply to message #518724] Fri, 05 August 2011 12:39 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
OK but I think the second part said that the files have the same format with ORACLE_DATAPUMP driver and expdp, doesn't it?

Regards
Michel
- Re: accessing dmp via external table. [message #518731 is a reply to message #518725] Fri, 05 August 2011 13:55 Go to previous messageGo to next message
Solomon Yakobson
Messages: 3305
Registered: January 2010
Location: Connecticut, USA
Senior Member
Michel Cadot wrote on Fri, 05 August 2011 13:39
OK but I think the second part said that the files have the same format with ORACLE_DATAPUMP driver and expdp, doesn't it?


You miised the note:

Note:

When Data Pump uses external tables as the data access mechanism, it uses the ORACLE_DATAPUMP access driver. However, it is important to understand that the files that Data Pump creates when it uses external tables are not compatible with files created when you manually create an external table using the SQL CREATE TABLE ... ORGANIZATION EXTERNAL statement. One of the reasons for this is that a manually created external table unloads only data (no metadata), whereas Data Pump maintains both data and metadata information for all objects involved.

SY.
- Re: accessing dmp via external table. [message #518732 is a reply to message #518731] Fri, 05 August 2011 14:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Yes, I missed it, this puts an end to the discussion and gives a definitive answer.
However, the last part can be misleading "One of the reasons for this is that a manually created external table unloads only data (no metadata), whereas Data Pump maintains both data and metadata information for all objects involved" as it does not work even if I use content=data_only on expdp (note this is one of the reasons and not the only one).
I think I will open a SR to make Oracle remove this last part which adds nothing to the note.

Regards
Michel
- Re: accessing dmp via external table. [message #518733 is a reply to message #518732] Fri, 05 August 2011 14:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68760
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Too late! It was removed from 11.2 documentation, I think I wasd not the only one to think this.
http://download.oracle.com/docs/cd/E11882_01/server.112/e16536/dp_overview.htm#CJABAHDJ

Regards
Michel

[Updated on: Fri, 05 August 2011 14:40]

Report message to a moderator

- Re: accessing dmp via external table. [message #519377 is a reply to message #518733] Thu, 11 August 2011 09:51 Go to previous message
misragopal
Messages: 125
Registered: June 2005
Location: New Delhi, india
Senior Member

Thanks team, very vital information and well explained.
Now i understand.
Thanks you. Smile
Previous Topic: How can i pass output associative array of pl/sql to java?
Next Topic: Decode with between clause...
Goto Forum:
  


Current Time: Sat Jun 21 01:48:22 CDT 2025