Saturday, 15 February 2014

Important DBCC Commands & SP's

DBCC Commands and Stored procedures 


DBCC SHRINKDATABASE(database name)--Shrinks the database files--KEEP IN MASTER DATABASE
DBCC SHRINKFILE(databasename)--
DBCC DBREINDEX--fragmentation(
DBCC CHECKIDENT--(Checking identity)
DBCC SHOWCONTIG--
DBCC CHECKDB----
DBCC SHOWCONTIG WITH TABLERESULTS
DBCC INPUTBUFFER( )  --we get code from window

-- Clear the data and plan cache

DBCC DROPCLEANBUFFERS;
DBCC FREEPROCCACHE;

SP_WHO2
SP_help
SP_Helptext 'table name | procedure name'

sp_configure 'show advanced options',1
reconfigure
Note: 0 will de-activates the configure value
          1 will activates the value
Here Config_Value is 0. So we have 17 Records only
Step 2: Here Config_Value is 1. So we have more number of records

Step 3: Now i need to enable xp_cmdshell (take a look on above image last record . The config_value and run_value are 0 means inactive)
run the reconfigure

No comments:

Post a Comment

EMP, DEPT Sample script

/****** Object:  Table [dbo].[DEPT]    Script Date: 19-05-2016 06:58:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET A...