oracle

关注公众号 jb51net

关闭
首页 > 数据库 > oracle > oracle 11g导入\导出(expdp impdp)

oracle 11g导入\导出(expdp impdp)之导入过程

作者:AGMTI

导出需使用SEC.DMP格式,无分号;建立expdir目录(E:/exp)并确保存在;导入在cmd下执行,需sys用户权限;若需修改TEST用户密码,须通过sysdba登录sys用户操作

上一个环节,我们讲了导出(expdp )操作,这个环节则讲导出操作

准备文件

注意:扩展名SEC.DMP,不可为SEC.DMP;,必须把;去掉。

可变量详细
expdirdirectory对象名
E:/expexpdir对象导入文件储存位置
sec.dmp导入的文件名
system系统用户

导入(impdp)

1、建立directory

首先建立 directory – expdir (导入导出都要建立,expdir为directory 对象名,对应的 E:/exp 文件夹如果不存在,需要手工建立) 注意:该步骤在sys用户下完成

SQL> create or replace directory expdir as 'E:/exp';
目录已创建。
SQL> grant read,write on directory expdir to system;
授权成功。
SQL> select * from dba_directories;

2、导入语句 

注意:该步骤在cmd下完成

C:\Users\TTOM>impdp system/1234 directory=expdir dumpfile=SEC.dmp

Import: Release 11.2.0.1.0 - Production on 星期三 7月 17 21:55:47 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已成功加载/卸载了主表 "SYSTEM"."SYS_IMPORT_FULL_01"
......
. . 导入了 "TEST"."T1"                                 5.015 KB       1 行
. . 导入了 "TEST"."T2"                                 5.015 KB       1 行
. . 导入了 "TEST"."T3"                                 5.015 KB       1 行
作业 "SYSTEM"."SYS_IMPORT_FULL_01" 已于 21:55:49 成功完成

3、更改密码

如果不知道TEST用户的密码,则我们需要更改该用户的密码,需要登录超级用户(sysdba) 

注意:该步骤在sys用户下完成

C:\Users\TTOM>sqlplus sys/1234 as sysdba;
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter user test identified by 1234;
用户已更改。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文