导出/导入整个架构的旧方法:
exp user/pwdp@server FILE=export.dmp OWNER=user ROWS=Y
imp newuser/pwd@server FULL=Y FILE=export.dmp
新的方法:
expdp user/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder
但是在导入时遇到了问题:
impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder
不会导入任何东西:
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
添加 schemas 选项将无济于事(结果相同,oracle 不允许导入非拥有对象):
impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder schemas=user
我发现只有一种工作方法:
impdp newuser/pwdp@server DUMPFILE=export.dp DIRECTORY=exportfolder remap_schema=newuser:user
所以问题是如何在不知道导出哪个模式的情况下导入模式数据泵转储?
(当然我可以查看导出文件的前 512 个字节并找到类似“USER”的字符串。“SYS_EXPORT_SCHEMA_01”),但可能存在另一种方法吗?