温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

数据泵报错ORA-39149怎么办

发布时间:2021-11-09 16:32:25 来源:亿速云 阅读:558 作者:柒染 栏目:建站服务器

数据泵报错ORA-39149怎么办,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

在利用NETWORK_LINK方式导出的时候,出现了这个错误。

详细错误信息如下:

bash-3.00$ expdp yangtk/yangtk directory=d_temp dumpfile=jiangsu.dp network_link=test113 logfile=jiangsu.log tables=cat_org

Export: Release 11.1.0.6.0 - 64bit Production on 星期二, 16 9, 2008 17:08:22

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31631:
需要权限
ORA-39149:
无法将授权用户链接到非授权用户

检查Oracle的错误手册:

ORA-39149: 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.

错误描述的比较清楚,不过这个错误很难理解,难道一个权限大的用户不能通过数据库链导出一个权限小的用户。

当然,了解了这个错误的原因,其实问题很容易解决。在本地创建一个新用户,不要授权EXP_FULL_DATABASE/IMP_FULL_DATABASE角色,就可以导出:

bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期二 9 16 16:53:48 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> col grantee format a15
SQL> col granted_role format a15
SQL> select grantee, granted_role from dba_role_privs
  2  where grantee = 'YANGTK';

GRANTEE         GRANTED_ROLE
--------------- ---------------
YANGTK          CONNECT
YANGTK          RESOURCE
YANGTK          DBA

SQL> drop user test cascade;

用户已删除。

SQL> create user test identified by test
  2  default tablespace users
  3  quota unlimited on users;

用户已创建。

SQL> grant connect to test;

授权成功。

SQL> grant create table, create database link to test;

授权成功。

SQL> grant read, write on directory d_temp to test;

授权成功。

SQL> conn test/test
已连接。
SQL> create database link test113 connect to jiangsu identified by jiangsu
  2  using '172.0.2.113/test';

数据库链接已创建。

SQL> select * from global_name@test113;

GLOBAL_NAME
--------------------------------------------------------------------------------
TEST

SQL> exit
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
断开

使用这个用户就执行导出了:

bash-3.00$ expdp yangtk/yangtk directory=d_temp dumpfile=jiangsu.dp network_link=test113 logfile=jiangsu.log tables=cat_org

Export: Release 11.1.0.6.0 - 64bit Production on 星期二, 16 9, 2008 17:08:22

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31631:
需要权限
ORA-39149:
无法将授权用户链接到非授权用户

bash-3.00$ expdp test/test directory=d_temp dumpfile=jiangsu.dp network_link=test113 logfile=jiangsu.log tables=cat_org

Export: Release 11.1.0.6.0 - 64bit Production on 星期二, 16 9, 2008 17:09:10

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "TEST"."SYS_EXPORT_TABLE_01":  test/******** directory=d_temp dumpfile=jiangsu.dp network_link=test113 logfile=jiangsu.log tables=cat_org
正在使用 BLOCKS 方法进行估计...
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 6 MB
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 TABLE_EXPORT/TABLE/COMMENT
处理对象类型 TABLE_EXPORT/TABLE/TRIGGER
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. .
导出了 "JIANGSU"."CAT_ORG"                         4.390 MB   31827
已成功加载/卸载了主表 "TEST"."SYS_EXPORT_TABLE_01"
******************************************************************************
TEST.SYS_EXPORT_TABLE_01
的转储文件集为:
  /data/jiangsu.dp
作业 "TEST"."SYS_EXPORT_TABLE_01" 已于 17:09:57 成功完成

如果可以修改远端的用户,那么更简单,只需要给远端用户授权EXP_FULL_DATABASE角色就可以了:

-bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Sep 16 17:16:27 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

SQL> select global_name from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
TEST

SQL> grant exp_full_database to jiangsu;

Grant succeeded.

下面再次使用yangtk执行导出:

bash-3.00$ expdp yangtk/yangtk directory=d_temp dumpfile=jiangsu1.dp network_link=test113 logfile=jiangsu.log tables=cat_org

Export: Release 11.1.0.6.0 - 64bit Production on 星期二, 16 9, 2008 17:19:25

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "YANGTK"."SYS_EXPORT_TABLE_01":  yangtk/******** directory=d_temp dumpfile=jiangsu1.dp network_link=test113 logfile=jiangsu.log tables=cat_org
正在使用 BLOCKS 方法进行估计...
处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 6 MB
处理对象类型 TABLE_EXPORT/TABLE/TABLE
处理对象类型 TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/INDEX
处理对象类型 TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
处理对象类型 TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 TABLE_EXPORT/TABLE/COMMENT
处理对象类型 TABLE_EXPORT/TABLE/TRIGGER
处理对象类型 TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. .
导出了 "JIANGSU"."CAT_ORG"                         4.390 MB   31827
已成功加载/卸载了主表 "YANGTK"."SYS_EXPORT_TABLE_01"
******************************************************************************
YANGTK.SYS_EXPORT_TABLE_01
的转储文件集为:
  /data/jiangsu1.dp
作业 "YANGTK"."SYS_EXPORT_TABLE_01" 已于 17:19:45 成功完成

问题倒是很容易解决,只是不理解Oracle为什么处理不了这么简单的问题。而且关键的是,Oracle似乎没有把这个问题当作bug

 

关于数据泵报错ORA-39149怎么办问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI