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
0
votes
2 answers

how to fix fragmented indexes in sql server?

I want to defrag tables in sql server, I used this code to know the fragmented indexes: sELECT dbschemas.[name] as 'Schema', dbtables.[name] as 'Table', dbindexes.[name] as 'Index', indexstats.avg_fragmentation_in_percent as Fragmentation, …
0
votes
1 answer

DBCC CHECKIDENT error in PHP query

This is the first time I've ever asked a question on here, but I've used stackoverflow many times in the past to find solutions for problems I'm having in my code. I'm working on a database transfer page on a php site that uploads csv files and…
0
votes
0 answers

how to reseed in pymssql

I wish to reseed the userprofile table from python code. I have done as below stmt = "DBCC CHECKIDENT ('UserProfile', RESEED,52)" cursr.execute(stmt) But it is not getting set. I checked with DBCC CHECKIDENT('UserProfile',NORESEED) in sql server…
Robert_Junior
  • 1,122
  • 1
  • 18
  • 40
0
votes
1 answer

$db.CheckTables('None') in Powershell doesn't continue on after encountering corrupt database

Probably a noob question but here it goes. So i'm making this backup test script with powershell and i'm displaying the results of DBCC in the console and when $db.CheckTables('None') loops through the database collection and encounters a corrupt…
Phil
  • 5
  • 2
0
votes
1 answer

Integrity Checks are failing

Needs some help understanding how a restore process works when you have a hard disk failure and a server shutdown. We run MSSQL2005 server. We take a full backup every night and logs every hour. We had a disk failure on a Raid 5 storage drive, (2)…
0
votes
1 answer

Bulkcopy inserts with DBCC CheckIdent

Our team needs to insert a cruel amount of data into our SQL Server 2008 database. We're looking for a good solution. Now we came up with one, but I have doubts with it, simply because it doesn't feel right. So I'm asking here if this seems like a…
0
votes
0 answers

SQL Server 2012 DBCC memorystatus has wrong information. How can I correct it?

I have a Windows 7 64-bit machine with 16GB ram, 24GB pagefile, 500GB HD and SQL Server 2012 Standard Edition 64-bit running on it. I set the Maximum Server Memory to 1024MB through SSMS. With 5 minutes of starting up, it routinely uses all my…
0
votes
1 answer

Which DBCC commands do I need to run to make sure SQL Server's caches are totally clean?

I want to do some SQL Server performance testing and I want to establish a good baseline. I want to flush all the caches each time so that I know between each test it hasn't cached something so it performs better in between runs. Which DBCC commands…
uriDium
  • 13,110
  • 20
  • 78
  • 138
0
votes
1 answer

Is there an application that works as DBCC wizard?

DBCC (DB Consistency Check) commands are powerful tools but they don,t have a graphical user interface. now Is there a application that works like DBCC wizard?
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151
0
votes
1 answer

DBCC SQL Server 2000 sysindexkeys

I have a SQL Server 2000 database. When I run the following command select * from sysindexkeys This display the appropriate records. I then do a DBCC command for the sysindexkeys. It doesn't display anything. Strange there is no page having the…
0
votes
1 answer

SQL DBCC command

I was just curious to know about the meaning of dbcc shrinkfile(m,n) connamd. say if I run the command dbcc shrinkfile(1,2000) what does that 1,2000 indicates? How does dbcc is different from normal sql shrink (when you rightclick on DB and…
Vinnie
  • 1,053
  • 11
  • 31
0
votes
2 answers

did DBCC CHECKDB

Help getting crushed by this i did DBCC CHECKDB and one of the DB gave Msg 823, Level 24, State 2, Line 2 I/O error 21(The device is not ready.) detected during read at offset 0x0000000001c000 in file 'E:\MSSQL2000\Data\FTSWE_Data.MDF'. I was…
vas
  • 2,078
  • 9
  • 39
  • 60
0
votes
1 answer

fixing large number of constraints issues reported by DBCC

After a bulk load with contraints check turned off I have some number of records in foreign key column to be removed because they violate constrains. DBCC indicates them nicely but is there a easy way to get violating value of this [colARef] = 'XXX'…
Zulu Z
  • 1,103
  • 5
  • 14
  • 27
0
votes
1 answer

SQL Server DBCC CHECKDB Being Run On Bootup

We've noticed that on bootup, there are CHECKDBs being run against all databases on the instance being restarted. At first I assumed it was standard procedure and did some research. I found a couple of posts stating that this happenswhen the server…
PseudoToad
  • 1,504
  • 1
  • 16
  • 34
0
votes
1 answer

Can I use DBCC CHECKIDENT for resseding identity column in a table variable?

I create a table variable with an identity column in my script, I want to reseed this column. Can I use below script? DBCC CHECKIDENT (tableVariableName, reseed, @NewStartSeedValue)
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151