oracle数据库impdp命令的使用方法

本文介绍如何使用 Oracle 的 impdp 命令进行数据导入,并提供了详细的步骤指导,包括创建表空间、用户及权限分配等前置工作。

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

oracle数据库impdp命令的使用方法

impdp命令直接在命令行(cmd/bash)下直接用,不必登录oracle.只能导入expdp命令导出的dmp文件.

但是导出时数据所在的表空间以及用户会记录在文件中,因此导出时是什么表空间/用户,导入时也必须是什么表空间/用户.

下面假设从A服务器的数据库中导出DMP文件,其用户名为topicis.要将其导入B服务器,而B服务器没有此用户.示例中,

表空间(tablespace)设置为topicis_tablespace

用户名(username/schemas)和密码均设置为topicis

目录名(directory)设置为dmpdir

操作流程开始:

  • 登录数据库
    sqlplus / as sysdba

  • 创建表空间

create tablespace topicis_tablespace
logging
datafile '/db-data/topicis.dbf' 
size 1g 
autoextend on 
next 32m maxsize unlimited 
extent management local;
  • 创建用户
    create user topicis identified by topicis;

  • 指定表空间
    alter user topicis default tablespace topicis_tablespace;

  • 赋予权限

grant 
create any directory,
create session,
create table,
create view,
unlimited tablespace
to topicis;
  • 创建directory
    create or replace directory dmpdir as '/db-dir/topicis';

  • 导入数据
    impdp topicis/topicis directory=dmpdir dumpfile=test.dmp full=y;

正常情况下,数据库表会自动创建,数据可以顺利导入.

其他命令

  • 删除用户
    drop user topicis cascade;

  • 删除表空间
    drop tablespace topicis_tablespace including contents and datafiles;

参考自https://blog.youkuaiyun.com/zengmingen/article/details/60957942

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值