1. 程式人生 > >Oracle Data Pump 工具系列:Data Pump 許可權配置相關錯誤及解決辦法彙總

Oracle Data Pump 工具系列:Data Pump 許可權配置相關錯誤及解決辦法彙總

與 Data Pump 許可權相關的錯誤及解決辦法:


示例語句:
> expdp scott/tiger DIRECTORY=my_dir DUMPFILE=exp_s.dmp \ 
LOGFILE=exp_s.log SCHEMAS=scott


錯誤1:
UDE-00008: operation generated ORACLE error 1045 
ORA-01045: user SCOTT lacks CREATE SESSION privilege; logon denied


解決方案: 授予執行該 export 作業的使用者 CREATE SESSION 許可權,或者授予執行該 export job 的使用者所授予的 expdp_role 角色 CREATE SESSION 許可權:
 
GRANT create session TO scott; 
-- or: 
GRANT create session TO expdp_role;


錯誤2:Master table 相關


ORA-31626: job does not exist 
ORA-31633: unable to create master table "SCOTT.SYS_EXPORT_SCHEMA_01" 
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 
ORA-06512: at "SYS.KUPV$FT", line 863 
ORA-01031: insufficient privileges


解決方案:
GRANT create table TO scott; 
-- or: 
GRANT create table TO expdp_role;


錯誤3:Directory 相關


ORA-39002: invalid operation 
ORA-39070: Unable to open the log file. 
ORA-39087: directory name MY_DIR is invalid
 
ORA-39001: invalid argument value 
ORA-39000: bad dump file specification 
ORA-39087: directory name MY_DIR is invalid
 
ORA-39002: invalid operation 
ORA-39070: Unable to open the log file. 
ORA-31631: privileges are required
 
ORA-39001: invalid argument value 
ORA-39000: bad dump file specification 
ORA-31631: privileges are required


解決方案:
GRANT read, write ON DIRECTORY my_dir TO scott; 
-- or: 
GRANT read, write ON DIRECTORY my_dir TO expdp_role;


注意:如果在授予上述許可權後錯誤重現,則磁碟上的目錄可能是在 directory 物件建立後建立的,
這時需要先在資料庫中 drop 該 directory 物件,確保 Oracle 資料庫所安裝的伺服器檔案系統上已存在該目錄
然後再資料庫中重建該 directory 物件,然後再按照上述方法授予讀寫許可權。




錯誤4:表空間配額相關


ORA-31626: job does not exist
ORA-31633: unable to create master table "SCOTT.SYS_EXPORT_SCHEMA_01"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 863
ORA-01536: space quota exceeded for tablespace 'USERS'
 
ORA-31626: job does not exist
ORA-31633: unable to create master table "SCOTT.SYS_EXPORT_SCHEMA_01"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 863
ORA-01950: no privileges on tablespace 'USERS' 


解決方案:
ALTER USER scott QUOTA unlimited ON users; 
 -- or: 
ALTER USER scott DEFAULT TABLESPACE scott_tbsp; 
 
錯誤5:特權使用者相關


> expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp \
 LOGFILE=expdp_s.log TRANSPORT_TABLESPACES=users 


Export: Release 10.2.0.3.0 - Production on Monday, 30 July, 2007 10:03:59 
Copyright (c) 2003, 2005, Oracle. All rights reserved. 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production 
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options 
ORA-31631: privileges are required 
ORA-39162: Transportable tablespace job require privileges
 
> expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp \
 LOGFILE=expdp_s.log TABLES=hugo.emp 


Export: Release 10.2.0.3.0 - Production on Monday, 30 July, 2007 11:51:25 
Copyright (c) 2003, 2005, Oracle. All rights reserved. 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production 
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options 
ORA-31631: privileges are required 
ORA-39109: Unprivileged users may not operate upon other users' schemas


解決方案:


GRANT exp_full_database TO scott; 
-- or: 
GRANT dba TO expdp_role;


錯誤 6:database link 相關
如果某個特權使用者(如 system)利用 NETWORK_LINK 引數匯出或匯入資料,而使用的以非特權使用者(如 scott)
連線遠端資料庫的 publick database link,則 Import DataPump 或 Export DataPump 作業將執行失敗: 


