dbTalk Databases Forums  

backup event with validate and notify

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss backup event with validate and notify in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Doug Stone
 
Posts: n/a

Default backup event with validate and notify - 11-10-2009 , 12:13 PM






A recent experience where a small but persistent and growing disk failure
rendered useless over eight weeks of backups has forced me to re-think my
backup strategy. Currently, I use a backup event script that is usually
triggered around midnight. This event truncates the log, then copies the
log and database file to another location.
Is there a way to build a validation routine into the event and a capability
to notify someone if the backup does not pass validation?
Sample script would be a big help.
Thanks,
Doug

Reply With Quote
  #2  
Old   
Jeff Albion [Sybase iAnywhere]
 
Posts: n/a

Default Re: backup event with validate and notify - 11-10-2009 , 01:55 PM






Hi Doug,

First, to verify the database, you should run dbvalid (
http://dcx.sybase.com/index.php#1101...1/dbvalid.html ) and
check the process' exit code for success (0) or failure (non-zero) (
http://dcx.sybase.com/index.php#1101...xit-codes.html
). To verify the transaction log, you should run dbtran and check for
the same.

The process' exit code is stored in the variable %ERRORLEVEL% in a DOS
batch script, or the variable "$?" on Linux/UNIX bash script.

If you'd like an example of a quick script to do a backup/validate on
either OS, I can provide a sample.

---

