51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3621|回复: 0
打印 上一主题 下一主题

oracle数据库自动备份

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-6-1 11:30:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如何让oracle数据库能自动备份?
环境:linux + oracle
假如数据库的实例名是oracle245,用户名是hhris,密码是hhris,要备份的目录是linux系统的根目录"/",通常我们的用dos命令来操作的,具体命令如下:
exp [email=hhris/hhris@oracle245]hhris/hhris@oracle245[/email] file=/oracle245.dmp
但是这样写的文件名是死的,如果我们把命令略加修改,就能生成以日期来命名的文件名:
exp [email=hhris/hhris@Oracle245]hhris/hhris@Oracle245[/email] file=/%date:~0,4%%date:~5,2%%date:~8,2%.dmp
然后把该命令添加到系统的任务中去,就能自动备份数据库了
导入命令:
imp [email=hhris/hhris@oracle245]hhris/hhris@oracle245[/email] file=/oracle245.dmp
========================================================
3.0中,如果要导出
exp system/system file=hhpacs.dmp tables=(accesshold,accesstable,applicationentity,devaccess,device,face,groupnames,securitymatrix,storageaccess,storagecontrol,transmiting,useraccess,patientlevel,studylevel,serieslevel,imagelevel,instancetable,studylevel_old,serieslevel_old,imagelevel_old,instancetable_old)  owner=system direct=y log=exp_hhpacs.log
exp hhris/hhris file=hhris.dmp owner=hhris direct=y log=exp_hhris.log
exp hhus/hhus file=hhus.dmp owner=hhus direct=y log=exp_hhus.log
exp hhendo/hhendo file=hhendo.dmp owner=hhendo direct=y log=exp_hhendo.log
==========================================================
4.0中,如果要导出
exp hhapcs/hhpacs file=/zw/hhpacs.dmp owner=hhpacs direct=y log=exp_hhpacs.log
exp hhris/hhris file=/zw/hhris.dmp owner=hhris direct=y log=exp_hhris.log
==========================================================
导入
$sqlplus /”as sysdba”
Sql>create user hhpacs identified by hhpacs default tablespace hhpacs;
Sql>create user hhris identified by hhris default tablespace hhris;
Sql>grant dba to hhpacs;
Sql>grant dba to hhris;
Sql>exit
$imp hhris/hhris file=hhris.dmp fromuser=hhris buffer=40960000 log=imp_hirs.log
$imp hhpacs/hhpacs file=hhpacs.dmp fromuser=hhpacs buffer=40960000 log=imp_hhpacs.log
===========================================================
imp hhpacs/hhpacs file=/zw/hhpacs.dmp fromuser=hhpacs touser=hhpacs log=imp_hhpacs.log
imp hhris/hhris file=/zw/hhris.dmp fromuser=hhris touser=hhris log=imp_hhris.log
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-3 05:52 , Processed in 0.076067 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表