DB Status

  • Hi,

    If i would like to know, whether a particular DB is online or has gone to a suspect mode, can i use the following query, so that once the status is suspect we can send a mail to the Administrator to look into it.

    Please suggest if there is any other way to find the status of the DB, if the DB has entered into a Suspect mode can i send mail.

    SELECT Convert(Varchar(20),DATABASEPROPERTYEX('dbsub', 'Status'))

  • dakshinamurthy (3/20/2008)


    Hi,

    If i would like to know, whether a particular DB is online or has gone to a suspect mode, can i use the following query, so that once the status is suspect we can send a mail to the Administrator to look into it.

    Please suggest if there is any other way to find the status of the DB, if the DB has entered into a Suspect mode can i send mail.

    SELECT Convert(Varchar(20),DATABASEPROPERTYEX('dbsub', 'Status'))

    That would work. Something like:

    IF DATABASEPROPERTYEX('dbsub', 'Status') <> 'ONLINE'

    EXEC sp_send_dbmail ...

  • Select name, state_desc from sys.databases

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks a lot

  • Thanks a lot

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

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