sqlplus /nolog
conn /as sysdba
//创建临时表空间
create temporary tablespace epmt1_temp
tempfile 'd:\oracle\product\10.2.0\oradata\orcl\epmt1_temp.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//创建表空间
create tablespace epmt1
logging
datafile 'd:\oracle\product\10.2.0\oradata\orcl\epmt1.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
//第一次使用
create tablespace epmsdev
logging
datafile 'D:\oracle\product\10.2.0\oradata\orcl\epmsdev.dbf'
size 1024m
autoextend on
next 32m maxsize 4096m
extent management local;
//第一次使用
create tablespace dat_epm
logging
datafile 'D:\oracle\product\10.2.0\oradata\orcl\dat_epm.dbf'
size 1024m
autoextend on
next 32m maxsize 2048m
extent management local;
删除表空间
drop TABLESPACE t_epms INCLUDING CONTENTS AND DATAFILES;
//创建用户
create user epm_test identified by epm_test
default tablespace epmt1
temporary tablespace epmt1_temp ;
//给权限
grant connect,resource,dba to epm_test ;
//导入数据库
exit;
imp epm_test/epm_test@orcl file=d:/epm_test.dmp full=y;
imp epms_product/epms_product@orcl fromuser=epms_product touser=epms_test file=d:/epms_test.dmp log=d:/epms_imp.log ignore=y;
imp epms_test/epms_test@orcl fromuser=epms_test touser=epms_test file=d:/data/epms_test_2-18.dmp ignore=y tablespaces=t_epms;
//删除用户
drop user epm_test cascade;
//导出数据库
exp epms_sh/epms_sh file=d:/epms_sh.dmp
exp epms_sh/epms_sh@BOCOEPMS file=d:/epms_product.dmp log=d:/epms_product.log
exp nmepms/nmepms@BOCOEPMS file=d:/nmepms.dmp log=d:/epms_exp.log
exp epms_v1/epms_v1@BOCOEPMS file=d:/epms_v1.dmp full=y
exp epms_sh/epms_sh file=/epms_sh.dmp full=y
export ORACLE_SID=bpmora
sqlplus /nolog;
conn /as sysdba;
drop user epms_sh cascade;
create user epms_sh identified by epms_sh;
grant dba to epms_sh;
export ORACLE_SID=BOCOEPMS
sqlplus /nolog
conn /as sysdba;
drop user gd? cascade;
create user gd? identified by gd?;
grant dba to gd?;
exit
exit
imp epms_sh/epms_sh@BPMORA file=d:\epms_sh.dmp fromuser=epms_sh touser=epms_sh
数据导出:
1 将数据库TEST完全导出,用户名system 密码manager 导出到D:daochu.dmp中
exp system/manager@TEST file=d:daochu.dmp full=y
2 将数据库中system用户与sys用户的表导出
exp system/manager@TEST file=d:daochu.dmp owner=(system,sys)
3 将数据库中的表inner_notify、notify_staff_relat导出
exp aichannel/aichannel@TESTDB2 file= d:datanewsmgnt.dmp tables=(inner_notify,notify_staff_relat)
4 将数据库中的表table1中的字段filed1以"00"打头的数据导出
exp system/manager@TEST file=d:daochu.dmp tables=(table1) query=" where filed1 like '00%'"
数据的导入
1 将D:daochu.dmp 中的数据导入 TEST数据库中。
imp system/manager@TEST file=d:daochu.dmp
imp aichannel/aichannel@HUST full=y file=d:datanewsmgnt.dmp ignore=y
上面可能有点问题,因为有的表已经存在,然后它就报错,对该表就不进行导入。
在后面加上 ignore=y 就可以了。
2 将d:daochu.dmp中的表table1 导入
imp system/manager@TEST file=d:daochu.dmp tables=(table1)