on 2012 Nov 27 4:02 PM
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)?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.