Orcale 备份与还原数据库

WBOY
发布: 2016-06-07 17:06:32
原创
824 人浏览过

Orcale 数据库备份数据的命令用exp.exe,还原数据库命令imp.exe一、备份数据库mdash;mdash;exp

Orcale 数据库备份数据的命令用exp.exe,还原数据库命令imp.exe

一、备份数据库——exp

格式:exp 用户名/密码@数据库 owner=拥有者 file=C:\xxx\xxx.dmp

eg1、数据库TEST完全导出,用户名:test, 密码:test,拥有者:tb_test 导出到D:\daochu.dmp中

exp test/test@TEST owner=tb_test  file=d:\daochu.dmp

第一步:进入到 Oracle 安装目录下的bin目录下;

第二步:exp test/test@TEST owner=tb_test  file=d:\daochu.dmp

eg2、将数据库中的表test中的字段filed1以"00"开头的数据导出,,用户名:test, 密码:test

exp test/test@TEST file=d:\daochu.dmp tables=(test)query="where filed1 like '00%'"

注:可以在命令后面 加上 compress=y 来实现 文件压缩

二、还原数据库——imp

格式:imp 用户名/密码@数据库 full=y file=备份文件路径 ignore=y log=日志文件路径

eg 1、将D:\daochu.dmp文件还原到tb_test数据库中,用户名:test, 密码:test,日志文件放在D:/log.txt 中

第一步:进入到 oracle 安装目录下的bin目录下;

第二步:imp system/manager@tb_test full = y file="d:\back.dmp" ignore=y log=d:\log.txt

eg2、将d:\daochu.dmp中的表table1 导入到tb_test数据库中

imp system/manager@tb_test file=d:\daochu.dmp  tables=(table1)

注:如何没有以前的表记录的话,有可能要出现重复数据,可以通过以下方式解决

首先,删除用户(本人用的test):DROP USER test CASCADE

其次,新建用户(test)

create user test identified by test

default tablespace test_data

temporary tablespace test_temp

quota unlimited on test_data

account unlock;

然后,给新建用户授权 GRANT CONNECT,DBA, RESOURCE TO test;

最后,执行导入数据命令。

linux

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!