Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: Locking Databases
Date: Dec 4 1997 4:03PM

Kevin Stussman wrote:
> We are using a HR/Benefits package (many table, many database, many
> interdependencies) that requires "select into / bulk copy" and "trunc
> log on checkpoint" on all the time (don't get me started on the whys of
> this...rrrrrgh)
> I'm using Datatools "SQL Backtrack for Sybase" to do backups, but am
> concerned that the backups will not have a consistent snapshot of the
> databases (i.e. user updates might occur in between backups on
> interdependent databases). The only solution I can think of is to write
> a sybperl script that will put all the databases (except master and
> tempdb) into read-only mode while the backups occur.

The problem is that you can't put the databases in read-only mode
if users are using them (ie if some user has done a 'use database'
for the database that you want to set to read-only).

The other option is to set the database to single user mode, but
for that you also need to make sure that no users are connected to
the databases.

If *no* clients execute any dbuse() or 'use database' commands then
it might be possible to set the databases to read-only, but you're
going to have to test the error messages and failure modes thoroughly
because I don't know what happens if you try to set a database to 
read-only when someone is running an update...

Michael Peppler       -||-  Data Migrations Inc.  -||-