Tuesday, July 06, 2010

SQL SERVER Tweaks

Here are some shortcuts to monitor and admin SQL Server

Determines Server available disk space:
xp_fixeddrives

Determine Log Size Log Space used and status of the available databases

DBCC SQLPERF(LOGSPACE);
GO


Database size and service broker information:

DBCC CHECKDB

Uses to get information of the database work tables to hold intermediate results and for sort operations

How to get Current time and user information:

SELECT
    CURRENT_TIMESTAMP AS TIME,
    USER AS Username,
    SYSTEM_USER AS System_Username,
    CURRENT_USER AS Current_Username,
    SESSION_USER AS Session_Username

Monitoring SQL-Server:

sp_who2

Useful stored procedures:

sp_helpdb -- Displays information about all databases on the server
sp_helpdb ‘databasename’ -- Displays information about a particular database
sp_help objectname -- Displays information about a table
sp_spaceused -- Displays information about the space used in the current database
sp_tables -- Lists the tables in a database
sp_helptext name -- Displays the code used in a particular stored procedure
sp_dboption -- Sets or returns information about database options

Hope this helps.

No comments:

Post a Comment