expdp在oracle 9.0里能用吗 oracle expdp导出数据需要什么权限

oracle\u6570\u636e\u6cf5 expdp\u80fd\u76f4\u63a5\u4f7f\u7528\u5417

1\u3001exp\u548cimp\u662f\u5ba2\u6237\u7aef\u5de5\u5177\u7a0b\u5e8f\uff0c\u5b83\u4eec\u65e2\u53ef\u4ee5\u5728\u5ba2\u6237\u7aef\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u5728\u670d\u52a1\u7aef\u4f7f\u7528\u3002
2\u3001expdp\u548cimpdp\u662f\u670d\u52a1\u7aef\u7684\u5de5\u5177\u7a0b\u5e8f\uff0c\u4ed6\u4eec\u53ea\u80fd\u5728oracle\u670d\u52a1\u7aef\u4f7f\u7528\uff0c\u4e0d\u80fd\u5728\u5ba2\u6237\u7aef\u4f7f\u7528\u3002
3\u3001imp\u53ea\u9002\u7528\u4e8eexp\u5bfc\u51fa\u7684\u6587\u4ef6\uff0c\u4e0d\u9002\u7528\u4e8eexpdp\u5bfc\u51fa\u6587\u4ef6\uff1bimpdp\u53ea\u9002\u7528\u4e8eexpdp\u5bfc\u51fa\u7684\u6587\u4ef6\uff0c\u800c\u4e0d\u9002\u7528\u4e8eexp\u5bfc\u51fa\u6587\u4ef6\u3002
4\u3001\u5bf9\u4e8e10g\u4ee5\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u4f7f\u7528exp\u901a\u5e38\u4e0d\u80fd\u5bfc\u51fa0\u884c\u6570\u636e\u7684\u7a7a\u8868\uff0c\u800c\u6b64\u65f6\u5fc5\u987b\u4f7f\u7528expdp\u5bfc\u51fa\u3002

