cancel
Showing results for 
Search instead for 
Did you mean: 

proper use of dbbackup and dblog

Former Member
2,444

I've used dbbackup and dblog for quite awhile. Mostly to make copies of our main database for testing. Lately, I've run into an error when dblogging, "The database quit abnormally the last time it was used. Database recovery must be performed before proceeding." I've run into this error before but it just seemed to go away, say when I tried to run dblog the next day. Never worried about it.

I've googled this error and reviewed some other questions related to dblog in this forum and I'm coming to understand that there is more to running a dbbackup/dblog sequence then just running that sequence. Such as using dbvalid at some point.

Wondering if anyone could provide detail on properly running this sequence: dbbackup then dblog. Again, I'm using dbbackup and dblog to:

  1. Create a test database away from the production environment.
  2. As a second backup to the Sybase event backup.

Appreciate the help.

VolkerBarth
Contributor

What exactly are you using DBLOG for?

Note, in order to take backups, there absolutely no need to use DBLOG - if you just want to make a backup of the transaction log (and not of the database file), this can be done with DBBACKUP -t (in combination with further options to rename/truncate the existing log).

DBLOG is usually only necessary if you want to move the log to a different location, stop (or restart) using a log or stop (or restart) using a mirror log.

Former Member
0 Kudos

I run dbbackup as such: dbbackup -d -r -t -c "dsn=**" c:temp

This produces a db file and log file. The log file is still tied to the live database and directory. When I try to dbeng the database I get errors. So, I use dblog. When I dblog it says "was using [log file name and location] and is now not using [log file]". Then I can run dbeng.

I run dblog as such: dblog -n -ir -is c:tempdatabase.db

VolkerBarth
Contributor
0 Kudos

May it be that your transaction log file is specified with an absolute path within your database - what does "DBLOG Yourdatabase.db" reveal?

If it does contain an absolute (or relative) path but should stay within the same directory as the database file, then I would recommend to use DBLOG once to change the location of the log (to be specified just as a file name without a path). After that, your database should be startable in any arbitrary directory and should expect its log file just there.

thomas_duemesnil
Participant
0 Kudos

I use a equal setup where the log file is on a separate disk/partition. I use this to reduce the file fragmentation on the db and the log files. When the database backup is finished my script automatically runs dblog to remove the log file path of the backup copy. These makes the handling easier.

Accepted Solutions (0)

Answers (1)

Answers (1)

JimDiaz
Participant

I think your backup command line is wrong, I would use dbbackup -c "dsn=xx" -r C:BackupDirectory

-t is transaction log only

for incremental backups in ASA9 I use -y -r -n -t -o "LogFileName" -c "Connection Parms" "Backup Directory"

I wouldn't dblog -n the database, instead I would use -t without a path.

Finally if you ever need to use this database to recover you won't be able to if you start it without it being set to read only.

Jim