FirebirdSQL/問答篇/工作排程--備份工作

出自VFP Wiki

(修訂版本間差異)
跳轉到: 導航, 搜尋
第1行: 第1行:
=== Windows的備份排程方案 ===
=== Windows的備份排程方案 ===
-
FirebirdSQL 有提供一個DOS Command工具[http://wiki.sunyear.com.tw/index.php?page=FirebirdSQL%2F2%2F6 iSQL]
+
#建立備份排程,我們需要用到FirebirdSQL的ISQL和Windows的SCHTASKS
-
SCHTASKS--DOS Command,建立/修改/刪除工作排程.
+
#建立Windows的備份排程方案,參考以下的步驟:
-
#先寫好批次檔案MyBATFile.bat,請參考ISQL指令篇
+
##先寫好ISQL指令批次檔案MyBATFile.bat,請參考ISQL指令篇
-
#建立Windows工作排程  
+
##建立Windows工作排程  
<code>
<code>
SCHTASKS /CREATE /TN WWED4 /TR "MyBATFile.bat WED1800" /SC WEEKLY /D WED /ST 18:00:00
SCHTASKS /CREATE /TN WWED4 /TR "MyBATFile.bat WED1800" /SC WEEKLY /D WED /ST 18:00:00
</code>
</code>
-
=== 工具 ===
+
=== 視窗工具 ===
*[http://vfp.sunyear.com.tw/download.php?id=196 資料維護精靈 For FireBird--執行檔 ]
*[http://vfp.sunyear.com.tw/download.php?id=196 資料維護精靈 For FireBird--執行檔 ]
*[http://vfp.sunyear.com.tw/download.php?id=174 資料維護精靈 For FireBird ]
*[http://vfp.sunyear.com.tw/download.php?id=174 資料維護精靈 For FireBird ]

在2005年1月30日 (日) 05:16所做的修訂版本

目錄

Windows的備份排程方案

  1. 建立備份排程,我們需要用到FirebirdSQL的ISQL和Windows的SCHTASKS
  1. 建立Windows的備份排程方案,參考以下的步驟:
    1. 先寫好ISQL指令批次檔案MyBATFile.bat,請參考ISQL指令篇
    2. 建立Windows工作排程

SCHTASKS /CREATE /TN WWED4 /TR "MyBATFile.bat WED1800" /SC WEEKLY /D WED /ST 18:00:00

視窗工具


Linux下的備份排程方案

Equivalent of GbakSchd for Linux (Scripts) By Salim Naufal [salim.naufal@softnet-eng.com] This is the crontab for the backups: it will execute /backups/dbackup.sh from Monday to Thursday and /backups/wbackup.sh on Fridays

dbServer1:/backups # crontab -l

  1. DO NOT EDIT THIS FILE - edit the master and reinstall.
  2. (/tmp/crontab.5730 installed on Mon May 3 17:45:52 2004)
  3. (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)

50 16 * * 1-4 /backups/dbackup.sh 50 16 * * 5 /backups/wbackup.sh


Listing of the sbackup.sh:


/opt/firebird/bin/gbak -b -T -user sysdba -password masterkey /database/stock.fdb /backups/stock.fbk gzip -9 /backups/stock.fbk

currDateCommand="date +%B%d%Y" currDate=`$currDateCommand` echo $currDate

mount /StocksBackups

mv /backups/stock.fbk.gz /StocksBackups/$currDate-Stock.fbk.gz


listing of the wbackup.sh:


/opt/firebird/bin/gbak -b -T -user sysdba -password masterkey /database/stock.fdb /backups/stock.fbk gzip -9 /backups/stock.fbk

currDateCommand="date +%B%d%Y" currDate=`$currDateCommand` echo $currDate

mount /StocksBackups

mv /backups/stock.fbk.gz /StocksBackups/$currDate-WeeklyStock.fbk.gz


To mount the /StocksBackups directory which is on a MS Windows system, edit the fstab and register the line below:

//192.168.0.123/Backupdir /StocksBackups smbfs username=administrator,password=adminpwd 0 0

The 192.168.0.123 is the IP of the Windows PC, the Backupdir is the share name on windows, /StocksBackups is the directory where the share is mounted on linux, and the rest is user name and password to access the share.

I hope that this is what you are looking for

Salim


參考文章