Locking out users from a database

>   Chris Roberts  wrote:
> >
> > Is it possible to,(and if so how) 'lock' users out of a database. I.e. to
> > mark the database as unavailable to all users but still be able to access
> > it to do maintenance.
> >
> > Chris Roberts
> > South African National Parks
> > e-mail:    ChrisR@parks-sa.co.za
> 
> Yes.  This is how, but you must be the DBA.
> 
> $SQL -UUSERNAME DATABASE NAME "+U"  Ths will lock out all users
> at this time.  But all users must be out first or it will not work.


Hi There,

The '+U' flag indicates you wish to do some heavy work on catalogs! I wouldnt
use this unless thats precisely what you wish to do. The '+Y' flag is ditto in
that regards. The better option is:

Try sql -l +w ...

    This will lock (-l) the database and will wait (+w) until it can get a lock.
    Note, that existing users will continue until they exit. Other users
    attempting access will queue up behind you. This may be messy! I have
    found that most times I dont necessarily need an exclusive lock just an
    idle database. Furthermore, locking a production database is not a nice
    thing to do. Generally I find it easier to run such code late at night and
    then use auditdb to determine if any user activity has occurred that may
    have spoiled whatever I was trying to do. Depends upon your circumstances
    entirely.

Or, In iimonitor, 'set server closed' is also an option but that is a little
more gung-ho than is probably required.


Martin Bowes.

bowes@asis.unimelb.edu.au
Ingres Q & A
Back to William's Home Page

© William Yuan 2000

Email William