现在的位置: 首页 > 数据库 > 正文

Orcale怎么备份数据库exp?Orcale怎么还原数据库imp

2020年06月29日 数据库 ⁄ 共 1227字 ⁄ 字号 评论关闭

  Orcale 数据库备份数据的命令用exp.exe,还原数据库命令imp.exe。下面学步园小编来讲解下Orcale怎么备份数据库exp?Orcale怎么还原数据库imp?

  Orcale怎么备份数据库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 来实现 文件压缩。

  Orcale怎么还原数据库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;

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

  以上就是关于“Orcale怎么备份数据库exp?Orcale怎么还原数据库imp”的内容,希望对大家有用。更多资讯请关注学步园。学步园,您学习IT技术的优质平台!

抱歉!评论已关闭.