2013-10-24 35 views
3

我是Oracle noob。我試圖從一臺機器複製(expdp/impdp)架構(無數據)到另一臺機器。我不想重新映射。我只想在targetHOST上創建空表結構。 錯誤我得到的是:impdp不會創建用戶/架構

ORA-39083: Object type PROCACT_SCHEMA failed to create with error: 
ORA-31625: Schema ZABBIX is needed to import this object, but is unaccessible 
ORA-01435: user does not exist 

我的理解是,如果執行導入的用戶擁有「導入完整的數據庫」特權,它會創建用戶在targetHOST /模式。我將它授予'斯科特',並嘗試了這一點,同樣的錯誤。

  • DB版本:在SQL * Plus:發佈於星期四10月24日14時27分41秒2013
  • 11.2.0.1.0生產如果它的事項上sourceHOST數據庫版本是11.2.0。
  • 操作系統:Linux targetHOST 2.6.18-308.el5#1 SMP週五01月27日17點17分51秒EST 2012 x86_64的x86_64的x86_64的GNU/Linux的

導入錯誤:

(0)[email protected]$ sqlplus system/manager 
SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 24 14:27:41 2013 
Copyright (c) 1982, 2009, Oracle. All rights reserved. 

SQL> select * from session_privs; 

PRIVILEGE 
---------------------------------------- 
IMPORT FULL DATABASE 
CREATE SESSION 

.......200 other privileges....... 

202 rows selected. 

SQL> ^D 

(0)[email protected]$ 

(0)[email protected]$ impdp system/oracle123 directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=impdpZabbix.log 

Import: Release 11.2.0.1.0 - Production on Thu Oct 24 14:14:51 2013 

Copyright (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 Production 
With the Partitioning, OLAP, Data Mining and Real Application Testing options 
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded 
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=impdpZabbix.log 
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA 
ORA-39083: Object type PROCACT_SCHEMA failed to create with error: 
ORA-31625: Schema ZABBIX is needed to import this object, but is unaccessible 
ORA-01435: user does not exist 
Failing sql is: 
BEGIN 
sys.dbms_logrep_imp.instantiate_schema(schema_name=>SYS_CONTEXT('USERENV','CURRENT_SCHEMA'), export_db_name=>'XXX.YYY.COM', inst_scn=>'7788478540892');COMMIT; END; 
Processing object type SCHEMA_EXPORT/TABLE/TABLE 
ORA-39083: Object type TABLE:"ZABBIX"."TABLE1" failed to create with error: 
ORA-01918: user 'ZABBIX' does not exist 
Failing sql is: 
CREATE TABLE "ZABBIX"."TABLE1" ("COLUMN1" VARCHAR2(20 BYTE) NOT NULL ENABLE, "COLUMN2" VARCHAR2(20 BYTE), "COLUMN3" VARCHAR2(20 BYTE)) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAU 
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX 
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT 
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 2 error(s) at 14:14:53 

(5)[email protected]$ 

導出日誌available here.

回答

5

所以想通了我自己。

如果要重新映射到架構已經不存在,進口 操作創建它,提供的轉儲文件集包含 必要CREATE USER元數據和你有足夠的權限 進口。

含義oracle用戶是出口架構,應該有CREATE USER特權。雖然我沒有重新映射,但導出部分是相關的,因爲我的用戶(ZABBIX)是基本用戶,而不是DBA/create-user-privileged。

我做了'GRANT CREATE USER TO ZABBIX'在我的情況下,再次運行導出,這次處理了一些額外的「對象類型」。

舊輸出時ZABBIX用戶沒有 'CREATE USER' 特權:

(0)[email protected]$ expdp zabbix/zabbix schemas=ZABBIX content=METADATA_ONLY directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=expdpZABBIX.log 
....... 
Starting "ZABBIX"."SYS_EXPORT_SCHEMA_01": zabbix/******** schemas=ZABBIX content=METADATA_ONLY directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=expdpZABBIX.log 
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA 
Processing object type SCHEMA_EXPORT/TABLE/TABLE 
Processing object type SCHEMA_EXPORT/TABLE/COMMENT 
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX 
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT 
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
Master table "ZABBIX"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded 
****************************************************************************** 
....... 

新的輸出:

(0)[email protected]$ expdp zabbix/zabbix schemas=ZABBIX content=METADATA_ONLY directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=expdpZABBIX.log 
....... 
Starting "ZABBIX"."SYS_EXPORT_SCHEMA_01": zabbix/******** schemas=ZABBIX content=METADATA_ONLY directory=TEST_DIR dumpfile=ZABBIX.dmp logfile=expdpZABBIX.log 
Processing object type SCHEMA_EXPORT/USER 
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT 
Processing object type SCHEMA_EXPORT/ROLE_GRANT 
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE 
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA 
Processing object type SCHEMA_EXPORT/TABLE/TABLE 
Processing object type SCHEMA_EXPORT/TABLE/COMMENT 
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX 
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT 
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
Master table "ZABBIX"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded 
****************************************************************************** 
....... 

注意處理對象類型SCHEMA_EXPORT/USER, SCHEMA_EXPORT/SYSTEM_GRANT, SCHEMA_EXPORT/ROLE_GRANT, SCHEMA_EXPORT/DEFAULT_ROLE

更簡單的解決方案:用戶'系統'運行expdp和impdp。它有它自己的陷阱,但對我來說這是最好的。

+0

那麼,這裏有什麼更好的方法? 1)授予特定用戶「創建用戶」,然後記得刪除它? 2)以SYSDBA的身份執行EXPDP? 在我看來,#1是一個安全漏洞,而#2不是Oracle推薦的。 –

+0

@ErikAnderson不確定爲什麼不推薦#2。當你知道你的導出導入需要創建模式時,我看不出有什麼理由不以sysdba身份運行。無論如何,我不知道任何選項#3,所以選擇你的選擇。 :-) – Kashyap

相關問題