11 March 2013

Database details



SP_HELPDB AND SEE THE STATUS COLUMN

OR

SELECT * FROM master.dbo.sysdatabases


Ex:
SELECT name 
       
DATABASEPROPERTYEX(name'Recovery'), 
       
DATABASEPROPERTYEX(name'Status') 
FROM   master.dbo.sysdatabases 
ORDER BY 1

Value
Description
Value returned
IsAutoClose
Database shuts down cleanly and frees resources after the last user exits.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsAutoCreateStatistics
Existing statistics are automatically updated when the statistics become out-of-date because the data in the tables has changed.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsAutoShrink
Database files are candidates for automatic periodic shrinking.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsAutoUpdateStatistics
Auto update statistics database option is enabled.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsPublished
The tables of the database can be published for snapshot or transactional replication, if replication is installed.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsSubscribed
Database can be subscribed for publication.
1 = TRUE
0 = FALSE
NULL = Invalid input
IsTornPageDetectionEnabled
Microsoft® SQL Server™ detects incomplete I/O operations caused by power failures or other system outages.
1 = TRUE
0 = FALSE
NULL = Invalid input
Recovery
Recovery model for the database.
FULL = full recovery model
BULK_LOGGED = bulk logged model
SIMPLE = simple recovery model
Status
Database status.
ONLINE = database is available for query
OFFLINE = database was explicitly taken offline
RESTORING = database is being restored
RECOVERING = database is recovering and not yet ready for queries
SUSPECT = database cannot be recovered
Updateability
Indicates whether data can be modified.
READ_ONLY = data can be read but not modified
READ_WRITE = data can be read and modified
UserAccess
Indicates which users can access the database.
SINGLE_USER = only onedb_ownerdbcreator, orsysadmin user at a time
RESTRICTED_USER = only members of db_owner,dbcreator, and sysadminroles
MULTI_USER = all users
Version
Internal version number of the Microsoft SQL Server code with which the database was created. For internal use only by SQL Server tools and in upgrade processing.
Version number = Database is open
NULL = Database is closed

1 comment:

  1. Yes shiva, this query is very useful for me.......

    ReplyDelete