resource\u548cconnect\u6743\u9650\uff0c\u5c31\u80fd\u5bfc\u51fa\u672c\u7528\u6237\u4e0b\u7684\u6570\u636e\uff1b
\u5982\u679c\u6709exp_full_database\u6743\u9650\uff0c\u80fd\u5bfc\u51fa\u6574\u4e2a\u6570\u636e\u5e93\u7684\u6570\u636e\uff1b

  expdp/impdp是10g推出的导入导出工具,9i下是没有该工具的,有人提议用10g的expdp,通过dblink导出9i的数据,乍一听感觉是那么回事,但究竟行不行,咱们实验说明。
  1. 登录到一台10g/11g的服务器,首先创建连接到9i库TEST的一个链接tlink:
  SQL> create database link tlink connect to test identified by test using 'TEST';Database link created.
  2. 编辑expdp导出的配置文件:
  userid=user/pwd- expdp使用的本机数据库用户directory=expdp_dir- directory路径
  dumpfile=testtkt.dump
  logfile=testtkt.log
  tables=test.t_r- 要导出的9i库表t_r
  network_link=tlink- 链接到的9i库dblink
  3. 执行expdp:
  [oracle11g@Node1 expdp_dir]$ expdp parfile=tlink.parExport: Release 11.2.0.1.0 - Production on Mon May 18 13:35:57 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
  Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsORA-39006: internal error
  ORA-39065: unexpected master process exception in DISPATCHORA-00904: "SYS"."KUPM$MCP"."GET_ENDIANNESS": invalid identifierORA-39097: Data Pump job encountered unexpected error -904提示一系列ORA错误。
  expdp不像exp,他是将导出转变成一个Oracle内部的job任务,有一点可以证明,就是使用exp导出时用ctrl+c中断,此时导出过程整体中断,如果使用expdp导出时用ctrl+c中断,此时导出过程并未中断,因为其已经转变为Oracle的一个任务,和客户端无关,退出交互模式后,会进入export的命令行模式,有status、start、stop等命令可以用。
  从上面的报错可以看到ORA-00904: "SYS"."KUPM$MCP"."GET_ENDIANNESS": invalid identifier,关于904的错误描述:
  [oracle11g@Node1 expdp_dir]$ oerr ora 90400904, 00000, "%s: invalid identifier"
  // *Cause:
  // *Action:
  说明是找不到对应的标识符,再看看SYS.KUPM$MCP大概是什么:
  SQL> desc sys.KUPM$MCP;
  PROCEDURE CLOSE_JOB
  FUNCTION DISPATCH RETURNS KUPC$_MESSAGE
  Argument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------REQUEST KUPC$_MESSAGE INPROCEDURE FILE_LOG_MESSAGE
  Argument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------ERRCODE NUMBER INPARAMETER1 VARCHAR2 IN DEFAULTPARAMETER2 VARCHAR2 IN DEFAULTPARAMETER3 VARCHAR2 IN DEFAULTPARAMETER4 VARCHAR2 IN DEFAULTPARAMETER5 VARCHAR2 IN DEFAULTPARAMETER6 VARCHAR2 IN DEFAULTPARAMETER7 VARCHAR2 IN DEFAULTPARAMETER8 VARCHAR2 IN DEFAULTPROCEDURE FILE_TO_WORKER
  Argument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------MESSAGE KUPC$_MESSAGE IN FUNCTION GET_ENDIANNESS RETURNS NUMBER PROCEDURE MAINArgument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------JOB_NAME VARCHAR2 INJOB_OWNER VARCHAR2 INRESTART_JOB BINARY_INTEGER INDEBUG_INFO BINARY_INTEGER INPROCEDURE MAINLOOP
  PROCEDURE SET_DEBUG
  Argument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------DEBUG_FLAGS BINARY_INTEGER INFUNCTION VALIDATE_EXPRESSION RETURNS NUMBERArgument Name Type In/Out Default?
  ------------------------------ ----------------------- ------ --------EXPR_VALUE VARCHAR2 IN其实他包含了若干函数,GET_ENDIANNESS是其中一个(从名称上看,貌似是获得“大小端信息”),显然是没找到对应函数,忘了从什么地方看到过关于这个函数的描述(如果哪位高人记得,可以回复下),他在9i中是不存在的,可以证明expdp导出过程是需要调用这个函数的,但这个函数在9i中是没有定义的,因此9i下是不能使用expdp。
  4. 我们接着看dblink导出10g以上版本的库
  SQL> create database link ldplink connect to puser identified by puser_pwd using 'link_10g';Database link created.
  5. 编辑expdp配置文件:
  [oracle11g@Node1 expdp_dir]$ vi link_10g.paruserid=user/pwd
  directory=expdp_dir
  dumpfile=link_10g.dump
  logfile=link_10g.log
  tables=puser.l_r
  network_link=link_10g
  6. 执行expdp:
  [oracle11g@Node1 expdp_dir]$ expdp parfile=link_10g.parExport: Release 11.2.0.1.0 - Production on Mon May 18 13:40:45 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
  Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsORA-31631: privileges are required
  ORA-39149: cannot link privileged user to non-privileged user这回又提示ORA-31631和ORA-39149两个错误。
  [oracle11g@Node1 expdp_dir]$ oerr ora 3163131631, 00000, "privileges are required"
  // *Cause: The necessary privileges are not available for operations such// as: restarting a job on behalf of another owner, using a device// as a member of the dump file set, or ommiting a directory// object associated with any of the various output files.
  // Refer to any following error messages for additional information.
  // *Action: Select a different job to restart, try a different operation, or// contact a database administrator to acquire the needed privileges.
  提示是缺少权限。
  [oracle11g@Node1 expdp_dir]$ oerr ora 3914939149, 00000, "cannot link privileged user to non-privileged user"// *Cause: A Data Pump job initiated be a user with// EXPORT_FULL_DATABASE/IMPORT_FULL_DATABASE roles specified a// network link that did not correspond to a user with// equivalent roles on the remote database.
  // *Action: Specify a network link that maps users to identically privileged// users in the remote database.
  这个错误提示的更加明确,提示使用dblink并且具有EXPORT_FULL_DATABASE/IMPORT_FULL_DATABASE角色的执行用户,对应远端的用户并没有相应的角色权限。有点绕,简单讲,就是我这里使用expdp的数据库用户user,是有DBA权限的,因此具有EXPORT_FULL_DATABASE/IMPORT_FULL_DATABASE角色权限,但远端数据库用户puser只是普通用户,没有此权限,因此有这个提示错误。
  解决方案1:
  远端库中设置:
  SQL> grant exp_full_database to puser;
  Grant succeeded.
  再次执行expdp:
  [oracle11g@Node1 expdp_dir]$ expdp parfile=link_10g.parExport: Release 11.2.0.1.0 - Production on Mon May 18 13:51:37 2015Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
  Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsStarting "USER"."SYS_EXPORT_TABLE_01": user/******** parfile=link_10g.parEstimate in progress using BLOCKS method...
  Processing object type TABLE_EXPORT/TABLE/TABLE_DATATotal estimation using BLOCKS method: 64 KBProcessing object type TABLE_EXPORT/TABLE/TABLEProcessing object type TABLE_EXPORT/TABLE/INDEX/INDEXProcessing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINTProcessing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICSProcessing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS. . exported "PUSER"."L_R" 20.49 KB 28 rowsMaster table "BISAL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded******************************************************************************Dump file set for USER.SYS_EXPORT_TABLE_01 is:
  /home/oracle11g/expdp_dir/link_10g.dump
  Job "USER"."SYS_EXPORT_TABLE_01" successfully completed at 13:51:56解决方案2:
  杨长老的这篇博文(http//blog.itpub.net/4227/viewspace-448665/)说明了此问题。对于这个问题,还有种方法,就是新建一个本地用户,不授予EXPORT_FULL_DATABASE/IMPORT_FULL_DATABASE角色。
  总结:
  1. 9i是不支持expdp的,即使从10g的expdp使用dblink连到9i,也是不行的,从上述实验可以看到,有些expdp使用的函数是在9i中没有定义的。
  2. 使用dblink方式的expdp导出,要求要么本地用户没有EXPORT_FULL_DATABASE/IMPORT_FULL_DATABASE角色,要么本地用户有这两个角色,但此时要求远端用户有EXPORT_FULL_DATABASE角色,否则就会提示ORA-31631和ORA-39149这两个错误。

不能,expdp方式导出数据,是在oracle 10g时出现的。

扩展阅读:expdp exclude ... expdp ora29283 ... oracle explain ... oracle expdp命令详解 ... oracle expdp1033 ... oracle regexp ... oracle update ... dpe express ... oracle impdp ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网