|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 8:27 AM
Points: 329,
Visits: 890
|
|
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'))
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 5:38 AM
Points: 870,
Visits: 858
|
|
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 ...
Karl source control for SQL Server
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:13 PM
Points: 38,096,
Visits: 30,390
|
|
Select name, state_desc from sys.databases
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP 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
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 8:27 AM
Points: 329,
Visits: 890
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 8:27 AM
Points: 329,
Visits: 890
|
|
|
|
|