views:

32

answers:

0

Old approach for exporting/importing whole schema:

 exp user/pwdp@server FILE=export.dmp OWNER=user ROWS=Y
 imp newuser/pwd@server FULL=Y FILE=export.dmp

New approach:

 expdp user/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder 

However had a problem with importing:

 impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder

will not import anything:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31655: no data or metadata objects selected for job
ORA-39154: Objects from foreign schemas have been removed from import
Master table "NEWUSER"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "NEWUSER"."SYS_IMPORT_FULL_01":  newuser/********@server
DUMPFILE=export.dp DIRECTORY=exportfolder
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Job "NEWUSER"."SYS_IMPORT_FULL_01" successfully completed at 19:13:04

Adding schemas option will not help (result is same, oracle does not allow import non-owned objects):

impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder schemas=user

And only one working approach which I found:

impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder remap_schema=newuser:user

So the question is how to import schema data pump dump without knowledge which schema was exported?

(Of course I can look to first 512 bytes of export file and find string like "USER"."SYS_EXPORT_SCHEMA_01"), but may be exists another approach?