[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null $s = New-Object ('Microsoft.SqlServer.Management.Smo.Server') ServerName $db = $s.Databases.item("databaseName") "status: " + $db.status + " isaccessible: " + $db.isaccessible
Example output:
Database status is normal
status: Normal isaccessible: True
This output is created by renaming the log file.
status: RecoveryPending isaccessible: False
For more status description, please refer to this Microsoft site.
No comments:
Post a Comment