Subject | RE: [ib-support] Re: How to automate database backup |
---|---|
Author | Leyne, Sean |
Post date | 2002-10-29T17:31Z |
David,
file/script file to launch the "backup.bat" file. Once you've created
the WSF file, you can use the Windows Task Scheduler to run the job
(even with the server console logged out)... (if you use Win2000, don't
schedule the batch file -- it doesn't run unless the server is logged
in)
To help you out (and others), here is a sample of the files I use for
regular/scheduled backups -- we use a Database_DOW_HOUR naming
convention.
---- Backup.wsf
<package>
<job id="FirebirdBackup">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
BackupDOW = Weekday( Date)
BackupHour = Right( "00" + CStr(Hour( Time)), 2)
WshShell.Run( "D:\Directory\Backup.bat " & BackupDOW & BackupHour)
</script>
</job>
</package>
---- Backup.bat
"C:\Program Files\Firebird\Bin\GBAK" -b -user sysdba -password {Insert
Password} -nt -v D:\Directory\Database.gdb D:\Directory\Database_%1.Gbk
> > Why not call gbak from the scheduler or a little batch file?You need to write yourself a little Windows Scripting Host (WSF)
>
> I would but I want the backup file to be named thus:
>
> DatabaseName_DATE_TIME_.gdk
>
> and I don't know how to do that in a batch file, hence my initial
> thoughts about writing a small program to call GBAK (and schedule the
> small program).
file/script file to launch the "backup.bat" file. Once you've created
the WSF file, you can use the Windows Task Scheduler to run the job
(even with the server console logged out)... (if you use Win2000, don't
schedule the batch file -- it doesn't run unless the server is logged
in)
To help you out (and others), here is a sample of the files I use for
regular/scheduled backups -- we use a Database_DOW_HOUR naming
convention.
---- Backup.wsf
<package>
<job id="FirebirdBackup">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
BackupDOW = Weekday( Date)
BackupHour = Right( "00" + CStr(Hour( Time)), 2)
WshShell.Run( "D:\Directory\Backup.bat " & BackupDOW & BackupHour)
</script>
</job>
</package>
---- Backup.bat
"C:\Program Files\Firebird\Bin\GBAK" -b -user sysdba -password {Insert
Password} -nt -v D:\Directory\Database.gdb D:\Directory\Database_%1.Gbk