블로그 이미지
LifeisSimple

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

Notice

'dbcc'에 해당되는 글 3

  1. 2012.02.05 [MSSQL] DBCC Trace Flag 정리
  2. 2011.09.20 [MSSQL] DBCC MEMORYSTATUS
  3. 2010.11.16 SQL Server 2005 DBCC Command Quick Reference
2012. 2. 5. 23:13 Brain Trainning/DataBase

Trace Flag 관련해서 잘 정리해 놓으신것 같습니다.  (시퀄 메거진을 보면 가끔씩 이분의 글들이 보이죠... )

출처 : 
http://sqlserverpedia.com/wiki/Trace_Flags 

Kevin Kline

Kevin Kline

Kevin Kline is the Technical Strategy Manager for SQL Server Solutions at Quest Software, a leading provider of award winning tools for database management and application monitoring. He is a founding board member and former President of the international Professional Association for SQL Server (PASS) and frequently contributes to database technology magazines, web sites, and discussion forums. Kevin also serves the community as an adviser to SQL Saturday education program as well as a curriculum adviser for both the University of Washington and Purdue University at Calumet in their IT and Computer Science departments.

Kevin’s most popular book is SQL in a Nutshell (now in its third edition) published by O’Reilly Media. Kevin is also author or co-author on seven other IT books, including Transact-SQL Programming, Database Benchmarking: A Practical Approach, and Professional SQL Server 2008 Relational Database Design and Optimization.

A top rated speaker, He appears at international conferences like Microsoft TechEd, DevTeach, PASS, Microsoft IT Forum, SQL Connections, and the Best Practices Conference.

Beginning his career as a lowly hardware jockey working with PC’s, Digital VAX, and Intergraph Unix workstations, Kevin has worked on multiple large-scale database projects throughout his career at Deloitte & Touche, NASA and the U.S. Army.

When Kevin isn’t working on technology issues, he enjoys spending time with his wife Rachel, his four kids, his three step kids, and his Basset Hound and Ginger Kitty.

His online presences include:

Trace flags can be used to alter SQL Server behavior temporarily. Trace flags can be turned on for a specific connection, or server-wide. Trace flags can be a great tool for troubleshooting a particular issue, however be forewarned: some trace flags are dangerous - use them at your own risk and be prepared to rebuild the server from scratch. Furthermore, functionality of certain trace flags might not be supported in future versions of SQL Server, so definitely avoid setting trace flags in your T-SQL code. We strongly recommend against using undocumented trace flags on production systems unless you're directed to do so by Microsoft's technical support. 

To turn on a particular trace flag for a given connection, you execute the DBCC TRACEON command with the trace flag number specified in parenthesis, as follows:
1./* send the output of DBCC commands to the client */  DBCC TRACEON (3604)


To enable a trace flag on the SQL Server instance level you need to start SQL Server with the /T parameter followed by the trace flag number. If you start SQL Server with a trace flag, all connections will automatically have the same trace flag turned on. For example, to collect deadlock related information you could start the default instance of the SQL Server instance from the command prompt as follows:
1.NET START MSSQLSERVER /T1205


You can check the status of a particular trace flag by executing DBCC TRACESTATUS. Turn off a previously turned on trace flag using DBCC TRACEOFF. For example:
1.DBCC TRACESTATUS(3604)  DBCC TRACEOFF(3604)


You can check all trace flags turned on for the current connection by passing -1 as the parameter of DBCC TRACESTATUS, for example:
1.DBCC TRACESTATUS(-1)


Results:
1.TraceFlag  Status   ---------  ------   2520       1  3604       1


If you have no trace flags turned on, SQL Server will return the following message:
1.Trace option(s) not enabled for this connectionUse 'DBCC TRACEON()'.


Next, we discuss some of the more frequently used trace flags. As mentioned above, some of these can be very powerful and therefore should be handled with care.

Contents

[hide]

DBCC TRACEON / TRACEOFF (-1)



This flag advises SQL Server to turn on the trace flags turned on for the current connection on all subsequent client connections. For example, if you have turned on 3604 and 2520 on the current connection and you execute DBCC TRACEON(-1) all subsequent connections to the server will have 3604 and 2520 turned on. Similarly, if you wish to turn a particular trace flag for all connections simply execute it along with -1, as in DBCC TRACEON(-1, 3604). Executing DBCC TRACEOFF(-1) will automatically turn off all trace flags on the current and any subsequent connections.

DBCC TRACEON (2528)



This flag disables parallelism during executing of maintenance DBCC statements, such as DBCC CHECKDB, DBCC CHECKFILEGROUP and DBCC CHECKTABLE. By default SQL Server will determine the needed degree of parallelism during query execution. Usually it is recommended to let SQL Server decide whether parallelism will be useful. Occasionally, if you only wish to use a single processor for DBCC statements, you might wish to override the default behavior. Remember that turning off parallelism might increase the total time required for executing DBCC commands.

DBCC TRACEON(3604) and DBCC TRACEON(3605)



The first flag (3604) sends the output of (some) DBCC commands and trace flags to the Query Analyzer; 3605 sends the same output to SQL Server error log. For example, the following commands will generate a list of the 10 longest buffer chains in Query Analyzer:
1.DBCC TRACEON(3604)  DBCC BUFCOUNT


Results:
1.**** THE 10 LONGEST BUFFER CHAINS ****       bucket number = 514     chain size = 3     bucket number = 522     chain size = 2     bucket number = 770     chain size = 2     bucket number = 1026    chain size = 2     bucket number = 269     chain size = 1     bucket number = 272     chain size = 1     bucket number = 274     chain size = 1     bucket number = 281     chain size = 1     bucket number = 283     chain size = 1     bucket number = 284     chain size = 1    The Smallest Chain Size is: 0    The Average Chain Size is: 0.005066


If you turn off 3604 and turn on 3605, instead you'll get the same result in the error log. You can double check this by executing the following:
1.EXEC master..xp_readerrorlog


Abbreviated results:
1.ERRORLOG                                                                        ContinuationRow  2003-10-24 21:00:31.51 spid51       bucket number = 514       chain size= 3    0  2003-10-24 21:00:31.51 spid51       bucket number = 522       chain size = 2    0  2003-10-24 21:00:31.51 spid51       bucket number = 770       chain size = 2    0  2003-10-24 21:00:31.51 spid51       bucket number = 1026      chain size = 2    0  2003-10-24 21:00:31.51 spid51       bucket number = 269       chain size = 1    0  2003-10-24 21:00:31.51 spid51       bucket number = 272       chain size = 1    0  2003-10-24 21:00:31.51 spid51       bucket number = 274       chain size = 1    0  2003-10-24 21:00:31.51 spid51       bucket number = 281       chain size = 1    0  2003-10-24 21:00:31.51 spid51       bucket number = 283       chain size = 1    0  2003-10-24 21:00:31.51 spid51       bucket number = 284       chain size = 1    0  2003-10-24 21:00:31.51 spid51      The Smallest Chain Size is: 0                0  2003-10-24 21:00:31.51 spid51      The Average Chain Size is: 0.005066          0


DBCC TRACEON(1204) , DBCC TRACEON(1205) and DBCC TRACEON(1206)



These trace flags are used to troubleshoot deadlocks. 1204 returns deadlock chains and the victim SPID. 1205 returns the details of the commands (stack traces) involved in the deadlock. Along with these flags you should also turn on 3605 to send the output of the trace to the SQL Server error log. 1206 can be used to supplement the information collected by the other two trace flags by returning all lock activities performed by deadlocked connections. The output of 1206 can be very large. 

If you wish to see what deadlock output looks like, simply open two connections to the same SQL Server instance through Query Analyzer and execute following on one of them:
1.DBCC TRACEON(-1, 1204)  DBCC TRACEON(-1, 1205)  DBCC TRACEON(-1, 3605)


