Oracle建用户,建表空间,导入导出数据等语句

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)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值