Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Unanswered: checking if a database can be dropped/renamed/exported

    Hi, I have searched for this question, could not find a similar question.

    I need to do an overnight rename of a DB but occasionally the rename fails with the message


    425: Database is currently opened by another user.

    107: ISAM error: record is locked.


    Is there a simple way to check from the script before I execute the rename if the DB is locked ?

    I guess the answer is onstat -g ses and then check each session and check the "Current Database field".

    However, the output of onstat -g ses <sid> is not the most friendly to parse, is there an alternative or an option to format the output of onstat to be more easily parsed or could I execute a query equivalent to onstat -g ses ?

    Thanks all for your help

  2. #2
    Join Date
    Mar 2012
    Location
    Somewhere In Europe
    Posts
    24
    Hi
    I also have such problem as yours. My database needs to be replaced for the fresh one after overnight import, script kills all open connections before rename.

    less killdbcon
    #/bin/sh

    onstat -g sql | grep "9\.03" | grep -v "-" | awk '{ print $1 }' |
    while read ans ; do
    onmode -z $ans
    echo "Killed db con: $ans"
    done

    Maybe it helps you.

    Regards
    Mike

  3. #3
    Join Date
    Mar 2013
    Posts
    2
    Mike,
    thanks a lot, I eventually found out about onstat -g sql to extract all sessions for a specific DB and then check them with onstat -g sess <sessionid>.
    I am not allowed to kill them so all I can do is detect the sessions and wait until they go away for a timeout period.
    One thing I discovered is that the session was an update statistics executed automatically by AUS.
    Unfortunately I am not the DBA, but I have to write these scripts with a lot of limitations on what I can do based on the DBAs guidelines.
    Thanks a lot for your reply and code.

    "Working on Informix against my own will"

  4. #4
    Join Date
    Sep 2011
    Location
    Pont l'Abbé, Brittany, France
    Posts
    381
    Provided Answers: 1
    AUS is generally launched if someone installed OAT. Unfortunately AUS is scheduled by default ( or estimates for AUS too).

    This task is to be cautiously evaluated before being scheduled.

    Check the OAT scheduler to eventually unschedule or schedule it on an more accurate manner

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •