【Vegas原创】imp/exp导入导出数据

来源:互联网 发布:城市卫生服务网络 编辑:程序博客网 时间:2024/05/02 04:46

 

 

 

imp:

1,当数据库没有此表时:

$ imp uid/pwd@erptest  file=dts1202.dmp  tables=salgbl

 

2,当数据库有此表时:

imp uid/pwd@erptest1  file=dts1202.dmp  tables=salgbl ignore=y

 

3,导入bach用户的所有schema到dtowh数据库时:

 

imp uid/pwd@dtowh  file=dtlb1210.dmp  fromuser=bach touser=bach

 

exp:

Linux:

#!/bin/bash
exp uid/pwd@dtserp file=/u01/app/oracle/fin_monthlyend/dts/dtsfin`date '+%Y%m'`.dmp owner=bach log=/u01/app/oracle/fin_monthlyend/dts/dtsfin`date '+%Y%m'`.log

 

Windows:

set ORACLE_SID=HISDB
set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
set a=%date:~10,4%%date:~4,2%%date:~7,2%
@echo %a%
exp uid/pwd@hisdb file=F:\HISDBDmp\hisdb_%a%.dmp log=F:\HISDBDmp\hisdb_log_%a%.log

 

将一个dmp文件导入到一个新的数据库,做测试使用:

如将原来的数据库HIS的nhi用户的dmp文件,导入到一个新的test数据库,用户名为test,密码为test,供测试使用:

1,create tablespace test:

CREATE TABLESPACE TEST
LOGGING
DATAFILE
'F:\oracle\product\10.2.0\oradata\test\TEST.dbf' SIZE 50M
REUSE AUTOEXTEND
ON NEXT 10M;

 

2,create user test:

create user test identified by test default tablespace test;

 

 

3,给test用户赋予权限:

grant connect,resource,dba to test;

 

 

4,导入原nhi用户的数据:

 

imp test/test@test file=F:\abc\hisdb_20100204.dmp log=F:\abc\hisdb_20100204.log fromuser=nhi touser=test

 

 

 

 

 

 

注意:

1,imp时,不要将sys的内容导入~

0 0