使用数据泵,进行数据导入导出
2013-06-24 10:15
351 查看
1、数据导出(导出scott.emp)
结果:d:\mydir下导出两个文件exp_scott_emp.dmp和exp_scott_emp.log
(1)、
以sys/changoninstall@ORCL连接
(2)、
新建目录:d:\mydir
(3)、
创建目录对象:create directory mydir as 'd:\mydir';
(4)、
对目录对象进行授权(授权给导出用户):
grant read,write on directory mydir to scott;
(5)、
创建导出的参数文件:exp_scott_emp.txt
(6)、
执行导出命令:用cmd进入命令提示符窗口,把命令提示符窗口的当前路径转到参数文件的存放路径下,引用刚创建的参数文件exp_scott_emp.txt来执行导出(expdp)命令(如d:\mydir\exp_scott_emp.txt)
l
d:
l
cd d:\mydir
l
expdp parfile=exp_scott_emp.txt (注意:千万不要加分号;)
2、数据导入(导入scott.emp)
(1)、
准备导入源:d:\mydir
exp_scott_emp.dmp 和exp_scott_emp.log
(2)、
创建SQL脚本文件(beforeimp.sql):保存导入前在目标数据库中要执行的命令
(3)、
创建导入参数文件:imp_scott_emp.txt
(4)、
创建导入的批命令文件:imp_scott.bat
(5)、
执行imp_scott.bat:将创建的三个文件(beforeImp.sql、imp_scott_emp.txt、imp_scott.bat)放到同一路径下,用cmd进入命令提示符窗口,将当前路径转到三个文件的路径下,输入:imp_scott.bat
(注意,千万不要加分号;)
结果:d:\mydir下导出两个文件exp_scott_emp.dmp和exp_scott_emp.log
(1)、
以sys/changoninstall@ORCL连接
(2)、
新建目录:d:\mydir
(3)、
创建目录对象:create directory mydir as 'd:\mydir';
(4)、
对目录对象进行授权(授权给导出用户):
grant read,write on directory mydir to scott;
(5)、
创建导出的参数文件:exp_scott_emp.txt
userid=scott/tiger@orcl directory=mydir dumpfile=exp_scott_emp.dmp logfile=emp_scott_emp.log tables=(emp) job_name=emp_scott_emp
(6)、
执行导出命令:用cmd进入命令提示符窗口,把命令提示符窗口的当前路径转到参数文件的存放路径下,引用刚创建的参数文件exp_scott_emp.txt来执行导出(expdp)命令(如d:\mydir\exp_scott_emp.txt)
l
d:
l
cd d:\mydir
l
expdp parfile=exp_scott_emp.txt (注意:千万不要加分号;)
2、数据导入(导入scott.emp)
(1)、
准备导入源:d:\mydir
exp_scott_emp.dmp 和exp_scott_emp.log
(2)、
创建SQL脚本文件(beforeimp.sql):保存导入前在目标数据库中要执行的命令
--目录对象 create directory mydir as 'd:\mydir'; --表空间(D:\mydir\tablespace目录必须存在,且目录下不能存在将要创建的数据文件) create tablespace mytbs datafile 'D:\mydir\tablespace\mytbs1.dbf' size 5M autoextend on next 1k maxsize 10M , 'D:\mydir\tablespace\mytbs2.dbf' size 10M ; --profile create profile myprofile limit password_life_time 30 failed_login_attempts 6; --导入用户(创建导入用户) create user scott profile myprofile identified by tiger default tablespace mytbs account unlock; grant connect to scott; grant dba to scott; exit;--一定记得要退出
(3)、
创建导入参数文件:imp_scott_emp.txt
userid=scott/tiger@ORCL directory=mydir dumpfile=exp_scott_emp.dmp logfile=exp_scott_emp.log job_name=imp_scott_emp
(4)、
创建导入的批命令文件:imp_scott.bat
sqlplus sys/changeoninstall@orcl as sysdba @beforeimp.sql impdp parfile=imp_scott_emp.txt
(5)、
执行imp_scott.bat:将创建的三个文件(beforeImp.sql、imp_scott_emp.txt、imp_scott.bat)放到同一路径下,用cmd进入命令提示符窗口,将当前路径转到三个文件的路径下,输入:imp_scott.bat
(注意,千万不要加分号;)
相关文章推荐
- 使用Transact-SQL进行数据导入导出方法详解
- 如何在 ASM 存储中使用 Data Pump (expdp impdp)进行数据导出导入操作
- 对象文件[置顶] 如何在 ASM 存储中使用 Data Pump (expdp impdp)进行数据导出导入操作
- 使用Transact-SQL进行数据导入导出方法详解(转)
- 使用Transact-SQL进行数据导入导出方法详解
- 使用JAXB 进行XML格式数据导入导出 Restful service
- 使用Transact-SQL进行数据导入导出方法详解
- 使用T-SQL进行数据导入导出方法详解
- ORACLE数据导出与导入专题(3)——使用exp/imp工具进行数据导入导出
- 使用数据泵expdp命令和impdp命令对数据库的数据进行导入导出
- ORACLE使用EXPDP和IMPDP数据泵进行导出导入的方法
- ORACLE使用EXPDP和IMPDP数据泵进行导出导入的方法
- SQL Server BI Step by Step 2--- 使用SSIS进行简单的数据导入导出
- SQL Server BI Step by Step --- 使用SSIS进行简单的数据导入导出
- 使用Transact-SQL进行数据导入导出方法
- 使用Transact-SQL进行数据导入导出方法详解
- 使用Transact-SQL进行数据导入导出方法详解[转]
- 使用sqoop工具进行数据导入导出 sqoop并行导入
- 使用Transact-SQL进行数据导入导出方法详解
- 利用SSIS进行SQL Server 数据导入导出——Lookup Plus组件的使用心得