Provides access to an index previously marked suspect by recovery.
sp_forceonline_object dbname, objname, indid, {sa_on | sa_off | all_users} [, no_print]
is the name of the database containing the index to be brought online.
is the name of the table.
is the index ID of the suspect index being brought online.
allows only users with the sa_role to access the specified index.
revokes access privileges created by a previous invocation of sp_forceonline_object with sa_on.
allows all users to access the specified index.
skips printing a list of other suspect objects after the specified object is brought online.
Allows a system administrator to access the index with indid 3 on the titles table in the pubs2 database:
sp_forceonline_object pubs2, titles, 3 , sa_on
Revokes access to the index from the system administrator. Now, no one has access to this index:
sp_forceonline_object pubs2, titles, 3, sa_off
Allows all users to access the index on the titles table in the pubs2 database:
sp_forceonline_object pubs2, titles, 3, all_users
If an index on a data-only-locked table has suspect pages, the entire index is taken offline during recovery. Offline indexes are not considered by the query optimizer. Indexes on allpages-locked tables are not taken completely offline during recovery; only individual pages of these indexes are taken offline. Use sp_forceonline_page to bring these pages online.
Use sp_listsuspect_object to see a list of databases that are offline.
To repair a suspect index, use sp_forceonline_object with sa_on access. Then, drop and re-create the index.
If the index is on systabstats or sysstatistics (the only data-only-locked system tables) call Sybase Technical Support.
sp_forceonline_object with all_users cannot be reversed. When an index has been brought online for all users, you cannot take it offline again.
An index that is forced online is not necessarily repaired, as corrupt indexes can be forced online. Adaptive Server does not perform any consistency checks on indexes that are forced online.
sp_forceonline_object cannot be used in a transaction.
sp_forceonline_object works only for databases in which the recovery fault isolation mode is “page.” Use sp_setsuspect_granularity to display the recovery fault isolation mode for a database.
To bring all of a database’s offline pages and indexes online in a single command, use sp_forceonline_db.
The permission checks for sp_forceonline_object 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. |
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 |
|
Documents For more information on recovery fault isolation, see the System Administration Guide.
System procedures sp_listsuspect_object, sp_setsuspect_granularity