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 Taques |
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. answered 27 Nov '12, 16:04 Breck Carter 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... answered 28 Nov '12, 09:15 Volker Barth |
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? answered 28 Nov '12, 12:16 Walmir Taques 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
|