Questions tagged [dbcc]

DBCC stands for Database Console Commands in Transact-SQL.

The Database Console Commands (DBCC) are a series of statements in Transact-SQL programming language to check the physical and logical consistency of a Microsoft SQL Server database. These commands are also used to fix existing issues. They are also used for administration and file management.

DBCC was previously expanded as Database Consistency Checker.

Source: Wikipedia (Database Console Commands)

106 questions
2
votes
1 answer

What is the use of CHECKDB command and why should we run it?

what is the use of check DB command and why should we run it? The command which I have ran in MSSQL DBCC CHECKDB(‘DatabaseName’) And I got the result as Result DBCC results for 'testdb'. Service Broker Msg 9675, State 1: Message Types analyzed:…
Shree
  • 65
  • 1
  • 9
2
votes
2 answers

SQL Server database won't shrink

I have a 31 GB database I got from a customer for a project. I'm coding and keeping the database in a 80GB Win7 VM. I got the db file and imported the database from that, and found that the space was being eaten up mostly by one table, with 240,000…
Tony Bownes
  • 23
  • 1
  • 4
2
votes
1 answer

SQL Server: Why does 'DBCC Page' report 'Tinyint' is 2 byetes?

I tried to figured out how SQL Server stores Tinyint (which is supposed to be 1-byte long) column. -- Create table CREATE TABLE MyTest.dbo.TempTable ( Col1 Tinyint NOT NULL ); -- Fill it up INSERT INTO dbo.TempTable VALUES (3); -- Get page…
Alireza
  • 10,237
  • 6
  • 43
  • 59
2
votes
1 answer

SQL Server DBCC not displaying output

I am trying to use DBCC to see page information on a table. When I run DBCC page (master, 1, 1, 0) GO I get DBCC execution completed. If DBCC printed error messages, contact your system administrator. in SSMS's Messages window. I do not see…
Klaus Nji
  • 18,107
  • 29
  • 105
  • 185
2
votes
1 answer

Possible index corruption detected. Run DBCC CHECKDB

I received an alert "Possible index corruption detected. Run DBCC CHECKDB" I checked the error logs and they are: " Possible index corruption detected. Run DBCC CHECKDB Error:9100, Severity: 23, State: 2 " My question would be how will I determine…
2
votes
1 answer

How to retrieve results from 'DBCC SHOWFILESTATS' with ODBC?

I need to find the relative amount of space available in my SQL Server database using an ODBC connection. I wanted to try using dbcc showfilestats but it does not return any results. Having read INF: Processing DBCC Commands in ODBC applications I…
em3
  • 76
  • 6
2
votes
0 answers

Is there any way to use DBCC command in a subquery

I want to extract some information out of the DBCC SHOW_STATISTICS command. So I have been trying to do this with a subquery, but until now it seems to be impossible. Via google, I found some suggestions with a temporary table, but this seems to…
Martao
  • 795
  • 2
  • 6
  • 12
2
votes
2 answers

Help interpreting DBCC CHECKDB output related to Torn Pages

I've been asked to look at a SQL 2005 database that is reporting 'torn page' errors. I can look up the MsgIDs and so on, but I just need a few pointers interpreting the DBCC CHECKDB output in a more general sense. In this sample: Msg 8909, Level 16,…
codeulike
  • 22,514
  • 29
  • 120
  • 167
1
vote
0 answers

Attempt to fetch logical page in database 5 failed

When I run a select query, I get the error: Msg 605, Level 21, State 3, Line 1 Attempt to fetch logical page (1:XXXXXXX) in database 5 failed. It belongs to allocation unit XXXXXXXXXXX not to XXXXXXXXXXXXX. I have tried running query DBCC…
1
vote
1 answer

Error on sql server database shrink command

I'm executing these commands from a Console Application DBCC SHRINKFILE (@FILE_NAME_MDF, 0) WITH NO_INFOMSGS DBCC SHRINKFILE (@FILE_NAME_LDF, 0) WITH NO_INFOMSGS and getting this error Could not shrink the XXX database Cannot create a row of size…
Bullish
  • 15
  • 2
  • 5
1
vote
1 answer

Will DBCC SHRINKFILE kill the active transaction?

I have created a job that loads several GBs of data from source DB to my destination DB on daily basis. in the beginning this job was running fine without any issues. For the past 2 weeks the job is failing because of the transaction log is full. I…
1
vote
1 answer

Is it possible to delete a single execution plan from cache on Azure SQL DB?

Conclusion You can not. Microsoft explicitly states: "you cannot manually remove an execution plan from the cache" in this article called 'Understanding the Procedure Cache on SQL Azure'. Original Question On SQL Server a single execution plan can…
Mike de Klerk
  • 11,906
  • 8
  • 54
  • 76
1
vote
1 answer

Why do dbcc checkdb on system databases and sp_executesql on a user database cause a deadlock?

I have a daily job running a dbcc checkdb statement without additional parameters on each of the system databases. This job runs during off-peak hours and usually takes 5 seconds or less to run. The last run however, took only 1 second and failed…
Erwin Dockx
  • 273
  • 1
  • 8
1
vote
1 answer

Log file is not Shrinking on SQL Server

I wanted to shrink the log file as much as possible by the command: DBCC SHRINKFILE ('LogFile', 10) and get this error: Cannot shrink log file 2 ('LogFile') because the logical log file located at the end of the file is in use. I tested these…
M. Rezaeyan
  • 388
  • 2
  • 14
1
vote
1 answer

When do we specify fill factor for DBCC DBREINDEX?

I checked over google and found that if fill factor is 0 then it uses the 100% space on index page. Otherwise we need to specify the fill factor. My questions to experts are: Should we leave it blank for maximum index efficiency? I found in our…