Alguns comandos DBCC (não documentos)

Getting your Trinity Audio player ready...

ATENÇÃO: apenas para constar que NÃO me responsabilizo se você testar isso em seu ambiente e apresentar problemas

Vamos pelo básico,,,

Para listar os comandos DBCC: DBCC HELP(‘?’)

Para uma ajuda mais específica sobre um comando: DBCC HELP(‘SQLPERF’)

Bom,,, agora vem a parte divertida,,,

Para exibir os não documentados você precisa habilitar um TRACEON: DBCC TRACEON(2588) — O 2588 é para 2005 e 2008, para 7 e 2000 é 2520

Depois de habilitar o traceon execute um: DBCC HELP(‘?’) WITH NO_INFOMSGS

Agora vem um esquema camarada legal,,,

Salve o resultado em um arquivo. Ex.: c:\dbcc.txt

Crie uma tabela temporária e importe os registros do dbcc.txt

IF OBJECT_ID(‘tempdb.dbo.#dbccs’) IS NOT NULL
DROP TABLE #dbccs;
GO
CREATE TABLE #dbccs
(
[dbcc] nvarchar(4000) NOT NULL
);
GO
DECLARE @bulkcmd varchar(8000)
SET @bulkcmd = ‘BULK INSERT #dbccs
FROM N”C:\dbcc.txt”
WITH
(
ROWTERMINATOR = ”’ + NCHAR(10) + NCHAR(13) + NCHAR(10) + ”’,
DATAFILETYPE = ”widechar”
)’;
EXEC(@bulkcmd);– Execute o select abaixo e depois remova a tabela temporária
SELECT ‘DBCC HELP(”’ + [dbcc] + ”’) WITH NO_INFOMSGS’ FROM #dbccs ORDER BY [dbcc];
DROP TABLE #dbccs

Com o resultado do SELECT você terá algo como:

–DBCC HELP(‘activecursors’) WITH NO_INFOMSGS
–DBCC HELP(‘addinstance’) WITH NO_INFOMSGS
–DBCC HELP(‘auditevent’) WITH NO_INFOMSGS
–DBCC HELP(‘autopilot’) WITH NO_INFOMSGS
–DBCC HELP(‘buffer’) WITH NO_INFOMSGS
–DBCC HELP(‘callfulltext’) WITH NO_INFOMSGS
–DBCC HELP(‘checkalloc’) WITH NO_INFOMSGS
–DBCC HELP(‘checkcatalog’) WITH NO_INFOMSGS
–DBCC HELP(‘checkconstraints’) WITH NO_INFOMSGS
–DBCC HELP(‘checkdb’) WITH NO_INFOMSGS
–DBCC HELP(‘checkfilegroup’) WITH NO_INFOMSGS
–DBCC HELP(‘checkident’) WITH NO_INFOMSGS
–DBCC HELP(‘checkprimaryfile’) WITH NO_INFOMSGS
–DBCC HELP(‘checktable’) WITH NO_INFOMSGS
–DBCC HELP(‘cleanpage’) WITH NO_INFOMSGS
–DBCC HELP(‘cleantable’) WITH NO_INFOMSGS
–DBCC HELP(‘clearspacecaches’) WITH NO_INFOMSGS
–DBCC HELP(‘collectstats’) WITH NO_INFOMSGS
–DBCC HELP(‘config’) WITH NO_INFOMSGS
–DBCC HELP(‘cursorstats’) WITH NO_INFOMSGS
–DBCC HELP(‘dbinfo’) WITH NO_INFOMSGS
–DBCC HELP(‘dbrecover’) WITH NO_INFOMSGS
–DBCC HELP(‘dbreindex’) WITH NO_INFOMSGS
–DBCC HELP(‘dbreindexall’) WITH NO_INFOMSGS
–DBCC HELP(‘dbrepair’) WITH NO_INFOMSGS
–DBCC HELP(‘dbtable’) WITH NO_INFOMSGS
–DBCC HELP(‘debugbreak’) WITH NO_INFOMSGS
–DBCC HELP(‘deleteinstance’) WITH NO_INFOMSGS
–DBCC HELP(‘detachdb’) WITH NO_INFOMSGS
–DBCC HELP(‘dropcleanbuffers’) WITH NO_INFOMSGS
–DBCC HELP(‘dumptrigger’) WITH NO_INFOMSGS
–DBCC HELP(‘errorlog’) WITH NO_INFOMSGS
–DBCC HELP(‘extentinfo’) WITH NO_INFOMSGS
–DBCC HELP(‘fileheader’) WITH NO_INFOMSGS
–DBCC HELP(‘fixallocation’) WITH NO_INFOMSGS
–DBCC HELP(‘flush’) WITH NO_INFOMSGS
–DBCC HELP(‘flushprocindb’) WITH NO_INFOMSGS
–DBCC HELP(‘forceghostcleanup’) WITH NO_INFOMSGS
–DBCC HELP(‘free’) WITH NO_INFOMSGS
–DBCC HELP(‘freeproccache’) WITH NO_INFOMSGS
–DBCC HELP(‘freesessioncache’) WITH NO_INFOMSGS
–DBCC HELP(‘freesystemcache’) WITH NO_INFOMSGS
–DBCC HELP(‘freeze_io’) WITH NO_INFOMSGS
–DBCC HELP(‘help’) WITH NO_INFOMSGS
–DBCC HELP(‘icecapquery’) WITH NO_INFOMSGS
–DBCC HELP(‘incrementinstance’) WITH NO_INFOMSGS
–DBCC HELP(‘ind’) WITH NO_INFOMSGS
–DBCC HELP(‘indexdefrag’) WITH NO_INFOMSGS
–DBCC HELP(‘inputbuffer’) WITH NO_INFOMSGS
–DBCC HELP(‘invalidate_textptr’) WITH NO_INFOMSGS
–DBCC HELP(‘invalidate_textptr_objid’) WITH NO_INFOMSGS
–DBCC HELP(‘latch’) WITH NO_INFOMSGS
–DBCC HELP(‘lock’) WITH NO_INFOMSGS
–DBCC HELP(‘log’) WITH NO_INFOMSGS
–DBCC HELP(‘loginfo’) WITH NO_INFOMSGS
–DBCC HELP(‘mapallocunit’) WITH NO_INFOMSGS
–DBCC HELP(‘memorystatus’) WITH NO_INFOMSGS
–DBCC HELP(‘metadata’) WITH NO_INFOMSGS
–DBCC HELP(‘movepage’) WITH NO_INFOMSGS
–DBCC HELP(‘no_textptr’) WITH NO_INFOMSGS
–DBCC HELP(‘opentran’) WITH NO_INFOMSGS
–DBCC HELP(‘optimizer_whatif’) WITH NO_INFOMSGS
–DBCC HELP(‘outputbuffer’) WITH NO_INFOMSGS
–DBCC HELP(‘page’) WITH NO_INFOMSGS
–DBCC HELP(‘perfmon’) WITH NO_INFOMSGS
–DBCC HELP(‘persiststackhash’) WITH NO_INFOMSGS
–DBCC HELP(‘pintable’) WITH NO_INFOMSGS
–DBCC HELP(‘proccache’) WITH NO_INFOMSGS
–DBCC HELP(‘prtipage’) WITH NO_INFOMSGS
–DBCC HELP(‘readpage’) WITH NO_INFOMSGS
–DBCC HELP(‘resource’) WITH NO_INFOMSGS
–DBCC HELP(‘ruleoff’) WITH NO_INFOMSGS
–DBCC HELP(‘ruleon’) WITH NO_INFOMSGS
–DBCC HELP(‘semetadata’) WITH NO_INFOMSGS
–DBCC HELP(‘setcpuweight’) WITH NO_INFOMSGS
–DBCC HELP(‘setinstance’) WITH NO_INFOMSGS
–DBCC HELP(‘setioweight’) WITH NO_INFOMSGS
–DBCC HELP(‘show_statistics’) WITH NO_INFOMSGS
–DBCC HELP(‘showcontig’) WITH NO_INFOMSGS
–DBCC HELP(‘showdbaffinity’) WITH NO_INFOMSGS
–DBCC HELP(‘showfilestats’) WITH NO_INFOMSGS
–DBCC HELP(‘showoffrules’) WITH NO_INFOMSGS
–DBCC HELP(‘showonrules’) WITH NO_INFOMSGS
–DBCC HELP(‘showtableaffinity’) WITH NO_INFOMSGS
–DBCC HELP(‘showtext’) WITH NO_INFOMSGS
–DBCC HELP(‘showweights’) WITH NO_INFOMSGS
–DBCC HELP(‘shrinkdatabase’) WITH NO_INFOMSGS
–DBCC HELP(‘shrinkfile’) WITH NO_INFOMSGS
–DBCC HELP(‘sqlmgrstats’) WITH NO_INFOMSGS
–DBCC HELP(‘sqlperf’) WITH NO_INFOMSGS
–DBCC HELP(‘stackdump’) WITH NO_INFOMSGS
–DBCC HELP(‘tec’) WITH NO_INFOMSGS
–DBCC HELP(‘thaw_io’) WITH NO_INFOMSGS
–DBCC HELP(‘traceoff’) WITH NO_INFOMSGS
–DBCC HELP(‘traceon’) WITH NO_INFOMSGS
–DBCC HELP(‘tracestatus’) WITH NO_INFOMSGS
–DBCC HELP(‘unpintable’) WITH NO_INFOMSGS
–DBCC HELP(‘updateusage’) WITH NO_INFOMSGS
–DBCC HELP(‘useplan’) WITH NO_INFOMSGS
–DBCC HELP(‘useroptions’) WITH NO_INFOMSGS
–DBCC HELP(‘writepage’) WITH NO_INFOMSGS

Descomente a linha que quer ter mais informações e execute o DBCC.

Bom proveito,,,

Leave a Reply

Your email address will not be published. Required fields are marked *