sp_forceonline_db

Description

Provides access to all the pages in a database that were previously marked suspect by recovery.

Syntax

sp_forceonline_db dbname, 
	{"sa_on" | "sa_off" | "all_users"}

Parameters

dbname

is the name of the database to be brought online.

sa_on

allows only users with the sa_role access to the specified page.

sa_off

revokes access privileges created by a previous invocation of sp_forceonline_page with sa_on.

all users

allows all users access to the specified page.

Examples

Example 1

Allows the system administrator access to all suspect pages in the pubs2 database:

sp_forceonline_db pubs2, "sa_on"

Example 2

Revokes access to all suspect pages in the pubs2 database from the system administrator. Now, no one can access the suspect pages in pubs2:

sp_forceonline_db pubs2, "sa_off"

Example 3

Allows all users access to all pages in the pubs2 database:

sp_forceonline_db pubs2, "all_users"

Usage

Permissions

The permission checks for sp_forceonline_db differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be the database owner or a user with own database privilege.

Granular permissions disabled

With granular permissions disabled, you must be a user with sa_role.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

System procedures sp_forceonline_page, sp_listsuspect_db, sp_listsuspect_page, sp_setsuspect_granularity, sp_setsuspect_threshold