> impdp system/manager NOLOGFILE=y NETWORK_LINK=scott_pub_dblink \
 SCHEMAS=scott REMAP_SCHEMA=scott:hugo  


Import: Release 10.2.0.3.0 - Production on Thursday, 23 August, 2007 11:49:30 
Copyright (c) 2003, 2005, Oracle. All rights reserved. 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production 
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options 
ORA-31631: privileges are required 
ORA-39149: cannot link privileged user to non-privileged user


解決方案:
1.確保 database link 用於聯句誒遠端資料庫的使用者具有 DBA 角色或 EXP_FULL_DATABASE 角色,或者
授予該使用者 expdp_role 角色:
-- in remote database:
 GRANT exp_full_database TO scott; 
-- or in remote database: 
GRANT dba TO expdp_role;


2.如果執行該祖業的特權使用者自己建立了以其他特權使用者身份連線到遠端資料庫的的 private database link,則:
-- in local database: 
CONNECT system/manager 
CREATE DATABASE LINK system_to_remote  
   CONNECT TO system IDENTIFIED BY manager 
   USING 'remote_db.oracle.com'; 


> impdp system/manager NOLOGFILE=y NETWORK_LINK=system_to_remote \  
SCHEMAS=scott REMAP_SCHEMA=scott:hugo


錯誤7:trace 檔案相關
如果非特權使用者使用 TRACE 引數匯出或匯入資料,則會報如下錯誤:


> expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp \
 LOGFILE=expdp_s.log TABLES=emp TRACE=480300
 
Export: Release 10.2.0.3.0 - Production on Monday, 30 July, 2007 12:44:30 
Copyright (c) 2003, 2005, Oracle. All rights reserved. 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production 
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options 
ORA-31631: privileges are required


解決方案:
GRANT exp_full_database TO scott; 
 -- or: 
 GRANT dba TO expdp_role;
 
錯誤8:flashback query 相關


如果具有 EXP_FULL_DATABASE 角色的使用者匯出其他 schema 下的表並且該表 含有SYS.XMLTYPE 列,
則 Export DataPump 將報如下錯誤:


File: expdp_s.par 
----------------- 
DIRECTORY = my_dir 
DUMPFILE = expdp_s.dmp 
LOGFILE = expdp_s.log 
FLASHBACK_TIME = "to_timestamp(to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')" 


> expdp scott/tiger SCHEMAS=hugo parfile=expdp_s.par


...
 Processing object type SCHEMA_EXPORT/TABLE/TABLE 
ORA-31693: Table data object "HUGO"."MYXMLTAB" failed to load/unload and is being skipped due to error: 
ORA-01031: insufficient privileges
 ...
 
解決方案:
授予執行 Export DataPump job 的使用者 FLASHBACK 許可權:


GRANT flashback ON hugo.myxmltab TO scott;  
-- or:  
GRANT flashback any table TO expdp_role;


或者直接授予 DBA 許可權




錯誤9:變化資料捕獲 (Change Data Capture, CDC) 相關


如果具有 EXP_FULL_DATABASE 角色的使用者只需了全庫匯出,且該資料庫包含變化表(SELECT * FROM change_tables),
則將報如下錯誤:
...
 Estimate in progress using BLOCKS method... 
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA 
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB [] 
ORA-31642: the following SQL statement fails: 
BEGIN "SYS"."DBMS_CDC_EXPDP".SCHEMA_CALLOUT(:1,0,1,'10.02.00.03.00'); END; 
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86 
ORA-06512: at "SYS.DBMS_METADATA", line 907 
ORA-01031: insufficient privileges 


ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 
ORA-06512: at "SYS.KUPW$WORKER", line 6249 
...
 
...
 Estimate in progress using BLOCKS method... 
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA 
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB [] 
ORA-31642: the following SQL statement fails: 
BEGIN "SYS"."DBMS_CDC_EXPDP".SCHEMA_CALLOUT(:1,0,1,'10.02.00.03.00'); END; 
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86 
ORA-06512: at "SYS.DBMS_METADATA", line 907