FirebirdSQL/問答篇/批次檔執行備份修復

出自VFP Wiki

(修訂版本間差異)
跳轉到: 導航, 搜尋
(gsa)
第1行: 第1行:
-
=== Firebird自動化設定 ===
+
[http://www.bjicp.com ICP代办]
 +
[http://www.bjicp.com ICP]
 +
[http://www.bjicp.com ICP办理]
 +
[http://www.bjicp.com ICP证]
 +
[http://www.bjicp.com 北京ICP]
 +
[http://www.bjicp.com ICP经营许可证]
 +
[http://www.bjicp.com 申请ICP经营许可证]
 +
http://www.bjicp.com/images/braintemp_1.jpg{nid GFY}
-
<code>
 
-
rem @echo off
 
-
rem Batch file for safe shutting down and restarting IB55
 
-
rem This Batch will run on Win-NT, not on Win-9x
 
-
C:
 
-
CD "\Program Files\Interbase Corp\Interbase\Bin"
 
-
SET BATLOGFILE=%1
 
-
IF "%BATLOGFILE%" == "" SET BATLOGFILE=d:\newua\jobs\nightly.LOG
 
-
echo ------------------------------------------------- >> %BATLOGFILE%
 
-
Date /T >> %BATLOGFILE%
 
-
Time /T >> %BATLOGFILE%
 
-
rem ========= Step 1: shutdown database =========
 
-
echo Try Shutdown Database... >> %BATLOGFILE%
 
-
gfix -shut -attach 30 d:\newua\ua.gdb -user SYSDBA -pass masterkey 2> errout.tmp
 
-
echo 1> nul 2> empty.tmp
 
-
echo N 1> N_CR.tmp
 
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
 
-
if errorlevel 1 GOTO NOT_SHUT
 
-
echo Shutdown ua ok >> %BATLOGFILE%
 
-
gfix -shut -attach 30 d:\newua\train.gdb -user SYSDBA -pass masterkey 2> errout.tmp
+
[http://www.bjicp.net ICP代办]
-
echo 1> nul 2> empty.tmp
+
[http://www.bjicp.net ICP]
-
echo N 1> N_CR.tmp
+
[http://www.bjicp.net ICP办理]
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
+
[http://www.bjicp.net ICP证]
-
if errorlevel 1 GOTO NOT_SHUT_TRAIN
+
[http://www.bjicp.net 北京ICP]
-
echo Shutdown train ok >> %BATLOGFILE%
+
[http://www.bjicp.net ICP经营许可证]
 +
[http://www.bjicp.net 申请ICP经营许可证]
 +
http://www.bjicp.net/images/logo.jpg {nid GFY}
-
rem ========= Step 2: stop InterbaseServer =========
+
[http://www.bjicp.org ICP代办]
-
echo Try stop InterbaseServer... >> %BATLOGFILE%
+
[http://www.bjicp.org ICP]
-
NET STOP InterbaseServer 1> nul 2>> %BATLOGFILE%
+
[http://www.bjicp.org ICP办理]
-
IF errorlevel 1 GOTO NOT_STOPPED
+
[http://www.bjicp.org ICP证]
-
echo stop InterbaseServer ok >> %BATLOGFILE%
+
[http://www.bjicp.org 北京ICP]
-
 
+
[http://www.bjicp.org ICP经营许可证]
-
rem ========= Step 3: (re)start InterbaseGuardian =========
+
[http://www.bjicp.org 申请ICP经营许可证]
-
echo Try start InterbaseGuardian... >> %BATLOGFILE%
+
http://www.bjicp.org/image/s2.gif{nid GFY}
-
NET START InterbaseGuardian 1> nul 2>> %BATLOGFILE%
+
-
IF errorlevel 1 GOTO NOT_STARTED
+
-
echo start InterbaseGuardian ok >> %BATLOGFILE%
+
-
 
+
-
 
+
-
rem ========= Step 4: backup database =========
+
-
echo backup Database... >> %BATLOGFILE%
+
-
gbak -B -t -user SYSDBA -pass masterkey  d:\newua\ua.gdb d:\newua\ua.bkp 2> errout.tmp
+
-
echo 1> nul 2> empty.tmp
+
-
echo N 1> N_CR.tmp
+
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
+
-
if errorlevel 1 GOTO NOT_BACKEDUP
+
-
echo backup ua ok >> %BATLOGFILE%
+
-
 
+
-
rem ========= Step 5: restore database =========
+
-
echo restore Database... >> %BATLOGFILE%
+
-
gbak -R -user SYSDBA -pass masterkey  -c -p 8192 d:\newua\ua.bkp d:\newua\ua.gdb 2> errout.tmp
+
-
echo 1> nul 2> empty.tmp
+
-
echo N 1> N_CR.tmp
+
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
+
-
if errorlevel 1 GOTO NOT_RESTORED
+
-
echo restore train ok >> %BATLOGFILE%
+
-
 
+
-
 
+
-
rem ========= Step 6: bring database online =========
+
-
echo Try bring database online... >> %BATLOGFILE%
+
-
gfix -online d:\newua\ua.gdb -user SYSDBA -pass masterkey 2> errout.tmp
+
-
echo 1> nul 2> empty.tmp
+
-
echo N 1> N_CR.tmp
+
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
+
-
if errorlevel 1 GOTO NOT_ONLINE
+
-
echo Online ua again. Finished. >> %BATLOGFILE%
+
-
 
+
-
gfix -online d:\newua\train.gdb -user SYSDBA -pass masterkey 2> errout.tmp
+
-
echo 1> nul 2> empty.tmp
+
-
echo N 1> N_CR.tmp
+
-
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
+
-
if errorlevel 1 GOTO NOT_ONLINE_TRAIN
+
-
echo Online train again. Finished. >> %BATLOGFILE%
+
-
 
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_SHUT
+
-
type errout.tmp >> %BATLOGFILE%
+
-
echo Shutdown ua failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_SHUT_TRAIN
+
-
type errout.tmp >> %BATLOGFILE%
+
-
echo Shutdown train failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_STOPPED
+
-
echo Stop InterbaseServer failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_STARTED
+
-
echo Start InterbaseGuardian failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_BACKEDUP
+
-
type errout.tmp >> %BATLOGFILE%
+
-
echo Backup failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_RESTORED
+
-
echo restore failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_ONLINE
+
-
type errout.tmp >> %BATLOGFILE%
+
-
echo Bringing ua database online failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:NOT_ONLINE_TRAIN
+
-
type errout.tmp >> %BATLOGFILE%
+
-
echo Bringing train database online failed! >> %BATLOGFILE%
+
-
GOTO END_BATCH
+
-
 
+
-
:END_BATCH
+
-
del *.tmp
+
-
</code>
+
-
[http://www.hg-fix.com/ 数据恢复]
+
-
[http://www.hg-fix.com/ 硬盘数据恢复]
+
-
[http://www.hg-fix.com/ 磁带数据恢复]
+
-
[http://www.hg-fix.com/ raid数据恢复]
+
-
[http://www.hg-fix.com/ 磁盘阵列数据恢复]
+
-
[http://www.hg-fix.com/diskrecover.htm 数据恢复]
+
-
[http://www.hg-fix.com/taperecover.htm 数据恢复]
+
-
[http://www.hg-fix.com/raidrecover.htm 数据恢复]
+
-
[http://www.hg-fix.com/ 数据修复]
+
-
[http://www.hg-fix.com/ 硬盘数据修复]
+
-
[http://www.hg-fix.com/ 磁带数据修复]
+
-
[http://www.hg-fix.com/ raid数据修复]
+
-
[http://www.hg-fix.com/diskrecover.htm 数据修复]
+
-
[http://www.hg-fix.com/raidrecover.htm 数据修复]
+
-
[http://www.hg-fix.com/taperecover.htm 数据修复]
+
-
[http://www.hg-fix.com/ 磁盘阵列数据修复]
+

在2005年4月3日 (日) 03:24所做的修訂版本

ICP代办 ICP ICP办理 ICP证 北京ICP ICP经营许可证 申请ICP经营许可证 http://www.bjicp.com/images/braintemp_1.jpg{nid GFY}


ICP代办 ICP ICP办理 ICP证 北京ICP ICP经营许可证 申请ICP经营许可证 http://www.bjicp.net/images/logo.jpg {nid GFY}

ICP代办 ICP ICP办理 ICP证 北京ICP ICP经营许可证 申请ICP经营许可证 http://www.bjicp.org/image/s2.gif{nid GFY}