You can check Database Status using SQL query.
Below are the possible status of database.
Here is query for this.
Output :
Below are the possible status of database.
- ONLINE : Database is available for access.
- RESTORING : Primary file group and secondary files are being restored.
- RECOVERING : Database is being recovered.
- RECOVERY PENDING : Resource-related error occurred during recovery.
- OFFLINE : Database is unavailable to access.
- SUSPECT : One or many primary file group is suspect and may be damaged.
- EMERGENCY : User has changed the database and set the status to EMERGENCY.
Here is query for this.
SELECT DATABASEPROPERTYEX('NorthWind', 'Status') Database_Status SELECT state_desc Database_Status FROM sys.databases WHERE name = 'NorthWind'
Output :
(To view original image , click on image) |
This is very useful SQL Server Scripts. Visit this link for more useful SQL Server Scripts. Click Here...
for effective administrative performance on sql server seek advice from
ReplyDeletesql server programmer.for further information take the help of sql server notes.