Informix

 View Only
  • 1.  database exclusive access

    Posted Fri March 19, 2021 01:04 PM
    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


  • 2.  RE: database exclusive access

    IBM Champion
    Posted Fri March 19, 2021 01:40 PM
    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
    ------------------------------



  • 3.  RE: database exclusive access

    Posted Sun March 21, 2021 01:09 PM
    Thanks for help Art, it works perfect.

    Best regards,

    SP

    ------------------------------
    Sergio Peres
    AIRC
    Coimbra
    ------------------------------



  • 4.  RE: database exclusive access

    IBM Champion
    Posted Mon May 03, 2021 03:49 PM

    Hi,

    Use onstat -g opn to find sessions with relevant partitions open.

    Regards,
    David.

    ------------------------------
    David Williams
    ------------------------------