给你一个热备份的脚本,热备份最大的好处就是可以进行数据的完全或非完全恢复,如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 archiveecho 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
不过还想知道更好的方法。谢谢 ttjd(ttjd)
以下是autodmp.bat文件rem 以下指定备份at 23:55 /every:m D:\orant_bak\dmp_backup\星期一.bat
at 23:55 /every:t D:\orant_bak\dmp_backup\星期二.bat
at 23:55 /every:w D:\orant_bak\dmp_backup\星期三.bat
at 23:55 /every:th D:\orant_bak\dmp_backup\星期四.bat
at 23:55 /every:f D:\orant_bak\dmp_backup\星期五.bat
at 23:55 /every:s D:\orant_bak\dmp_backup\星期六.bat
at 23:55 /every:su D:\orant_bak\dmp_backup\星期天.bat
然后根据备份策略写七个备份批处理文件,参考如下:
exp80 system/manager file=D:\orant_bak\dmp_backup\mon\mon.dmp full=y log=D:\orant_bak\dmp_backup\mon\log.txt
以后你只要运行一下autodmp.bat文件即可。
---------------------------
autodmp.bat只是添加计划任务。
你的方法和ttjd(ttjd)的方法几乎是一样的。
可能是我不理解,你能讲解一下吗?
严格的来说,exp,imp不算一种备份的方式,
只能算是一种数据转储方式。这种逻辑备份最大的缺点就是不能进行数据的完全恢复,试想,你一天只备份一次,假如零点备份,23点数据库崩溃了,你怎么办,丢掉一天的数据吗???
建议采用热备份方案。也可以加到任务计划中
USERID=rldba/pass@hrmaster 本机可以省略后面的服务名。
BUFFER=32768
OWNER=rldba
FILE=rldba.DMP
ROWs=Y
GRANTS=Y
COMPRESS=Y
CONSISTENT=Y
再建立批处理rldba.bat
exp parfile=ExpLquser.sql
它们两个文件在同一目录下。然后在控制面板中,双击任务计划图标,可以用向导来建立任务计划,不用写at命令。
你给的也是逻辑备份啊。
要使数据能够完全恢复,使数据库运行于归档模式即可。
你能给个热备的脚本吗?
你的程序是bat文件的变形吧,用批处理最方便。
如下:
exp username/password@servicename file=%date%.dmp full=y;然后再windows平台下设定成定时任务就可以了
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 archiveecho 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