What you do with the exit code afterwards to 'notify someone' is
somewhat environment-specific. If you wanted to do this on Windows, you
can either re-code your backup process as a Windows Script / PowerShell
Script and then use something like CDOSYS to send an e-mail (
http://support.microsoft.com/default.aspx/kb/810702 ), or you could
install a command-line utility to send e-mail.

(FWIW, I found a Win32 port of 'mutt':
http://developer.berlios.de/projects/mutt-win32/ )

On Linux/UNIX, you can likely use "mutt", "sendmail", or a similar
utility at the command line.

---

-- ALTERNATIVE SOLUTION --

You could create the same effect from a stored procedure in SQL using:

1. BACKUP DATABASE DIRECTORY ...
http://dcx.sybase.com/index.php#1101...statement.html

2. xp_cmdshell to run dbvalid / operating system commands:
http://dcx.sybase.com/index.php#1101...s-4380894.html

3. xp_sendmail to e-mail someone when the script fails:
http://dcx.sybase.com/index.php#1101...1/spmspse.html

I posted a sample of this solution on a thread you started last year
with the same question:
http://groups.google.com/group/sybas...fd839d9accd5cd
=============

Cheers,

Doug Stone wrote:
Quote:
Is there a way to build a validation routine into the event and a
capability to notify someone if the backup does not pass validation?
Sample script would be a big help.
--
Jeff Albion, Sybase iAnywhere

iAnywhere Developer Community :
http://www.sybase.com/developer/libr...ere-techcorner
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
SQL Anywhere Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0
Report a Bug/Open a Case : http://case-express.sybase.com/cx/

Reply With Quote
  #3  
Old   
Jeff Albion [Sybase iAnywhere]
 
Posts: n/a

Default Re: backup event with validate and notify - 11-10-2009 , 02:00 PM



Hi Doug,

First, to verify the database, you should run dbvalid (
http://dcx.sybase.com/index.php#1101...1/dbvalid.html ) and
check the process' exit code for success (0) or failure (non-zero) (
http://dcx.sybase.com/index.php#1101...xit-codes.html
). To verify the transaction log, you should run dbtran and check for
the same.

The process' exit code is stored in the variable %ERRORLEVEL% in a DOS
batch script, or the variable "$?" on Linux/UNIX bash script.

If you'd like an example of a quick script to do a backup/validate on
either OS, I can provide a sample.

---

What you do with the exit code afterwards to 'notify someone' is
somewhat environment-specific. If you wanted to do this on Windows, you
can either re-code your backup process as a Windows Script / PowerShell
Script and then use something like CDOSYS to send an e-mail (
http://support.microsoft.com/default.aspx/kb/810702 ), or you could
install a command-line utility to send e-mail.

(FWIW, I found a Win32 port of 'mutt':
http://developer.berlios.de/projects/mutt-win32/ )

On Linux/UNIX, you can likely use "mutt", "sendmail", or a similar
utility at the command line to send the e-mail for 'notification'.

-- ALTERNATIVE SOLUTION --

You could create the same effect from a stored procedure in SQL using:

1. BACKUP DATABASE DIRECTORY ...
http://dcx.sybase.com/index.php#1101...statement.html

2. xp_cmdshell to run dbvalid / operating system commands:
http://dcx.sybase.com/index.php#1101...s-4380894.html

3. xp_sendmail to e-mail someone when the script fails:
http://dcx.sybase.com/index.php#1101...1/spmspse.html

I posted a sample of this solution on a thread you started last year
with the same question:
http://groups.google.com/group/sybas...fd839d9accd5cd
=============

Cheers,

Doug Stone wrote:
Quote:
Is there a way to build a validation routine into the event and a
capability to notify someone if the backup does not pass validation?
Sample script would be a big help.
--
Jeff Albion, Sybase iAnywhere

iAnywhere Developer Community :
http://www.sybase.com/developer/libr...ere-techcorner
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
SQL Anywhere Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0
Report a Bug/Open a Case : http://case-express.sybase.com/cx/

Reply With Quote
  #4  
Old   
Doug Stone
 
Posts: n/a

Default Re: backup event with validate and notify - 12-14-2009 , 09:12 PM



Quote:
If you'd like an example of a quick script to do a backup/validate on
either OS, I can provide a sample.

Jeff:
Yes, please provide a sample script for windows.
Thank you,
Doug




"Jeff Albion [Sybase iAnywhere]" <firstname.lastname (AT) ianywhere (DOT) com> wrote in
message news:4af9c65e$1 (AT) forums-1-dub (DOT) ..
Quote:
Hi Doug,

First, to verify the database, you should run dbvalid (
http://dcx.sybase.com/index.php#1101...1/dbvalid.html ) and
check the process' exit code for success (0) or failure (non-zero) (
http://dcx.sybase.com/index.php#1101...xit-codes.html )
. To verify the transaction log, you should run dbtran and check for the
same.

The process' exit code is stored in the variable %ERRORLEVEL% in a DOS
batch script, or the variable "$?" on Linux/UNIX bash script.

If you'd like an example of a quick script to do a backup/validate on
either OS, I can provide a sample.

---

What you do with the exit code afterwards to 'notify someone' is somewhat
environment-specific. If you wanted to do this on Windows, you can either
re-code your backup process as a Windows Script / PowerShell Script and
then use something like CDOSYS to send an e-mail (
http://support.microsoft.com/default.aspx/kb/810702 ), or you could
install a command-line utility to send e-mail.

(FWIW, I found a Win32 port of 'mutt':
http://developer.berlios.de/projects/mutt-win32/ )

On Linux/UNIX, you can likely use "mutt", "sendmail", or a similar utility
at the command line to send the e-mail for 'notification'.

-- ALTERNATIVE SOLUTION --

You could create the same effect from a stored procedure in SQL using:

1. BACKUP DATABASE DIRECTORY ...
http://dcx.sybase.com/index.php#1101...statement.html

2. xp_cmdshell to run dbvalid / operating system commands:
http://dcx.sybase.com/index.php#1101...s-4380894.html

3. xp_sendmail to e-mail someone when the script fails:
http://dcx.sybase.com/index.php#1101...1/spmspse.html

I posted a sample of this solution on a thread you started last year with
the same question:
http://groups.google.com/group/sybas...fd839d9accd5cd
=============

Cheers,

Doug Stone wrote:
Is there a way to build a validation routine into the event and a
capability to notify someone if the backup does not pass validation?
Sample script would be a big help.

--
Jeff Albion, Sybase iAnywhere

iAnywhere Developer Community :
http://www.sybase.com/developer/libr...ere-techcorner
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
SQL Anywhere Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0
Report a Bug/Open a Case : http://case-express.sybase.com/cx/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.