Reference

System‑Administration Functions

SQL Server provides a set of system‑stored procedures and functions that help administrators monitor, configure, and manage databases and the server instance.

Key System‑Administration Stored Procedures

ProcedureDescription
sp_whoReturns information about current users, sessions, and processes.
sp_who2Extended version of sp_who with additional columns.
sp_helpdbDisplays information about databases on the server.
sp_helptextShows the definition of a stored procedure, trigger, view, or function.
sp_configureShows or changes server configuration options.
sp_lockDisplays current lock information.
sp_resetstatusResets the status of a suspect or emergency mode database.
sp_databasesLists databases and size information.
sp_spaceusedReports the amount of space used by a database or object.

Common Usage Examples

Viewing Active Sessions

EXEC sp_who2;

Checking Database Size

EXEC sp_spaceused N'MyDatabase';

Modifying a Server Option

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory (MB)', 4096;
RECONFIGURE;

Related Topics