将10.16.23.111数据库服务器中的数据库名称为cwy_init1的数据导出,随后在10.16.23.112数据库服务器创建空库cwy_init2,将导出的cwy_init1数据文件(cwy_init_0806.dmp)导入空库cwy_init2。
impdp cwy_init2/init@orcl directory=DATA_PUMP_DIR dumpfile=cwy_init_0806.dmp REMAP_SCHEMA=cwy_init1:cwy_init2 transform=segment_attributes:n logfile= imp_cwy_init_0806.log
1. 导入报错,提示ORA-39083、ORA-01917
ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role 'FOR_QUERY' does not exist
Failing sql is:
GRANT SELECT ON "CWY_INIT"."UR_RPT" TO "FOR_QUERY"
2. 问题分析
数据库cwy_init1存在用户“FOR_QUERY”,将该数据库导出后,再次导入空数据库cwy_init2,因新建的空数据库没有用户“FOR_QUERY”而报错。
3. 解决办法
在新建的空数据库中创建用户“FOR_QUERY”,并赋予权限。
CREATE USER FOR_QUERY PROFILE DEFAULT IDENTIFIED BY init DEFAULT TABLESPACE cwy_init TEMPORARY TABLESPACE cwy_inittemp ACCOUNT UNLOCK;
GRANT UNLIMITED TABLESPACE TO FOR_QUERY WITH ADMIN OPTION;
GRANT "CONNECT" TO FOR_QUERY WITH ADMIN OPTION;
grant connect,resource to FOR_QUERY;
grant create session, dba to FOR_QUERY;