cancel
Showing results for 
Search instead for 
Did you mean: 

Maintenance Plan Question SQLA 12

2,324

I have defined a Mainenance Plan using the wizard in Sybase Central (SQLA 12) to execute a daily full image online backup (while de db is running).

  1. I have "instructed" the plan to execute command "CHECKPOINT;" before it starts. Is that necessary? (or is the plan implicitly doing this before starting)

  2. I have included a validation of database pages (Checksum check) at which point I realized that I had better check both "Disconnect all users when maintenance plans runs" and "Disallow logins while the maintenance plan is running" in order not to get false-positives about corruption.

Now, in a case of a failure during the execution of the plan, will that leave the db engine in an unusable state (meaning no client can connect to it anymore because of having both previously mentioned checks on)?

In such a case, will the engine have to be restarted in order to become operational?

I know this is more than one question but please bear with me since I really need some help here. Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Ok, following the general consensus here, I have decided to ditch the Wizard in favor of my own script (actually Breck's) to backup an validate.

I have also created a scheduled task (running Windows Server 2008 here) to run the batch and send me a status email.

The most interesting part by far is the script. Here are the main steps (disregarding the boilerplate work to create working directories and send results to a log file):


First make the backup (while DB is running):

dbbackup -c "connstring" -o "log" C:\\backup

Then, copy the backup file to another folder. Then, apply the tran log because while backing up, stuff might have happened to the DB:

dbeng12 -o "log" C:\\PathToDBFile -ad "C:\\PathToOriginalTranLog"

(So -ad "Path" specifies where to go get the tran logs to be applied to the DB)


Then, start a read-only copy of the DB backup because we want to validate it:

dbspawn -f dbeng12 -n readonlycopy -o "log" -r -gf "C:\\PathToCopyOfDBFile"

( -f force start of DB even if one is already running, how cool is that? -r means open DB in readonly, -gf means to disable firing of triggers, if you need it)


Then validate:

dbvalid -c "connstring-to-readonlycopy" -o "log" -q

(-q don't log to client output, 'cause we already do that to a log file)


Then stop the read-only copy

dbstop -c "connstring-to-readonlycopy" -y

(-y stop even with active connections to the server)

VolkerBarth
Contributor
0 Kudos

Why would you apply the current translog to the backup database? Changes during the backup will be contained in the backup translog automatically.

I would think it would be better to copy both the backup database file and the backup log file to the other folder, and then to simply start the database there via DBVALID (so any required recovery will be done automatically). As it is a copy of the backup, you would not need to start it in read-only mode... I would think that this would really simplify the script, i.e. you would just have 3 (or 4 steps):

  1. Do the backup
  2. Copy the backup files to a second folder
  3. Run DBVALID against the backup copy (and ensure the database name - and possibly the engine name - is different from the production database!)
  4. Remove the backup copy if it could be validated successfully

Just my 2 cents, apparently:)