| title | sp_resetstatus (Transact-SQL) | ||
|---|---|---|---|
| description | sp_resetstatus resets the status of a suspect database. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Resets the status of a suspect database.
Important
[!INCLUDE ssNoteDepFutureAvoid] Use ALTER DATABASE instead.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_resetstatus [ @DBName = ] N'DBName'
[ ; ]
The name of the database to reset. @DBName is sysname, with no default.
0 (success) or 1 (failure).
sp_resetstatus turns off the suspect flag on a database. This procedure updates the mode and status columns of the named database in sys.databases. The [!INCLUDE ssNoVersion] error log should be consulted and all problems resolved before running this procedure. Stop and restart the instance of [!INCLUDE ssNoVersion] after you execute sp_resetstatus.
A database can become suspect for several reasons. Possible causes include denial of access to a database resource by the operating system, and the unavailability or corruption of one or more database files.
Requires membership in the sysadmin fixed server role, or execute permission directly on this stored procedure.
The following example resets the status of the [!INCLUDE sssampledbobject-md] database.
EXECUTE sp_resetstatus 'AdventureWorks2022';