IMPDP :Schema XXX was not found

今天在写一个简单的备份脚本时,遇到了一个小问题。
      在用IMPDP执行导入操作时报没有该用户。
    
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-39165: Schema XXX was not found.
      
      奇怪明明建立了,怎么还会没有呢?这是突然想起来在IMPDP的参数SCHEMAS指定的比较“别扭”,因为原来在使用IMP的时候在SCHEMA级别时常常需要写FROMUSER 、TOUSER这两个参数的。但是IMPDP却没有!正好这次IMPDP导入的用户名和源用户又不同!
      还好使用另外的REMAP_SCHEMA参数解决了该问题。ORACLE的官方手册中这样提到:
     
REMAP_SCHEMA

Default: none

Purpose

Loads all objects from the source schema into a target schema.

Syntax and Description

REMAP_SCHEMA=source_schema:target_schema

Multiple REMAP_SCHEMA lines can be specified, but the source schema must be different for each one. However, different source schemas can map to the same target schema. The mapping may not be 100 percent complete, because there are certain schema references that Import is not capable of finding. For example, Import will not find schema references embedded within the body of definitions of types, views, procedures, and packages.

If the schema you are remapping to does not already exist, the import operation creates it, provided the dump file set contains the necessary CREATE USER metadata for the source schema and you are importing with enough privileges.
      
      要注意:
      1.该参数的使用方法 REMAP_SCHEMA=source_schema:target_schema
      
2.即使你指定的对应SCHEMA不存在,只要导入时连接的用户有足够的权限,就会使用DUMP文件中的CREATE USER的metadata来创建一个对应的用户的。
       
     ----------手册真的很重要 -:)
     

本文出自 “Be the miracle!” 博客,请务必保留此出处http://miracle.blog.51cto.com/255044/83688

### 解决 Oracle 数据库中 `expdp` 命令未找到的问题 #### 1. 确认 Data Pump 功能是否启用 Data Pump 是从 Oracle Database 10g 开始引入的功能,因此如果使用的版本低于 10g,则无法使用 `expdp` 和 `impdp` 命令。需要升级到支持 Data Pump 的版本[^2]。 #### 2. 设置环境变量 `$ORACLE_HOME` 和 `$PATH` 确保已经正确设置了 `$ORACLE_HOME` 和 `$PATH` 环境变量。如果没有设置这些变量或者路径不正确,可能会导致找不到 `expdp` 命令的情况发生。 - 在 Linux/Unix 平台上,通常需要将 `${ORACLE_HOME}/bin` 添加至 PATH 中: ```bash export ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1 export PATH=${ORACLE_HOME}/bin:$PATH ``` - Windows 用户则需检查系统属性里的 “高级系统设置 -> 环境变量”,确认 `%ORACLE_HOME%` 被正确定义,并且将其 bin 子目录加入到了 Path 变量里[^3]。 #### 3. 验证客户端安装类型 有时即使安装了 Oracle 客户端软件也可能缺少必要的组件(比如 Data Pump)。如果是这种情况,请重新运行安装程序并选择完全版或带 Data Pump 支持的选项进行安装[^4]。 #### 4. 检查权限问题 尝试以拥有更高特权的身份登录再试一次;例如切换成 SYSDBA 权限账户来发起导出作业: ```bash expdp sys/password@service_name DIRECTORY=data_pump_dir DUMPFILE=test.dmp SCHEMAS=schema_name FULL=Y ``` 这里需要注意的是DIRECTORY参数对应的值应该是一个预先由管理员创建好的逻辑目录名称[^5]。 #### 5. 排除其他潜在原因 对于更复杂的情形,如遭遇内部错误 (ORA-600), 核心转储(core dump),或者其他类型的 ORA 错误号等问题时,建议收集诊断信息并与官方技术支持团队联系获取进一步帮助[^4]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值