溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

數(shù)據(jù)泵報錯ORA-39149怎么辦

發(fā)布時間:2021-11-09 16:32:25 來源:億速云 閱讀:605 作者:柒染 欄目:建站服務器

數(shù)據(jù)泵報錯ORA-39149怎么辦,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

在利用NETWORK_LINK方式導出的時候,出現(xiàn)了這個錯誤。

詳細錯誤信息如下:

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.

錯誤描述的比較清楚,不過這個錯誤很難理解,難道一個權限大的用戶不能通過數(shù)據(jù)庫鏈導出一個權限小的用戶。

當然,了解了這個錯誤的原因,其實問題很容易解決。在本地創(chuàng)建一個新用戶,不要授權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;

用戶已創(chuàng)建。

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';

數(shù)據(jù)庫鏈接已創(chuàng)建。

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
斷開

使用這個用戶就執(zhí)行導出了:

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
作業(yè) "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執(zhí)行導出:

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
作業(yè) "YANGTK"."SYS_EXPORT_TABLE_01" 已于 17:19:45 成功完成

問題倒是很容易解決,只是不理解Oracle為什么處理不了這么簡單的問題。而且關鍵的是,Oracle似乎沒有把這個問題當作bug。

 

關于數(shù)據(jù)泵報錯ORA-39149怎么辦問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業(yè)資訊頻道了解更多相關知識。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI