数据库的备份方案,数据库定时备份的问题

想保留一个星期的数据,文件名如同dataweek1.dmp,dataweek2.dmp,dataweek3.dmp,...dataweek7.dmp,
当然这些文件名是自动根据当天的星期确定的(这个是我不知道的)。
如果写批处理,脚本具体如何写,如服务名为hrmaster.world,
用户为rldba 密码为pass,需要按照表一个个导出。
如果有什么别的更好的方法,请指教!
先谢谢各位帮忙!
---------------------------------------------------------------

用作业
---------------------------------------------------------------

gz
---------------------------------------------------------------

做7个批处理文件,只有文件名和倒出的文件名不同,然后星期几就运行几号批出理。当然是放到win2000的任务计划里。这样是看起来蠢了一点,但满有效的,呵呵。
---------------------------------------------------------------

http://www.csdn.net/expert/topic/1073/1073789.xml?temp=.1541712
---------------------------------------------------------------

写一段程序,生成批处理文件就可以了,日期在程序中控制。

程序按照一定日期(年,月,星期、日)自动执行。就生成你想要的备份文件了。
我曾经用PB写过一个。
---------------------------------------------------------------

给你一个热备份的脚本,热备份最大的好处就是可以进行数据的完全或非完全恢复,如0点备份,23点崩溃,数据库可以恢复到23点,也可以选择性的恢复到12点。关于恢复的资料,最好自己看书,很多。
rem script:hotbak.sql
rem creater:chenjiping
rem date:4.4.2002
rem desc:backup database datafile in archive

--connect database
connect internal/virpure;

--archive
alter system checkpoint;
alter system archive log all;
alter system switch logfile;
--start
alter tablespace afis_remote begin backup;
!xcopy e:\orant\database\remote_data1.ora e:\databak/H/R;
!xcopy e:\orant\database\remote_data2.ora e:\databak/H/R;
alter tablespace afis_remote end backup;

alter tablespace afis_rmtafis begin backup;
!xcopy e:\orant\database\rmtafis_data1.ora e:\databak/H/R;
!xcopy e:\orant\database\rmtafis_data2.ora e:\databak/H/R;
alter tablespace afis_rmtafis end backup;

alter tablespace afis_lquser begin backup;
!xcopy e:\orant\database\lquser_data.ora e:\databak/H/R;
alter tablespace afis_lquser end backup;

alter tablespace afis_transf begin backup;
!xcopy e:\orant\database\transf1_data.ora e:\databak/H/R;
!xcopy e:\orant\database\transf2_data.ora e:\databak/H/R;
alter tablespace afis_transf end backup;

alter tablespace system begin backup;
!xcopy e:\orant\database\sys1afis.ora e:\databak/H/R;
alter tablespace system end backup;

alter tablespace rbs begin backup;
!xcopy e:\orant\database\rbs1afis.ora e:\databak/H/R;
alter tablespace rbs end backup;

alter tablespace usr begin backup;
!xcopy e:\orant\database\usr1afis.ora e:\databak/H/R;
alter tablespace usr end backup;

alter tablespace temporary begin backup;
!xcopy e:\orant\database\tmp1afis.ora e:\databak/H/R;
alter tablespace temporary end backup;
--end

--bak control file
--bin
alter database backup controlfile to 'e:\databak\controlbinbak.000';
--ascii
alter database backup controlfile to trace;

alter system switch logfile;
alter system switch logfile;
以下是调用以上脚本的bat,照样可以加到任务计划中,一般热备份每周备份一次就够了,主要看情况不同而定。
rem script:hotbak.bat
rem creater:chenjiping
rem date:4.4.2002
rem desc:backup database datafile in archive

echo del old temp backup file
del f:\datatmp\./q
del e:\datatmp\./q
echo bak backup file to temp
move e:\databak\. e:\datatmp\
move f:\Archive\. f:\datatmp\
echo start new bak to e:\databak
svrmgrl @e:\sql\hotbak.sql

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus