Do this in a single script:
dbaccess sysmaster - <<EOF
SET LOCK MODE TO WAIT; -- infinite wait
RENAME DATABASE mydatabase TO mydatabase_locked;
EOF
Voila! As soon as all locks are removed from 'mydatabase' the rename will execute and you can do whatever you need to do before renaming it back.
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com------------------------------
Original Message:
Sent: Fri March 19, 2021 01:03 PM
From: Sergio Peres
Subject: database exclusive access
Hi,
I am having trouble making changes to some databases, I use a procedure that searches through syssessions and terminates all connections.
However I have noticed that some dirty reads sessions and also sometimes connections to sysmaster:sysdatabases remain.
If I run database <db> exclusive on my connection I get an error??!!
I would appreciate some help, as I have servers with multiple databases and putting the engine in single user mode is causing some problems.
Thanks in advance,
SP
------------------------------
Sergio Peres
AIRC
Coimbra
------------------------------
#Informix