上一个环节,我们讲了导出(expdp )操作,这个环节则讲导出操作
准备文件: 注意:扩展名SEC.DMP
,不可为SEC.DMP;
,必须把;
去掉。
可变量 | 详细 | ||
---|---|---|---|
expdir | directory对象名 | ||
E:/exp | expdir对象导入文件储存位置 | ||
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;
用户已更改。
二、导出(expdp)
https://blog.csdn.net/yantao19930905/article/details/96328721