Next execute the following on the first connection:
1.USE pubs  BEGIN TRAN  UPDATE titles   SET title = 'deadlock battle'    WAITFOR DELAY'00:00:05'    UPDATE authors   SET address = '110 north main'


At the same time execute the following script from the other connection:
1.USE pubs  BEGIN TRANSACTION  UPDATE authors   SET address = '115 East 43rd street'   UPDATE titles   SET title = 'who can win?'


One of these connections will be chosen as a deadlock victim and its transaction will be aborted by SQL Server. Now if you read the error log, you will find entries similar to the following:
1.spid4     ----------------------------------      spid4     Starting deadlock search 1     spid4     Target Resource Owner:       spid4      ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )               Value: x1916eb4     spid4      Node:1  ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )               Value: x1916eb4     spid4     spid4     End deadlock search 1 ... a deadlock was not found.      spid4     ----------------------------------      spid4    ----------------------------------    spid4     Starting deadlock search 2      spid4     Target Resource Owner:      spid4      ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756 )                Value: x1916e72     spid4      Node:1  ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756 )                Value: x1916e72     spid4      Node:2  ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:(x195 756 )                Value: x1916eb4     spid4      Cycle:  ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756 )                Value: x1916e72      spid4       spid4       spid4     <b>Deadlock cycle was encountered .... verifyingcycle</b>     spid4      Node:1  ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:(x1947756 )                Value: x1916e72  Cost:( /16  )    spid4      Node:2  ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )                Value: x1916eb4  Cost:( /B88)     spid4      Cycle:  ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756 )                Value: x1916e72  Cost:( /16  )    spid4     spid4   <b>Deadlock encountered .... Printing deadlock information</b>     spid4     spid4     Wait-for graph     spid4     spid4     Node:1    spid4     KEY: 5:1977 58 79:1 ( 1 1aedb232b) CleanCnt:1 Mode: X Flags:  x    spid4      Grant List::    spid4        Owner: x1916ee2  Mode: X        Flg: x  Ref:  Life: 2       SPID:53 ECID:    spid4        SPID: 53 ECID:   Statement Type: UPDATE Line #: 1    spid4        Input Buf:Language Event: <b>begin tran   update authors set address = '115 East 43rd street '  update titles set title = 'who can win?'</b>     spid4      Requested By:     spid4        ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756)                  Value: x1916e72  Cost:( /16  )    spid4       spid4     Node:2     spid4     KEY: 5:2121 58592:1 (a7  64fb1eac) CleanCnt:1 Mode: X Flags:  x     spid4     Grant List::     spid4        Owner: x191813   Mode: X        Flg: x  Ref:  Life: 2       SPID:52 ECID:    spid4        SPID: 52 ECID:   Statement Type: UPDATE Line #: 1    spid4        Input Buf: Language Event: <b>begin tran   update titles set title=' deadlock battle''    waitfor delay '  :  : 5'  update authors set address='110 north main'</b>     spid4      Requested By:     spid4        ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )                  Value: x1916eb4  Cost:( /B88)    spid4     Victim Resource Owner:     spid4      ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )                Value: x1916eb4  Cost:( /B88)    spid4     spid4     <b>End deadlock search 2 ... a deadlock was found.</b>     spid4     ----------------------------------     spid4     ----------------------------------     spid4     Starting deadlock search 3    spid4     Target Resource Owner:     spid4      ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )                Value: x1916eb4     spid4      Node:1  ResType:LockOwner Stype:'OR' Mode: U SPID:53 ECID:  Ec:( x195 756 )                Value: x1916eb4     spid4      Node:2  ResType:LockOwner Stype:'OR' Mode: U SPID:52 ECID:  Ec:( x1947756 )                Value: x1916e72     spid4     spid4     <b>Previous victim encountered ... aborting search</b>          spid4     spid4     End deadlock search 3 ... a deadlock was not found.        spid4    ----------------------------------


If you had also turned on trace flag 1206 you would get numerous messages similar to the following in the error log:
1.Process 52 acquiring IX lock on PAG: 5:1:99 (class bit2000000 ref1)   result: OK  Process 52 acquiring X lock on KEY: 5:2121058592:1 (b60057ff7752) (class bit2000000 ref1)  result: OK  Process 52 releasing lock reference on KEY: 5:2121058592:2 (9002e988d824) Process 5 releasing all locks @19116B3C


DBCC TRACEON(3205)



This flag disables hardware compression for tape drives. If the tape drive supports the compression, the BACKUP statement that backs up the database directly to tape will take advantage of hardware compression. If you must exchange tapes with another office where hardware compression is not supported, you might wish to turn on trace flag 3205 so that your tapes are compatible with the other office's hardware.

DBCC TRACEON (4013)



This flag can be used to audit connections to the server. When turned on, the SQL Server error log will contain an entry for each successful connection. The log entry will look similar to the following:
1.Login: johndoe BP-5CHSFFH2HEJ1johndoejohndoeSQL Query AnalyzerBP-5CHSFFH2HEJ1ODBCmaster,   server process ID (SPID): 55, kernel process ID (KPID): 55.


As you might imagine the error log on a busy server will grow quite voluminous if this flag is turned on.

DBCC TRACEON(4022)



This flag is used to bypass procedures marked for automatic execution at startup. Note that automatically executed procedures are also skipped if SQL Server is started with minimal configuration.

DBCC TRACEON(2520)



This flag can be used to force DBCC HELP to return syntax of undocumented DBCC statements. If 2520 is not turned on, DBCC HELP will refuse to give you the syntax stating: "No help available for DBCC statement 'undocumented statement'".

DBCC TRACEON(2588)



This flag can be used to force DBCC HELP to return syntax of undocumented DBCC statements in SQL Server 2005 and 2008.
1.DBCC TRACEON (2588);DBCC HELP ('?') GO DBCC TRACEOFF (2588);


DBCC TRACEON(1200)



This flag can be used to get a detailed report of all locks acquired by each SQL statement on the current connection - the output can be large depending on the number of rows involved. For example, take a look at the output of the following simple query:
1.SELECT a.au_id, b.royaltyper  FROM authors a INNER JOIN titleauthor b  ON a.au_id =b.au_id  ORDER BY 2


