[英]How to export selected functions, selected procedures, selected views and selected tables only from oracle database using command line?
Suppose I want to export 假设我要导出
Tables named T1, T2 名为T1,T2的表
username : system 用户名:系统
So I fire command on CMD as follow, 所以我在CMD上执行以下命令
(1) expdp system/manager@DB3 directory=backupdir dumpfile=backup.dmp logfile=backup.log include=view:"IN ('V1','V2')", function:"IN ('f1','f2')", procedure:"IN ('p1','p2')", table:"IN ('T1','T2')" (1)expdp system / manager @ DB3目录= backupdir dumpfile = backup.dmp日志文件= backup.log include = view:“ IN('V1','V2')”,函数:“ IN('f1','f2 ')“,过程:” IN('p1','p2')“,表:” IN('T1','T2')“
(2) expdp system/manager@DB3 directory=backupdir dumpfile=backup.dmp logfile=backup.log include=view:"IN ('V1','V2')" include=function:"IN ('f1','f2')" include=procedure:"IN ('p1','p2')" include=table:"IN ('T1','T2')" (2)expdp system / manager @ DB3目录= backupdir dumpfile = backup.dmp日志文件= backup.log include = view:“ IN('V1','V2')” include = function:“ IN('f1',' f2')“ include = procedure:” IN('p1','p2')“ include = table:” IN('T1','T2')“
These both commands are not working: 这两个命令都不起作用:
Error : ORA-39071: Value for INCLUDE is badly formed.
错误:ORA-39071:INCLUDE的值格式错误。
Following command works but it exports specified Tables only. 以下命令有效,但仅导出指定的表。 It doesn't export views, procedures and functions.
它不导出视图,过程和功能。
(3) expdp system/manager@DB3 directory=backupdir dumpfile=backup.dmp logfile=backup.log include=view,procedure,function,table:"IN ('T1','T2')" (3)expdp system / manager @ DB3目录= backupdir dumpfile = backup.dmp logfile = backup.log include = view,procedure,function,table:“ IN('T1','T2')”
What to do? 该怎么办?
ORA-39071: Value for INCLUDE is badly formed
ORA-39071:包含值的格式错误
The command line doesn't like the quote marks. 命令行不喜欢引号。 There are two ways to handle this.
有两种方法可以解决此问题。
The first is to escape the quotes: 首先是转义引号:
expdp system/manager@DB3 directory=backupdir dumpfile=backup.dmp logfile=backup.log
include=view:\"IN (\'V1\',\'V2\')\" include=function:\"IN (\'f1\',\'f2\')\" include=procedure:\"IN (\'p1\',\'p2\')\" include=table:\"IN (\'T1\',\'T2\')\"
If that seems tedious (and it is) the second option would be to define a parameter file. 如果看上去很乏味(确实如此),第二个选择是定义一个参数文件。 You can include all your options in that, without escaping the quotes, and just run
expdp
with the PARFILE parameter. 您可以在其中包含所有选项,而不必使用引号,而只需使用PARFILE参数运行
expdp
。
There are no any changes in Schema 'DBpractice' in which I want to import the tables, views, functions and procedures that have been exported from schema named DB3.
我要导入从名为DB3的架构中导出的表,视图,函数和过程的架构“ DBpractice”中没有任何更改。
That's really a new question, but the solution is straightforward enough: you need to run impdp
with the REMAP_SCHEMA parameter which takes source_schema:target_schema
. 这确实是一个新问题,但是解决方案非常简单:您需要使用REMAP_SCHEMA参数运行
impdp
,该参数需要source_schema:target_schema
。 So in your case that would be 所以在你的情况下
impdp system/manager directory=backupdir dumpfile=backup.dmp remap_schema=db3:DBpractice
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.