简体   繁体   English

如何仅使用命令行从oracle数据库导出选定的函数,选定的过程,选定的视图和选定的表?

[英]How to export selected functions, selected procedures, selected views and selected tables only from oracle database using command line?

Suppose I want to export 假设我要导出

  • Views named V1, V2 名为V1,V2的视图
  • Functions named f1, f2 名为f1,f2的函数
  • Procedures named p1, p2 名为p1,p2的过程
  • Tables named T1, T2 名为T1,T2的表

  • username : system 用户名:系统

  • password : manager sid / 密码:管理员sid /
  • schema : DB3 模式:DB3

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.

相关问题 如何从Oracle数据库备份选定的过程或函数 - How I can take backup of selected Procedures or Functions from Oracle database 仅联接选定的表 - Join only selected tables 如何从HTML下拉列表中的选定选项更新/插入Oracle数据库? - How to Update/Insert Into Oracle Database From Selected Option in HTML Dropdown? 如何使用Ant仅将OSB(Eclipse工作区)中的选定资源导出到sbconfig.jar中? - How to export only selected resources from OSB (Eclipse workspace) into sbconfig.jar using Ant? Oracle 无法使用从远程表中选择的 LOB 定位器 - Oracle cannot use LOB locators selected from remote tables 如何联接三个表并从三个表中以及在oracle中检索选定的列? - how to join three tables and retrieve selected columns from the three tables and in oracle? 如何将一个oracle数据库表中选中的数据列实时插入到另一个oracle数据库表中 - How to insert the selected data columns from one oracle database table into another oracle database table in real time 脚本化Oracle数据库:选定模式中的所有对象 - Scripting Oracle database : all objects from selected schemas 更新通过联接在Oracle数据库中选择的行 - Update rows selected by join in Oracle database Oracle数据库。 如何更新选定的列。 - Oracle database. How to update selected columns.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM