oralce导入导出总结

实际环境中我们经常会遇到建一台服务器A用户环境搬到另外一套环境里面。

1.exp 导出:

exp health_base/health_base@10.1.1.6:11521/orcl owner=('health_base') rows=y indexes=y feedback=100000 file=D:\health_base/health_base%Date:~0,4%%Date:~5,2%%Date:~8,2%%Time:~0,2%%Time:~3,2%%Time:~6,2%.dmp log=D:\health_base\health_base%Date:~0,4%%Date:~5,2%%Date:~8,2%%Time:~0,2%%Time:~3,2%%Time:~6,2%.log 

--owner=('health_base') 导出用户 D:\health_base 需要创建目录
--这里是远程导出
 

也可以远plsql 导出。或者直接在数据库服务器上导出等。

  

通过exp/imp 方式导出导入 。一定要明确原有数据库导出使用的用户,表空间,以及使用的临时表空间。

select * from dba_users where username='HEALTH_BASE'; --切记这个地方username 是大写

 

查询效果如下

2.select f.file#,t.ts#,f.name "File",t.name "Tablespace"
     from v$tempfile f,V$tablespace t
      where f.ts# = t.ts#
    --查询临时表空间

查询效果如下

3.综合上面2中查询情况我们可以明确 heath_base 用户 使用的默认表空间是Health_BASE。临时表空间名称是Health_BASE_TEMP

 

4.脚本:以系统管理员账号登录 我这里以system 

切记切记:datafile 目录查看下当前目录对应挂载磁盘空间。


create tablespace health_base
logging
datafile '/data/oracle/oradata/health_base.dbf'
size 1000m
autoextend on
next 128m maxsize UNLIMITED
extent management local;

alter tablespace health_base
add datafile '/data/oracle/oradata/health_base2.dbf'
size 1000M
autoextend on
next 128m maxsize UNLIMITED;

alter tablespace health_base
add datafile '/data/oracle/oradata/health_base3.dbf'
size 1000M
autoextend on
next 128m maxsize UNLIMITED;

create temporary tablespace  health_base_temp
 TEMPFILE '/data/oracle/oradata/health_base_temp.DBF' 
 SIZE 512M REUSE AUTOEXTEND ON NEXT  1M MAXSIZE UNLIMITED;

create user health_base identified by health_base
default tablespace health_base
temporary tablespace health_base_temp;
 
 
grant connect,resource,dba to health_base; --按照实际情况分配权限

5远程导入

imp health_base/health_base@10.1.1.7:11521/orcl  fromuser=health_base touser=health_base file=D:\health_base\health_base.dmp ignore=y  feedback=100000 buffer=10240000 log=D:\health_base\loghealth_base.log 

后续讲expdb/impdb  垮用户,表空间,临时表空间的导入导出。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值