How to query for database transition status?

  • Is it all possible to query any system table/dmv to determine if a database is in a transition status?

    Thanks

  • What do you mean by transition?

    The status of a database can be gained from DATABASEPROPERTYEX:

    [font="Courier New"]select name, databasepropertyex(name, 'Status')

    from master.sys.databases

    [/font]

    This will return one of: ONLINE, OFFLINE, RESTORING, RECOVERING, SUSPECT, EMERGENCY

    for each database in an instance.



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • you can also refer (Scott's quer is part of sp_helpdb)

    sp_helpdb

    See the status of the database.

    I think Scott's query is more close to your requirement.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • Yeah I went to databasepropertyex right away as well, but the status reported was online.

    Basically, I attempted to take a database offline that still had active connections, during this time, If I attempted to query the database, I received the message that the database is in transition.

    I need to figure out how to query for this status.

    Thanks

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply