12c introduced a new feature for datapump which allowed you to extract a 'view' as if it were a table and then take this off somewhere else to import as a 'table'.
Very nice.
However you can kind of do it (though not so elegantly) in earlier versions using datapump/external tables - here's how..... (and note i did the test in 12c as thats what i had to hand - but the process works fine in 10g and 11g)
In the example below I'm adding a couple of dummy columns to a select from a table - but the SQL query could be anything you like here - i just kept the example simple.
First up we create a very basic table and insert one row (1 row is enough to illustrate the point...)
SQL> create table dummytable (col1 number,col2 number);
ORGANIZATION EXTERNAL
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY data_pump_dir
LOCATION ( 'demo.dmp' )
)
AS
SELECT 1 as newcol1, 'A' as newcol2, col1,col2
FROM dummytable;
I then extract the table ddl for later use.
SQL> /
--------------------------------------------------------------------------------
( "NEWCOL1" NUMBER,
"NEWCOL2" CHAR(1),
"COL1" NUMBER,
"COL2" NUMBER
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY "DATA_PUMP_DIR"
LOCATION
( 'demo.dmp'
)
)
A quick ls reveals the dumpfile is created
/oracle/12.1.0.2/rdbms/log/demo.dmp
I drop the original table and the external table now
Note the dumpfile remains intact.
/oracle/12.1.0.2/rdbms/log/demo.dmp
I then recreate the external table definition pointing at the previously created file
2 ( "NEWCOL1" NUMBER,
3 "NEWCOL2" CHAR(1),
4 "COL1" NUMBER,
5 "COL2" NUMBER
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY "DATA_PUMP_DIR"
6 7 8 9 10 LOCATION
( 'demo.dmp'
)
)
11 12 13 14 ;
I then create a 'real' table from the external table dumpfile.
I can now describe it showing the extra columns
Name Null? Type
----------------------------------------- -------- ----------------------------
NEWCOL1 NUMBER
NEWCOL2 CHAR(1)
COL1 NUMBER
COL2 NUMBER
And a quick select shows the table is there
---------- - ---------- ----------
1 A 1 2
This is probably not that useful as the dumpfile is only useful to map an external table definition on top of - the file cannot just be loaded directly with impdp.
It's a pity there is no sql unloader which works in the same way and would just create a csv directly - this surely is not that hard to create and would be very useful - rather than using sqlplus or utl_file to create files.
jetasuff_so_1992 Amanda Rivers https://marketplace.visualstudio.com/items?itemName=orsater-be.Dealey-Plaza-Paintball-gratuita
ReplyDeletejuncrogegen
MapbromKaddzu1980 Wendy Hunter https://www.controllerp.com/profile/likenesslikeness/profile
ReplyDeletetamawilwe
contlimyo_sa1980 Stacy Cordova link
ReplyDeleteclick here
link
https://colab.research.google.com/drive/1n-YdnBQtcvCi0elqwPOluEXxGnvZD9tG
erroracna
pulchflocrac-ra Frankie Verga Click here
ReplyDeleteCheck
Install
lmenathavkom