Monday, 23 November 2009

DBCC Commands

Important DBCC Command
-- Shrink Database

USE [Employee]
GO
DBCC SHRINKDATABASE(N'Employee', 4 )
GO


-- Find out the
constraints in the current database
DBCC CHECKCONSTRAINTS
-- Find out the constraints in the particular table  
DBCC CHECKCONSTRAINTS ('table1')
DBCC CHECKCONSTRAINTS ('Employee')

-- To Clean the table space after a column is dropped from the database 
DBCC CLEANTABLE ('MyDatabase', 'MyTable')
DBCC CLEANTABLE ('Company', 'Employee')



-- To Find the LogSpace
DBCC SQLPERF(LOGSPACE)
Exec ('DBCC SqlPerf (logspace)')

DBCC SqlPerf (UmsStats)
Exec ('DBCC SqlPerf (UmsStats)')

-- To retrivew the servers resources wait types
DBCC SqlPerf (WaitStats)
Exec ('DBCC SqlPerf (WaitStats)')

-- Retrieves information about your server’s outstanding
DBCC SqlPerf (IoStats)
Exec ('DBCC SqlPerf (IoStats)')

-- Retrieves information about your servers read-ahead statistics
DBCC SqlPerf (RaStats)
Exec ('DBCC SqlPerf (RaStats)')

-- Retrieves information for the server’s currently running threads
DBCC SqlPerf (Threads)
Exec ('DBCC SqlPerf (Threads)')

No comments:

Post a Comment