How do I know if the database is not presenting problem, so that does not generate a backup of a database invalid (with db error)?

asked 27 Nov '12, 16:02

Walmir%20Taques's gravatar image

Walmir Taques
600293143
accept rate: 13%


After creating a backup, start the backup in read-only mode and run the dbvalid.exe utility against it. If dbvalid does not report any errors, then you know that both the backup and the original database are OK.

permanent link

answered 27 Nov '12, 16:04

Breck%20Carter's gravatar image

Breck Carter
25.8k428592852
accept rate: 20%

How do I run dbvalid through an event database? Its create an event to perform validation of the database automatically?

(28 Nov '12, 09:01) Walmir Taques
Replies hidden
Comment Text Removed

You could use xp_cmdshell to launch dbvalid.exe from inside an event, but I suggest using the Windows - Accessories - System Tools - Task Scheduler to launch a *.bat file because it's easier to administer and track.

...or a chron job in Linux.

(28 Nov '12, 09:11) Breck Carter

While Breck's statement is the official correct one, in case your database is not actively used 24x7 (*), you may also validate the existing database in a "quiet" timespan and then make a backup.

Theoretically, that's a bit more error-prone (the database could become invalid between validation and backup, or the backup itself could fail), but usually the statements in use should notify you accordingly with error messages - and for failing backup processes, you should always have at least one previous "safe" backup.

You may use the Sybase Central Maintenance plan facility to generate such events, if you prefer a GUI-based approach.

(*) Note: Validating a database with active transactions may lead to false positives and is not recommended...

permanent link

answered 28 Nov '12, 09:15

Volker%20Barth's gravatar image

Volker Barth
30.6k306456662
accept rate: 32%

edited 28 Nov '12, 09:15

Comment Text Removed

Imagine the following scenario. With the main database started, I created an event within that db that does the following process:

IF NOT exists (select null from sysevent where SYSEVENT.EVENT_NAME = 'TEST') then
CREATE TEST EVENT
SCHEDULE daily_TESTE
START TIME '11: 00AM '
ON ('Mon')
START DATE '2012-11-28 '
HANDLER
   BEGIN
      START DATABASE 'c: \ system \ BACKUP \ BACKUP_wed_11 \ DBINTELIG.db' ON THE BDBACKUP DBINTELIG
    CALL sa_validate (owner_name = 'DBA') --- in the database BDBACKUP
    STOP DATABASE BDBACKUP

   END;

END IF;

Work?

permanent link

answered 28 Nov '12, 12:16

Walmir%20Taques's gravatar image

Walmir Taques
600293143
accept rate: 13%

edited 17 Sep '13, 11:30

That won't work, as the sa_validate() call relates to the current database of the current connection, and not to the freshly started one.

If you want to valid the backup via an event triggered from your production database, it would be way easier to use xp_cmdshell() to call the DBVALID tool to start and validate the backup in one command, as Breck has sugested.

Why do you want to use an event at all? Does it do the backup before? (Don't get me wrong, events are fine, but for scheduled file-related tasks, the OS scheduler might be easier to setup and monitor, as Breck has pointed out.)

(28 Nov '12, 13:12) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×72

question asked: 27 Nov '12, 16:02

question was seen: 1,101 times

last updated: 17 Sep '13, 11:30