05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

702<br />

CHAPTER 15 ■ DATA LOADING AND UNLOADING<br />

I purposely chose the ALL_OBJECTS view, because it is a quite complex view with lots of<br />

joins <strong>and</strong> predicates. This example shows we can use this Data Pump unload technique to<br />

extract arbitrary data from our database. We could add predicates, or whatever we wanted,<br />

to extract a slice of data.<br />

■Note This example shows we can use this Data Pump unload technique to extract arbitrary data from our<br />

database. Yes, that is repeated text. From a security perspective, this does make it rather easy for someone<br />

with access to the information to “take” the information elsewhere. You need to control access to the set of<br />

people who have the ability to create DIRECTORY objects <strong>and</strong> write to them, <strong>and</strong> who have the necessary<br />

access to the physical server to get the unloaded data.<br />

The final step would be to copy allobjects.dat onto another server, perhaps a development<br />

machine for testing with, <strong>and</strong> extract the DDL to re-create this table over there:<br />

ops$tkyte@ORA10GR1> select dbms_metadata.get_ddl( 'TABLE', 'ALL_OBJECTS_UNLOAD' )<br />

2 from dual;<br />

DBMS_METADATA.GET_DDL('TABLE','ALL_OBJECTS_UNLOAD')<br />

--------------------------------------------------------------------------------<br />

CREATE TABLE "OPS$TKYTE"."ALL_OBJECTS_UNLOAD"<br />

( "OWNER" VARCHAR2(30),<br />

"OBJECT_NAME" VARCHAR2(30),<br />

"SUBOBJECT_NAME" VARCHAR2(30),<br />

"OBJECT_ID" NUMBER,<br />

"DATA_OBJECT_ID" NUMBER,<br />

"OBJECT_TYPE" VARCHAR2(19),<br />

"CREATED" DATE,<br />

"LAST_DDL_TIME" DATE,<br />

"TIMESTAMP" VARCHAR2(19),<br />

"STATUS" VARCHAR2(7),<br />

"TEMPORARY" VARCHAR2(1),<br />

"GENERATED" VARCHAR2(1),<br />

"SECONDARY" VARCHAR2(1)<br />

)<br />

ORGANIZATION EXTERNAL<br />

( TYPE ORACLE_DATAPUMP<br />

DEFAULT DIRECTORY "TMP"<br />

)<br />

LOCATION<br />

( 'allobjects.dat'<br />

)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!