impdp导入指定表 oracle_oracle 11g 将表导入到其他用户的impdp命令

本文介绍了如何使用 Oracle 的 impdp 命令将一个数据库的特定表导入到另一个用户中,包括创建表空间、用户以及设置权限,并详细解释了 impdp 的关键参数如 remap_user、remap_tablespace 和 table_exists_action 的用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/*分为四步 */

/*第1步:创建临时表空间  */

create temporary tablespace yuhang_temp

tempfile 'D:\oracledata\yuhang_temp.dbf'

size 50m

autoextend on

next 50m maxsize 20480m

extent management local;

/*第2步:创建数据表空间  */

create tablespace TBS_SMDA_02

logging

datafile 'D:\APP\ZHP\ORADATA\ORCL\TBS_QXY_01.dbf'

size 400m

autoextend on

next 50m maxsize 20480m

extent management local;

/*第3步:创建用户并指定表空间  */

create user yuhang identified by yuhang

default tablespace yuhang_data

temporary tablespace yuhang_temp;

/*第4步:给用户授予权限  */

grant connect,resource,dba to yuhang;

今天需要另一个数据库的用户表导入到当前库中,但用户名不相同,以前exp/imp时,可以指定fromuser和touser来解决,在expdp中也提供了类似的解决方法

impdp system/zlsoft dumpfile=expdp:EXPDP_ZLHIS.DMP nologfile=y tables=zlhis.dept remap_schema=zlhis:scott remap_tablespace=ZL9BASEITEM:users,zl9indexhis

:users,zl9indexmtl:users table_exists_action=truncate exclude=object_grant

几个重要参数的说明一下:

1、remap_user 重新映射用户,格式:

source_user1:target_user1,source_user2:target_user2

2、remap_tablespace 重新映射表空间

3、 table_exists_action 表已经存在的动作 有效关键字: (SKIP), APPEND, REPLACE 和 TRUNCATE。

4、exclude=object_grant 跳过对象授权

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值