Results (abbreviated):
1.Process 54 acquiring IS lock on TAB: 5:53575229 [] (class bit0 ref1) result: OK  Process 54 acquiring IS lock on TAB: 5:1977058079 [] (class bit0 ref1) result: OK  Process 54 acquiring IS lock on PAG: 5:1:148 (class bit0 ref1) result: OK  Process 54 acquiring ISlock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102(class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lockon PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock on PAG: 5:1:102 (class bit0 ref1)result: OK  Process 54 releasing lock on PAG: 5:1:102  Process 54 acquiring IS lock onPAG: 5:1:102 (class bit0 ref1) result: OK  Process 54 releasing lock on PAG: 5:1:102  …


DBCC TRACEON (1807)



This flag can be used to allow the creation of database files on a network share. You must specify a valid UNC path to the share in order to create database and log files.
1.DBCC TRACEON(3607)DBCC TRACEON(3608) and DBCC TRACEON(3609)


These flags can be used to skip the recovery process during SQL Server startup. 3607 does not recover any databases, 3608 recovers the master only. In addition, both trace flags cause SQL Server to skip stored procedures marked for automatic execution. Trace flag 3609 skips creation and clearing of tempdb at startup. Warning: do NOT use trace flags 3607-3609 unless you are directed to do so by Microsoft support professional.

DBCC TRACEON(4030), DBCC TRACEON(4031) and DBCC TRACEON(4032)



Flags 4030 and 4031 can be used to write the SQL statements submitted and output returned to the connections. Their functionality is similar to DBCC INPUTBUFFER and DBCC OUTPUTBUFFER respectively. The difference is that trace flags record all information in the error log for all connections. For example, we can set both of these flags globally and send the output to the error log with the following:
1.DBCC TRACEON(-1, 4031)  DBCC TRACEON(-1, 4030)  DBCC TRACEON(-1, 3605)


Next, execute a simple statement such as:
1.SELECT TOP * FROM authors


You will see entries similar to the following in the error log:
1.2003-10-24 23:09:08. spid52     Printing receive buffer:  01 01 00 42 00 00 01 00 53 00 45 00 4C 00 45 00   ...B....S.E.L.E.  43 00 54 00 20 00 54 00 4F 00 50 00 20 00 31 00   C.T. .T.O.P. .1.  20 00 2A 00 20 00 46 00 52 00 4F 00 4D 00 20 00    .*. .F.R.O.M. .    2003-10-24 23:09:08.78 spid52    61 00 75 00 74 00 68 00 6F 00 72 00 73 00 0D 00   a.u.t.h.o.r.s...      2003-10-24 23:09:08. spid52     Printing send buffer:     04 01 01 41 00 34 01 00 81 09 00 01 01 08 00 A7   ...A.4..........  0B 00 09 04 D0 00 34 05 61 00 75 00 5F 00 69 00   ......4.a.u._.i.  64 00 00 00 08 00 A7 28 00 09 04 D0 00 34 08 61   d......(.....4.a  00 75 00 5F 00 6C 00 6E 00 61 00 6D 00 65 00 00   .u._.l.n.a.m.e..  00 08 00 A7 14 00 09 04 D0 00 34 08 61 00 75 00   ..........4.a.u.  5F 00 66 00 6E 00 61 00 6D 00 65 00 00 00 08 00   _.f.n.a.m.e.....  AF 0C 00 09 04 D0 00 34 05 70 00 68 00 6F 00 6E   .......4.p.h.o.n  00 65 00 00 00 09 00 A7 28 00 09 04 D0 00 34 07   .e......(.....4.


Flag 4032 can be used to record every SQL statement executed against the server in the error log. The log entries will look similar to the following:
1.Text:use [pubs]  ODS Event: Language Exec  Text:SELECT TOP * FROM authors


DBCC TRACEON(8202)



Used for replication, this flag forces SQL Server to replicate UPDATE statements as DELETE followed by an INSERT. This behavior could be useful if you wish to perform custom processing in replication stored procedures. For instance, you could write a record to the audit table every time record is updated through replication.
posted by LifeisSimple
2011. 9. 20. 16:13 Brain Trainning/DataBase

DBCC MEMORYSTATUS 명령을 사용하여 SQL Server 2005 메모리 사용을 모니터링하는 방법

이 페이지에서

요약

DBCC MEMORYSTATUS 명령의 출력을 설명합니다. 이 명령은 Microsoft SQL Server 메모리 소비가 문제를 해결하는 데 자주 사용됩니다.

이 문서에서는 메모리 관리자에 대한, 메모리 사용 현황 요약, 집계 메모리 내용은, 버퍼 배포 정보에 대한, 버퍼 풀 내용은 및 프로시저 캐시 정보 출력 요소에 대해 설명합니다. 출력 전역 메모리 개체, 쿼리 메모리 개체에 대한, 최적화에 대한 및 대한 메모리 중개업자. 설명합니다

소개

DBCC MEMORYSTATUS 명령 Microsoft SQL Server의 현재 메모리 상태 스냅샷을 제공합니다. 이 명령의 출력을 SQL Server 에서 메모리 소비 문제 해결 또는 특정 메모리 부족 오류를 해결하는 데 사용할 수 있습니다. 많은 메모리 부족 오류를 자동으로 이 출력 오류 로그에 인쇄합니다. 또한 Microsoft 고객 지원 서비스에 메모리 부족 조건을 가진 연관될 수 있는 오류가 발생하는 경우 중에 특정 지원 문제점을 이 명령을 실행하도록 요청할 수 있습니다.

참고 AWE 주소 창 작업 확장을 지원이 설정된 경우에만 성능 모니터 (PerfMon) 작업 관리자의 메모리를 올바르게 계정 및 작업을지 않습니다.

이 문서에서는 일부 DBCC MEMORYSTATUS 명령의 출력에서 얻을 수 있는 데이터를 설명합니다. 이 문서에서는 여러 부분을 여기에 설명된 독점적 구현 세부 사항을 포함합니다. Microsoft 고객기술지원부에 됩니다 질문에 않거나 이 문서에서 제공하는 정보 외에 특정 카운터의 의미에 대한 자세한 정보를 제공합니다.

추가 정보

중요한 DBCC MEMORYSTATUS 명령을 위한 Microsoft 고객기술지원부에 진단 도구가 될 것입니다. 출력 형식 및 제공되는 세부 수준을 서비스 팩 및 제품 릴리스 간에 변경될 수 있습니다. DBCC MEMORYSTATUS 명령을 제공하는 기능에 이후 제품 버전에서 다른 메커니즘을 바꿀 수 있습니다. 따라서 이후 제품 버전에서 이 명령은 더 이상 작동하지 않을 수 없습니다. 이 명령을 변경하거나 제거하기 전에 추가 경고가 수 있게 됩니다. 따라서 이 명령을 사용하여 응용 프로그램을 경고 없이 중단될 수 있습니다.

DBCC MEMORYSTATUS 명령의 출력을 통해 SQL Server의 이전 릴리스에서 변경되었습니다. 출력 이제 이전 제품 버전에서 사용할 수 없는 몇 가지 섹션을 포함합니다.

메모리 관리자

첫 번째 섹션은 출력 메모리 관리자가 있습니다. 이 단원에서는 SQL Server 전체 메모리 사용량을 보여 줍니다.
   Memory Manager                 KB 
   ------------------------------ --------------------
   VM Reserved                    1761400
   VM Committed                   1663556
   AWE Allocated                  0
   Reserved Memory                1024
   Reserved Memory In Use         0

   (5 row(s) affected)
이 섹션의 요소는 다음과 같습니다.
  • VM 예약: 이 값은 SQL Server 예약한 가상 주소 공간 (VAS) 전체 양을 보여 줍니다.
  • VM 규정: 이 값은 SQL Server 커밋되었음을 VAS 전체 양을 보여 줍니다. 커밋된 VAS 실제 메모리를 사용하여 연결되어 있습니다.
  • AWE 할당: 이 값은 32 비트 버전의 SQL Server에 AWE 메커니즘을 통해 할당된 메모리의 전체 양을 보여 줍니다. 또는, 이 값을 제품 64비트 버전의 페이지를 잠근 메모리의 전체 양을 소비하는 보여 줍니다.
  • 예약된 메모리: 이 값은 관리자 전용된 연결 (DAC) 예약된 메모리를 보여 줍니다.
  • 사용 예약된 메모리: 이 값은 사용되고 예약된 메모리를 보여 줍니다.

메모리 사용 요약

메모리 관리자 섹션은 각 메모리 노드에 대한 메모리 사용 요약 다음에 올 수 있습니다. 비-균일 메모리 액세스 가능 (NUMA) 시스템에서 각 하드웨어 NUMA 노드에 대해 해당 메모리 노드 항목을 없게 됩니다. SMP 시스템에서 단일 메모리 노드 항목을 없게 됩니다. 

참고 메모리 노드 ID 하드웨어 노드 ID가 일치하지 않을
   Memory node Id = 0             KB 
   ------------------------------ --------------------
   VM Reserved                    1757304
   VM Committed                   1659612
   AWE Allocated                  0
   MultiPage Allocator            10760
   SinglePage Allocator           73832

   (5 row(s) affected)
노트 이 NUMA 노드에서 실행 중인 스레드에 의해 할당된 메모리 이러한 값을 보여줍니다. 이러한 값은 NUMA 노드 로컬 메모리 않습니다.

이 섹션의 요소는 다음과 같습니다.
  • VM 예약: 이 값은 이 노드에서 실행 중인 스레드에 의해 예약되어 VAS 보여 줍니다.
  • VM 규정: 이 값은 이 노드에서 실행 중인 스레드에 의해 커밋된 VAS 보여 줍니다.
  • AWE 할당: 이 값은 32 비트 버전의 제품 AWE 메커니즘을 통해 할당된 메모리를 보여 줍니다. 또는 이 값을 전체 제품의 64비트 버전 잠긴된 페이지에 사용되는 메모리 양을 보여 줍니다. 

    NUMA 사용 가능 시스템에 이 올바르지 않거나 음수 값입니다. 그러나 메모리 관리자 섹션에서 전체 AWE 할당된 값은 올바른 값입니다. 개별 NUMA 노드에 의해 할당된 메모리 추적할 수 SQL Server: 버퍼 노드 성능 개체. 자세한 내용은 SQL Server 온라인 설명서를 참조하십시오.
  • multiPage 할당자: 이 값은 multipage 할당자 통해 이 노드에서 실행 중인 스레드에 의해 할당된 메모리를 보여 줍니다. 이 메모리 버퍼 풀 외부에서 가져옵니다.
  • SinglePage 할당자: 이 값은 단일 페이지 할당자가 통해 이 노드에서 실행 중인 스레드에 의해 할당된 메모리를 보여 줍니다. 이 메모리 버퍼 풀에서 도난.
참고VM 예약 값 및 모든 메모리 노드에서 VM 커밋된 값의 합계를 약간 보다 작은 메모리 관리자가 절에서 보고된 해당 값이 됩니다.

집계 메모리

다음 섹션에서는 각 점원은 형식 및 각 NUMA 노드에 대한 집계 메모리 정보가 들어 있습니다. NUMA 사용 가능 시스템에 대해 다음과 비슷한 출력이 나타날 수 있습니다. 

참고 다음 표에서는 출력 일부만을 포함합니다.
   MEMORYCLERK_SQLGENERAL (node 0)                                  KB 
   ---------------------------------------------------------------- --------------------
   VM Reserved                                                      0
   VM Committed                                                     0
   AWE Allocated                                                    0
   SM Reserved                                                      0
   SM Commited                                                      0
   SinglePage Allocator                                             592
   MultiPage Allocator                                              2160

   (7 row(s) affected)

   MEMORYCLERK_SQLGENERAL (node 1)                                  KB 
   ---------------------------------------------------------------- --------------------
   VM Reserved                                                      0
   VM Committed                                                     0
   AWE Allocated                                                    0
   SM Reserved                                                      0
   SM Commited                                                      0
   SinglePage Allocator                                             136
   MultiPage Allocator                                              0

   (7 row(s) affected)

   MEMORYCLERK_SQLGENERAL (Total)                                   KB 
   ---------------------------------------------------------------- --------------------
   VM Reserved                                                      0
   VM Committed                                                     0
   AWE Allocated                                                    0
   SM Reserved                                                      0
   SM Commited                                                      0
   SinglePage Allocator                                             728
   MultiPage Allocator                                              2160

   (7 row(s) affected)
참고 이러한 노드 ID SQL Server를 실행하는 컴퓨터의 NUMA 노드 구성을 해당합니다. 노드를 하드웨어 NUMA 노드 맨 위에 또는 SMP 시스템에서 맨 위에 정의된 가능한 소프트웨어 NUMA 노드는 ID가 포함합니다. 각 노드의 노드 ID 및 CPU 간의 매핑을 찾으려면 이벤트 ID 번호를 17152 정보 보기. SQL Server를 시작할 때 이 이벤트가 이벤트 뷰어의 응용 프로그램 로그에 기록됩니다.

SMP 시스템의 경우, 각 점원은 형식에 대해 하나의 섹션이 표시됩니다. 이 섹션에서는 다음과 비슷합니다.
   MEMORYCLERK_SQLGENERAL (Total)                                   KB 
   ---------------------------------------------------------------- --------------------
   VM Reserved                                                      0
   VM Committed                                                     0
   AWE Allocated                                                    0
   SM Reserved                                                      0
   SM Commited                                                      0
   SinglePage Allocator                                             768
   MultiPage Allocator                                              2160

   (7 row(s) affected)
이 섹션에서는 다른 정보에 대한 공유 메모리 다음과 같습니다.
  • SM 예약: 이 값은 API 메모리 매핑된 파일을 사용하는 모든 clerks 이러한 종류의 의해 예약되어 VAS 보여 줍니다. 이 API는 공유 메모리 알려져 있습니다.
  • SM 규정: 이 값은 메모리 매핑된 파일을 API를 사용하는 모든 clerks 이러한 종류의 의해 커밋된 VAS 보여 줍니다.
(DMV) sys.dm_os_memory_clerks 동적 관리 뷰를 사용하여 각 점원은 형식의 모든 메모리 노드에 대한 요약 정보를 얻을 수 있습니다. 이렇게 하려면 다음 쿼리를 실행하여:
select 
	type,
	sum(virtual_memory_reserved_kb) as [VM Reserved],
	sum(virtual_memory_committed_kb) as [VM Committed],
	sum(awe_allocated_kb) as [AWE Allocated],
	sum(shared_memory_reserved_kb) as [SM Reserved], 
	sum(shared_memory_committed_kb) as [SM Committed],
	sum(multi_pages_kb) as [MultiPage Allocator],
	sum(single_pages_kb) as [SinlgePage Allocator]
from 
	sys.dm_os_memory_clerks 
group by type

버퍼 배포

다음 섹션에서는 버퍼 풀에서 8 KB (KB) 버퍼 배포 보여 줍니다.
   Buffer Distribution            Buffers
   ------------------------------ -----------
   Stolen                         553
   Free                           103
   Cached                         161
   Database (clean)               1353
   Database (dirty)               38
   I/O                            0
   Latched                        0

   (7 row(s) affected)
이 섹션의 요소는 다음과 같습니다.
  • StolenStolen 메모리 기타 목적을 위해 서버가 사용하는 8 KB 버퍼를 설명합니다. 이러한 버퍼를 일반 메모리 저장소 할당 같은 역할을 합니다. 이러한 버퍼를 서버의 다른 구성 요소에 내부 데이터 구조를 저장하는 데 사용합니다. 지연 기록기 프로세스는 버퍼 풀의 Stolen 버퍼를 플러시할 수 없습니다.
  • 약속: 이 값은 현재 사용하지 않는 커밋된 버퍼를 보여 줍니다. 이러한 버퍼의 데이터를 보유하는 데 사용할 수 있습니다. 또는 다른 구성 요소와 이러한 버퍼를 요청하고 Stolen 같이 이러한 버퍼를 표시할 수 있습니다.
  • 캐시된: 이 값은 다양한 캐시에 사용되는 버퍼를 보여 줍니다.
  • 데이터베이스 (정리): 이 값은 데이터베이스 내용을 가지며 해당 않은 수정된 버퍼를 보여 줍니다.
  • 데이터베이스 (커밋되지 않은): 이 값은 데이터베이스 내용을 있고 있는 수정된 버퍼를 보여 줍니다. 이러한 버퍼를 플러시해야 합니다 변경 사항이 포함되어 디스크에.
  • I/O: 이 값은 보류 중인 I/O 작업을 위해 대기 중인 버퍼를 보여 줍니다.
  • Latched: 이 값은 래치 버퍼를 보여 줍니다. 스레드를 읽거나 페이지 내용에 수정할 때 버퍼 래치 것입니다. 디스크에서 페이지를 읽을 때 버퍼를 또한 래치 또는 디스크에 쓰여진. 래치의 이를 중인 동안 페이지에 있는 데이터의 물리적 일관성을 유지하는 데 사용되는 읽거나 수정한. 잠금은 논리적 및 트랜잭션 일관성을 유지하는 데 사용됩니다.

버퍼 풀 세부 정보

sys.dm_os_buffer_descriptors DMV 데이터베이스 페이지가 버퍼 풀에 버퍼에 대한 자세한 정보를 얻을 수 있습니다. 및 기타 서버 용도로 DMV sys.dm_os_memory_clerks 사용하여 사용 중인 버퍼 풀 페이지에 대한 자세한 정보를 얻을 수 있습니다. 

다음 섹션에서는 추가 정보와 함께 버퍼 풀에 대한 자세한 정보가 나열됩니다.
   Buffer Counts                  Buffers
   ------------------------------ --------------------
   Committed                      1064
   Target                         17551
   Hashed                         345
   Stolen Potential               121857
   External Reservation           645
   Min Free                       64
   Visible                        17551
   Available Paging File          451997

   (8 row(s) affected)
이 섹션의 요소는 다음과 같습니다.
  • 확정: 이 값은 커밋된 총 버퍼 보여 줍니다. 커밋된 버퍼가 연결된 실제 메모리가 있습니다.확정 값을 버퍼 풀의 현재 크기입니다. 이 값은 AWE 지원이 설정된 경우에만 할당된 실제 메모리가 포함됩니다.
  • 대상: 이 값은 대상 버퍼 풀의 크기를 보여 줍니다. 대상 값을 확정 값보다 큰 경우, 버퍼 풀 성장하고 있습니다. 대상 값을 확정 값보다 작은 경우, 버퍼 풀 축소에.
  • Hashed: 이 값은 데이터 페이지와 버퍼 풀에서 저장된 인덱스 페이지를 보여 줍니다.
  • 도난 잠재적인: 이 값은 버퍼 풀에서 도난당할 수 있는 최대 페이지를 보여 줍니다.
  • ExternalReservation: 이 값은 정렬 작업 또는 해시 작업을 수행하는 쿼리가 예약된 페이지를 보여 줍니다. 이러한 페이지는 아직 훔쳤습니다 수 없습니다.
  • 최소 자유: 이 값은 버퍼 풀에 사용 가능한 목록에 있어야 할 페이지를 보여 줍니다.
  • Visible: 이 값은 동시에 볼 수 있는 버퍼 보여 줍니다. 이러한 버퍼는 동시에 직접 액세스할 수 있습니다. 이 값은 총 버퍼 대개 같습니다. 그러나 AWE 지원을 설정한 경우 이 값은 적게 총 버퍼 수 있습니다.
  • 사용 가능한 페이지 파일: 이 값은 커밋된 것으로 사용할 수 있는 메모리를 보여 줍니다. 이 값은 8 KB 버퍼는 수로 표현됩니다. 자세한 내용은 Windows API 설명서의 "GlobalMemoryStatusEx 함수" 항목을 참조하십시오.

프로시저 캐시

프로시저 캐시. 파일럿 다음 섹션을 설명합니다
   Procedure Cache                Value
   ------------------------------ -----------
   TotalProcs                     4
   TotalPages                     25
   InUsePages                     0

   (3 row(s) affected)
이 섹션의 요소 다음과 같습니다:
  • TotalProcs: 이 값은 현재 프로시저 캐시에 있는 총 캐시된 개체가 보여 줍니다. 이 값은sys.dm_exec_cached_plans DMV 항목과 일치합니다.

    참고 이 정보는 동적 특성으로 인해 일치하는 정확한 않을 수 있습니다. PerfMon 모니터링하는 데 사용할 수 있는 SQL Server: 계획 캐시 개체 및 해당sys.dm_exec_cached_plans DMV 캐시된 개체 (예: 트리거, 프로시저 및 임시 개체 유형에 대한 자세한 내용은.
  • TotalPages: 이 값은 프로시저 캐시에서 캐시된 모든 개체를 저장할 수 있어야 합니다 누적 페이지를 보여 줍니다.
  • InUsePages: 이 값은 현재 실행 중인 프로시저에 속해 있는 프로시저 캐시의 페이지를 표시합니다. 이러한 페이지는 삭제된 수 없습니다.

전역 메모리 개체

다음 섹션에서는 다양한 전역 메모리 개체에 대한 정보를 포함합니다. 이 섹션에서는 어느 정도의 메모리 전역 메모리 사용 개체를 대한 정보도 포함되어 있습니다.
   Global Memory Objects          Buffers
   ------------------------------ --------------------
   Resource                       126
   Locks                          85
   XDES                           10
   SETLS                          2
   SE Dataset Allocators          4
   SubpDesc Allocators            2
   SE SchemaManager               44
   SQLCache                       41
   Replication                    2
   ServerGlobal                   25
   XP Global                      2
   SortTables                     2

   (12 row(s) affected)
이 섹션의 요소는 다음과 같습니다.
  • 자원: 이 값은 리소스 개체를 사용하는 메모리를 보여 줍니다. Resource 개체에 대한 다양한 서버 차원의 구조를 저장소 엔진에 의해 사용됩니다.
  • 잠금: 이 값은 잠금 관리자가 사용하는 메모리를 보여 줍니다.
  • XDES: 이 값은 트랜잭션 관리자를 사용하는 메모리를 보여 줍니다.
  • SETLS: 이 값은 스레드 로컬 저장소를 사용하는 저장소 엔진은 특정 스레드 단위 구조를 할당하는 데 사용되는 메모리를 보여 줍니다.
  • SE 데이터 집합 할당자 를: 이 값은 액세스 방법 설정을 통해 테이블 액세스 구조를 할당할 수 사용되는 메모리를 보여 줍니다.
  • SubpDesc 할당자 를: 이 값은 병렬 쿼리, 백업, 복원 작업, 데이터베이스 작업을, 파일 작업을, 미러링, 작업과 비동기 커서에 대한 하위 관리하는 데 사용되는 메모리를 보여 줍니다. 이러한 하위 병렬 프로세스가 이라고도 합니다.
  • SE SchemaManager: 이 값은 스키마 관리자가 저장소 엔진 관련 메타데이터를 저장하는 데 사용하는 메모리를 보여 줍니다.
  • SQLCache: 이 값은 문 임시 및 준비된 문 텍스트를 저장하는 데 사용되는 메모리를 보여 줍니다.
  • 복제: 이 값은 내부 복제 하위 시스템에 대해 서버에서 사용하는 메모리 보여 줍니다.
  • ServerGlobal: 이 값은 일반적으로 여러 하위 시스템에 의해 사용되는 전역 서버 메모리 개체를 보여 줍니다.
  • XP 전역: 이 값은 저장된 프로시저 사용 확장 메모리를 보여 줍니다.
  • 정렬 테이블: 이 값은 메모리를 보여 테이블 사용 정렬합니다.

쿼리 메모리 개체

다음 절에서는 쿼리 메모리 부여 정보를 설명합니다. 이 섹션에서는 쿼리 메모리 사용의 스냅샷이 포함됩니다. Query memory is also known as workspace memory.
   Query Memory Objects           Value
   ------------------------------ -----------
   Grants                         0
   Waiting                        0
   Available (Buffers)            14820
   Maximum (Buffers)              14820
   Limit                          10880
   Next Request                   0
   Waiting For                    0
   Cost                           0
   Timeout                        0
   Wait Time                      0
   Last Target                    11520

   (11 row(s) affected)

   Small Query Memory Objects     Value       
   ------------------------------ ----------- 
   Grants                         0
   Waiting                        0
   Available (Buffers)            640
   Maximum (Buffers)              640
   Limit                          640

   (5 row(s) affected)
If the size and the cost of a query satisfy “small” query memory thresholds, the query is put in a small query queue. 이 문제는 더 작은 쿼리로 큐에서 이미 있는 더 큰 쿼리 뒤에 지연된 못하게 합니다.

이 섹션의 요소는 다음과 같습니다.
  • 부여하는: 이 값은 메모리 부여를 있는 실행 중인 쿼리에 보여 줍니다.
  • 대기: 이 값은 메모리 부여를 얻으려면 대기 중인 쿼리를 보여 줍니다.
  • 가능: 이 값은 해시 작업 영역 같이 사용할 쿼리를 사용할 수 있는 및 같이 작업 영역 정렬 버퍼에 보여 줍니다. 가능한 값은 주기적으로 업데이트됩니다.
  • 최대: 이 값은 모든 쿼리에 사용할 작업 영역 같이 주어진 총 버퍼 보여 줍니다.
  • 제한: 이 값은 큰 쿼리 대기열에 대한 쿼리 실행을 대상 보여 줍니다. 큐에 변경 때까지 최대값 (버퍼) 업데이트되기 때문에 이 값은 최대 (버퍼) 값에서가 다릅니다.
  • 다음 요청: 이 값은 다음 대기 쿼리에 대한 버퍼 메모리 요청 크기를 표시합니다.
  • 대기 대상: 이 값은 사용할 수 있는 다음 요청 값을 참조하는 쿼리를 실행할 수 있는 메모리 양을 보여 줍니다. 대기에 대해다음 요청 값에 의해 여유가 비율을 곱한 값입니다. 이 값을 효과적으로 다음 대기 중인 쿼리를 실행할 때 특정 양의 메모리 사용할 수 있도록 보장합니다.
  • 비용: 이 값은 다음 대기 중인 쿼리 비용을 보여 줍니다.
  • 시간 제한: 초 을 다음 대기 중인 쿼리 시간 제한, 이 값은 보여 줍니다.
  • 대기 시간: 다음 대기 중인 쿼리 대기열에서 넣습니다. 이후 이 값은 경과된 시간을 밀리초 단위로 표시합니다.
  • 마지막 대상: 이 값은 쿼리 실행을 위해 전체 메모리 제한을 보여 줍니다. 큰 쿼리 큐와 작은 쿼리 큐가 결합된 제한 값입니다.

최적화

The next section is a summary of the users who are trying to optimize queries at the same time.
   Optimization Queue             Value
   ------------------------------ --------------------
   Overall Memory                 156672000
   Last Notification              1
   Timeout                        6
   Early Termination Factor       5

   (4 row(s) affected)

   Small Gateway                  Value
   ------------------------------ --------------------
   Configured Units               8
   Available Units                8
   Acquires                       0
   Waiters                        0
   Threshold Factor               250000
   Threshold                      250000

   (6 row(s) affected)

   Medium Gateway                 Value
   ------------------------------ --------------------
   Configured Units               2
   Available Units                2
   Acquires                       0
   Waiters                        0
   Threshold Factor               12

   (5 row(s) affected)

   Big Gateway                    Value
   ------------------------------ --------------------
   Configured Units               1
   Available Units                1
   Acquires                       0
   Waiters                        0
   Threshold Factor               8

   (5 row(s) affected)
Queries are submitted to the server for compilation. 컴파일 프로세스를 구문 분석, algebraization, 최적화가 포함됩니다. 쿼리는 각 쿼리 컴파일 과정에서 설정으로는 메모리 양을 기준으로 분류됩니다.

참고 이 양은 쿼리를 실행하는 데 필요한 메모리가 포함되지 않습니다. 

쿼리를 시작할 경우 제한이 얼마나 많은 쿼리를 컴파일할 수 있습니다. 메모리 소비가 증가하고 임계값에 도달할 때 쿼리를 계속 게이트웨이를 통과해야 합니다. 각 게이트웨이 후 동시에 컴파일된 쿼리 점진적으로 감소하는 제한이 있습니다. 각 게이트웨이 크기를 플랫폼 로드에 따라 다릅니다. 확장성 및 처리량을 최대화하기 위해 게이트웨이 크기가 선택됩니다.

게이트웨이 쿼리를 전달할 수 없습니다 경우 쿼리 메모리를 사용할 수 있는 때까지 대기합니다. 또는 쿼리 시간 제한 오류 (오류 8628) 반환됩니다. 또한 쿼리를 게이트웨이 사용자가 쿼리를 취소하면 또는 교착 상태가 발견되면 부여되지 않을 수 있습니다. 여러 게이트웨이 쿼리를 전달하는 경우에는 컴파일 프로세스를 완료할 때까지 쿼리를 더 작은 게이트웨이 해제하지 않습니다. 

이 문제는 동시에 발생하는 몇 가지 메모리 집중형 컴파일을 전용 수 있습니다. 또한 이 문제는 더 작은 쿼리로 처리량을 최대화하는 예제입니다.

메모리 중개업자

다음 세 개의 섹션을 컨트롤 메모리와 훔친된 메모리, 예약된 메모리 캐시된 메모리 중개업자에 대한 정보를 표시합니다. 이 섹션에서는 제공하는 정보는 내부 진단은 사용할 수 있습니다. 따라서 이 여기에 자세한 이 정보는 있지 않습니다.
   MEMORYBROKER_FOR_CACHE           Value
   -------------------------------- --------------------
   Allocations                      1843
   Rate                             0
   Target Allocations               1843
   Future Allocations               0
   Last Notification                1

   (4 row(s) affected)

   MEMORYBROKER_FOR_STEAL           Value
   -------------------------------- --------------------
   Allocations                      380
   Rate                             0
   Target Allocations               1195
   Future Allocations               0
   Last Notification                1

   (4 row(s) affected)

   MEMORYBROKER_FOR_RESERVE         Value
   -------------------------------- --------------------
   Allocations                      0
   Rate                             0
   Target Allocations               1195
   Future Allocations               0
   Last Notification                1

   (4 row(s) affected)
posted by LifeisSimple
2010. 11. 16. 12:26 Brain Trainning/DataBase

SQL Server 2005 DBCC Command Quick Reference

By Jon Reade, 2004/12/16

Total article views: 31742 | Views in the last 30 days: 226

SQL Server 2005 DBCC Command Quick Reference

New, undocumented and retired DBCC Commands in SQL Server 2005

Seven new DBCC commands have been introduced by Microsoft's SQL Server development team.
Unfortunately little or no documentation is available on the new commands listed below, though some of them may be documented in the RTM release.
Those that are listed as being documented do not require a trace flag to be set before using them.
However, to use the undocumented commands, you will need to turn on trace flag 2588.
This has changed since SQL Server 7.0/2000, where the trace flag was 2520.

Please note that the following is a result of investigations with the beta 2 release of SQL Server 2005, the final RTM release may differ slightly.

As always, never use an undocumented DBCC command on a production server unless advised by Microsoft, and never use a documented one unless you understand how it may affect the performance of your server.

DBCC commands new to SQL Server 2005

Documented new commands

    freesessioncache () -- no parameters
    requeststats ({clear} | {setfastdecayrate, rate} | {setslowdecayrate, rate})

Undocumented new commands

    mapallocunit (I8AllocUnitId | {I4part, I2part})
    metadata ({'print' [, printopt = {0 |1}] | 'drop' | 'clone' [, '' | ....]}, {'object' [, 'type',...}, {Id | Name}, [{Ownerid | Ownername}], [{Dbid | Dbname}]])
    optimizer_whatif property, value
    persiststackhash (hashfile, BUFLATCH_TIMEOUT | ATTENTION | OUTOFLOCKS | LATCH_ATTN | OUTOFLOG | OUTOFMEM | SOS [, SKIPLAST | INCLUDELAST])
    semetadata (object id | name, index id | name [, partition id])

DBCC commands altered since SQL Server 2000

The following is presented as a list of pairs of commands. The first command is the old syntax, as used in SQL Server 2000. The second of each pair is the altered syntax new to SQL Server 2005. In most cases the commands have been extended to take advantage of passing an object ID instead of a name, but if your scripts use any of these commands, it's probably worth checking them out before you migrate to SS2K5.

2000 : checkalloc [('database_name'[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, ESTIMATEONLY]]
2005 : checkalloc [('dbname'|dbid[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[,ALL_ERRORMSGS][, ESTIMATEONLY]]
Changes : SQL Server 2005 now accepts the dbid as well as the dbname

2000 : checkdb [('database_name'[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, PHYSICAL_ONLY][, ESTIMATEONLY][, TABLOCK]
2005 : checkdb [('dbname | dbid'[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[,ALL_ERRORMSGS][, PHYSICAL_ONLY][, ESTIMATEONLY][, TABLOCK]]
Changes : SQL Server 2005 now accepts the dbid as well as the dbname

2000 : checkident ('table_name'[, { NORESEED | {RESEED [, new_reseed_value] } } ] )
2005 : checkident ('table_name'[, { NORESEED | {RESEED [, new_reseed_value] } } ] )
Changes :
Although the syntax is identical for SQL Server 2000 and 2005, there is a subtle change in the behaviour of this command.
In SQL Server 7.0 and 2000, running checkident would cause the identity column to be re-seeded, even if the table was empty.
In SQL Server 2005, if the table is empty when dbcc checkident is run, the reseed value will be ignored.

2000 : dbrepair ('dbname', DROPDB [, NOINIT])
2005 : dbrepair ('dbname', markdirty | {dropdevice, int} | {repairindex, int, int})
Changes : dropdevice syntax changed ; markdirty and repairindex options added
NB : It seems odd that this command has been extended with this release, as in the SQL Server 2005 setup help file, setupsql9.chm, it states that DROP DATABASE should be used instead of this command. It was included in SQL Server 2000 for backward compatibility only.

2000 : indexdefrag ({dbid | dbname | 0}, {tableid | tablename}, {indid | indname})
2005 : indexdefrag ({dbname | dbid | 0}, {tableid | tablename} [, {indid | indname} [, partition_number]])
Changes : An extra optional parameter has been added, partition_number

2000 : inputbuffer (spid)
2005 : inputbuffer (spid, [batchid])
Changes : An extra optional parameter has been added, batch_id

2000 : outputbuffer (spid)
2005 : outputbuffer (spid, [batchid])
Changes : An extra optional parameter has been added, batch_id

2000 : proccache
2005 : proccache ([compplan_ticks_threshold])
Changes : An optional parameter has been added, compplan_ticks_threshold

2000 : sqlperf (LOGSPACE)({IOSTATS | LRUSTATS | NETSTATS | RASTATS [, CLEAR]} | {THREADS} | {LOGSPACE})
2005 : sqlperf (LOGSPACE | IOSTATS | NETSTATS | RASTATS [, CLEAR]} | [THREADS] )
Changes : As for 2000, but LRUSTATS has been removed as an option.
NB : Microsoft only document the LOGSPACE parameter of this command - use any others at your own discretion.

2000 : updateusage ({'database_name'| 0} [, 'table_name' [, index_id]]) [WITH [NO_INFOMSGS] [,] COUNT_ROWS]
2005 : updateusage ({'dbname' | dbid | 0} [, {'table_name' | table_id} [,{index_id | 'index_name'}]]) [WITH [NO_INFOMSGS] [,] COUNT_ROWS]
Changes : Can now specify db_id, table_id, or the index name as parameters, instead of just the db/table/index name.

Also note that there is a problem with the output generated by the dbcc showcontig command under certain conditions in the beta version of SQL Server 2005, where more than one block of information per index is generated for tables that contain text columns.

DBCC commands retired since SQL Server 2000

Many of us have used them at one time or another and a few might even depend upon them. However, we can't say we have not been warned, and Microsoft have finally retired a whole raft of dbcc commands in SQL Server 2005.
Most of these were not particularly useful, but thoughtfully retained right up to SQL Server 2000 for backward compatibility with SQL Server 6.5 and earlier scripts.
The following dbcc commands are now dead and buried from SQL Server 2005 onwards:

adduserobject (name)
balancefactor (variance_percent)
bufcount [(number_of_buffers)]
cacheprofile [( {actionid} [, bucketid])
checkdbts (dbid, newTimestamp)]
des [( {'dbname' | dbid} [, {'objname' | objid} ])]
dropuserobject ('object_name')
getvalue (name)
iotrace ( { 'dbname' | dbid | 0 | -1 }, { fileid | 0 }, bufsize, [ { numIOs | -1 } [, { timeout (sec) | -1 } [, printopt={ 0 | 1 }]]] )
lockobjectschema ('object_name')
matview ({'PERSIST' | 'ENDPERSIST' | 'FREE' | 'USE' | 'ENDUSE'})
memospy
memusage ([IDS | NAMES], [Number of rows to output])
monitorevents ('sink' [, 'filter-expression'])
newalloc (previously retired, use of checkalloc recommended instead)
perflog
pglinkage (dbid, startfile, startpg, number, printopt={0|1|2}, targetfile, targetpg, order={1|0})
procbuf [({'dbname' | dbid}[, {'objname' | objid}[, nbufs[, printopt = { 0 | 1 } ]]] )]
rebuild_log (dbname [, filename])
row_lock (dbid, tableid, set) - Not Needed
shrinkdb (previously retired, use of shrinkdatabase recommended instead)
tab ( dbid, objid )
tape_control {'query' | 'release'}[,('\\.\tape')]
textall [({'database_name'|database_id}[, 'FULL' | FAST] )]
textalloc ({'table_name'|table_id}[, 'FULL' | FAST])
upgradedb (db)
usagegovernor (command, value)
wakeup (spid)

DBCC commands included in SQL Server 2005, which will be retired at a later date

dbreindex
This will be replaced with the REBUILD option of the ALTER INDEX statement.

indexdefrag
This will be replaced with the REORGANIZE option of the ALTER INDEX statement.

showcontig
This command will be replace by the system function fn_indexinfo

Complete list of documented SQL Server 2005 DBCC commands

checkalloc [('dbname'|dbid[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, ESTIMATEONLY]]
checkcatalog [('dbname'|dbid)] [WITH NO_INFOMSGS]
checkconstraints [( 'tab_name' | tab_id | 'constraint_name' | constraint_id )] [WITH ALL_CONSTRAINTS | ALL_ERRORMSGS]
checkdb [('dbname | dbid'[, NOINDEX | REPAIR])] [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, PHYSICAL_ONLY][, ESTIMATEONLY][, TABLOCK]]
checkfilegroup [( [ {'filegroup_name' | filegroup_id} ] [, NOINDEX] )] [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, PHYSICAL_ONLY][, ESTIMATEONLY][, TABLOCK]]
checkident ('table_name'[, { NORESEED | {RESEED [, new_reseed_value] } } ] )
checktable ('table_name'[, {NOINDEX | index_id | REPAIR}]) [WITH NO_INFOMSGS[, ALL_ERRORMSGS][, PHYSICAL_ONLY][, ESTIMATEONLY][, TABLOCK]]
cleantable ('dbname'|dbid, 'table_name'|table_id [, batch_size])
concurrencyviolation (reset | display | startlog | stoplog)
dbreindex ('table_name' [, index_name [, fillfactor]]) [WITH NO_INFOMSGS]
dbrepair ('dbname', markdirty | {dropdevice, int} | {repairindex, int, int})
dropcleanbuffers
free dll_name (FREE) e.g. DBCC xp_sample (FREE)
freeproccache
freesessioncache
help ('dbcc_command' | '?')
indexdefrag ({dbname | dbid | 0}, {tableid | tablename} [, {indid | indname} [, partition_number]])
inputbuffer (spid, [batchid])
opentran [({'dbname'| dbid})] [WITH TABLERESULTS[,NO_INFOMSGS]]
outputbuffer (spid, [batchid])
perfmon
pintable (database_id, table_id)
proccache ([compplan_ticks_threshold])
requeststats ({clear} | {setfastdecayrate, rate} | {setslowdecayrate, rate})
show_statistics ('table_name'[, 'target_name'])
showcontig ([table_id | table_name [, index_id | index_name]] [WITH FAST, ALL_INDEXES, TABLERESULTS [,ALL_LEVELS]])
shrinkdatabase ({'dbname'|dbid}, [freespace_percentage [, {NOTRUNCATE | TRUNCATEONLY}]])
shrinkfile ({fileid | 'filename'} {[, EMPTYFILE] | [[, compress_size] [, {NOTRUNCATE | TRUNCATEONLY}]]})
sqlperf (LOGSPACE)
traceoff [( tracenum [, tracenum ... ] )]
traceon [( tracenum [, tracenum ... ] )]
tracestatus (trace# [, ...trace#])
unpintable (dbid, table_id)
updateusage ({'dbname' | dbid | 0} [, {'table_name' | table_id} [, {index_id | 'index_name'}]]) [WITH [NO_INFOMSGS] [,] COUNT_ROWS]
useroptions

Complete list of undocumented SQL Server 2005 DBCC commands

activecursors [(spid)]
addextendedproc (function_name, dll_name)
addinstance (objectname, instancename)
auditevent (eventclass, eventsubclass, success, loginname, rolename, dbusername, loginid, objname, servername, providername)
autopilot (typeid [, dbid [, {maxQueryCost | tabid [, indid [, pages [, flag [, rowcounts]]]]} ]])
buffer ( {'dbname' | dbid} [, objid [, number [, printopt={0|1|2} ][, dirty | io | kept | rlock | ioerr | hashed ]]])
bytes ( startaddress, length )
cacheprofile ( actionid [, bucketid])
cachestats
callfulltext - system sp use only
checkprimaryfile ( {'FileName'} [, opt={0|1|2|3} ])
clearspacecaches ('dbname'|dbid, 'table_name'|table_id, 'index_name'|index_id [, partition_number])
collectstats (on | off)
cursorstats ([spid [,'clear']])
dbrecover (dbname [, IgnoreErrors])
dbreindexall (dbname|dbid[, type_bitmap])
debugbreak
deleteinstance (objectname, instancename)
detachdb ( 'dbname' [, fKeep_Fulltext_Index_File (0 | 1)] )
dropextendedproc (function_name)
config
dbinfo [('dbname')]
dbtable [({'dbname' | dbid})]
lock ([{'DUMPTABLE' | 'DUMPSTATS' | 'RESETSTATS' | 'HASH'}]|[{'STALLREPORTTHESHOLD', stallthreshold}])
log (dbname | dbid [,{0|1|2|3|4}[,['lsn','[0x]x:y:z']|['numrecs',num]|['xdesid','x:y']|['extent','x:y']|['pageid','x:y']|['objid',{x,'y'}]|['logrecs',{'lop'|op}...]|['output',x,['filename','x']]...]]])
page ( {'dbname' | dbid}, filenum, pagenum [, printopt={0|1|2|3} ])
pss [(uid[, spid[, printopt = { 1 | 0 }]] )]
resource
dumptrigger ({'BREAK', {0 | 1}} | 'DISPLAY' | {'SET', exception_number} | {'CLEAR', exception_number})
errorlog
extentinfo [({'dbname'| dbid | 0} [, {'tablename' | tableid} [, {'indexname' | indexid | -1} [, partition_number]]])]
fileheader [( {'dbname' | dbid} [, fileid])
fixallocation [({'ADD' | 'REMOVE'}, {'PAGE' | 'SINGLEPAGE' | 'EXTENT' | 'MIXEDEXTENT'}, filenum, pagenum [, objectid, indexid, partitionid, allocUnitId])
flush ('data' | 'log', dbname | dbid)
flushprocindb (dbid)
freeze_io (dbname | dbid)
icecapquery ('dbname' [, stored_proc_name [, #_times_to_icecap (-1 infinite, 0 turns off)]])
Use 'dbcc icecapquery (printlist)' to see list of SP's to profile.
Use 'dbcc icecapquery (icecapall)' to profile all SP's.
incrementinstance (objectname, countername, instancename, value)
ind ( { 'dbname' | dbid }, { 'objname' | objid }, { indid | 0 | -1 | -2 } [, partition_number] )
invalidate_textptr (textptr)
invalidate_textptr_objid (objid)
latch ( address [, 'owners'] [, 'stackdumps'])
loginfo [({'dbname' | dbid})]
mapallocunit (I8AllocUnitId | {I4part, I2part})
memobjlist [(memory object)]
memorymap
memorystatus
metadata ({'print' [, printopt = {0 |1}] | 'drop' | 'clone' [, '' | ....]}, {'object' [, 'type',...}, {Id | Name}, [{Ownerid | Ownername}], [{Dbid | Dbname}]])
no_textptr (table_id , max_inline)
optimizer_whatif property, value
persiststackhash (hashfile, BUFLATCH_TIMEOUT | ATTENTION | OUTOFLOCKS | LATCH_ATTN | OUTOFLOG | OUTOFMEM | SOS [, SKIPLAST | INCLUDELAST])
prtipage (dbname | dbid, objid | objname, indexid | indexname [, partition_number [, level]]). No partition specified uses the first partition. No level specified prints root page.
readpage ({'dbname'|dbid}, fileid, pageid, formatstr [, printopt = { 0 | 1} ])
renamecolumn (object_name, old_name, new_name)
ruleoff ({ rulenum | rulestring } [, { rulenum | rulestring } ]+)
ruleon ( rulenum | rulestring } [, { rulenum | rulestring } ]+)
semetadata (object id | name, index id | name [, partition id])
setcpuweight (weight)
setinstance (objectname, countername, instancename, value)
setioweight (weight)
showdbaffinity
showfilestats [(file_num)]
showoffrules
showonrules
showtableaffinity (table_id | table_name [, partition_number])
showtext ('dbname' | dbid, {textpointer | {fileid, pageid, slotid [,option]}})
showweights
sqlmgrstats
stackdump [( {uid[, spid [, batchid [, ecid]]} | {threadId, 'THREADID'}] )]
tec [( uid[, spid[, batchid[, ecid]] )]
thaw_io (dbname | dbid)
useplan [(number_of_plan)]
writepage ({'dbname' | dbid}, fileid, pageid, offset, length, data)

Acknowledgements and references:

SQL Server 2005 Express Edition
Except where noted below, the above investigation was carried out on the Beta 2 release of SQL Server 2005 Express Edition.
At the time of writing (November 2004) this product was available as a free download at http://www.microsoft.com/sql/

SQL Server 2005 Setup Help (c) Microsoft Corporation 2004.
The information about future discontinued DBCC commands was sourced from Microsoft's SQL Server 2005 setup help file.
It is recommended reading for anyone who writes commercial database software that depends upon the lower-level functionality provided by SQL Server, as it includes details of discontinued commands and configuration options.
This document can be found at C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\Help\1033\setupsql9.chm, after installing SQL Server 2005 Express Edition to the default installation directory.
Search on "dbcc" to find this information.

Jon Reade November 2004

By Jon Reade, 2004/12/16

Total article views: 31742 | Views in the last 30 days: 226

posted by LifeisSimple
prev 1 next