Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 2.32 KB

File metadata and controls

68 lines (47 loc) · 2.32 KB
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
sp_resetstatus
sp_resetstatus_TSQL
helpviewer_keywords
sp_resetstatus
dev_langs
TSQL

sp_resetstatus (Transact-SQL)

[!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

Syntax

sp_resetstatus [ @DBName = ] N'DBName'
[ ; ]

Arguments

[ @DBName = ] N'DBName'

The name of the database to reset. @DBName is sysname, with no default.

Return code values

0 (success) or 1 (failure).

Remarks

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.

Permissions

Requires membership in the sysadmin fixed server role, or execute permission directly on this stored procedure.

Examples

The following example resets the status of the [!INCLUDE sssampledbobject-md] database.

EXECUTE sp_resetstatus 'AdventureWorks2022';

Related content