首页 > 数据库    日期:2026-07-11 / 浏览

上一个环节,我们讲了导出(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;
用户已更改。

总结

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

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章