Showing posts with label management. Show all posts
Showing posts with label management. Show all posts

Wednesday, March 7, 2012

dbcc dbreindex question

Is this command, which I know can be executed on a per-table basis,
the same as the Rebuild Index Task in the SQL Server Management Studio
for maintenance tasks??

The documentation I have mentions the reindex.sql script, is this the
script that is executed by the Rebuild Index Task??

Thank you, Tomtlyczko (tlyczko@.gmail.com) writes:

Quote:

Originally Posted by

Is this command, which I know can be executed on a per-table basis,
the same as the Rebuild Index Task in the SQL Server Management Studio
for maintenance tasks??


I would guess the maintenance task uses ALTER INDEX REBUILD which is a
more modern version of DBCC DBREBUILD, at least in terms of syntax.

I have not worked much with maintenance plans, but since they SSIS
packages, you should be able to look what's on the inside with help
of the Business Intelligence Development Studio.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Sunday, February 19, 2012

DBCC CheckDB Question

Is there anyway I can programmatically determine if DBCC CheckDB has found any errors? When I run this command in Management Studio it simply returns a slew of messages. What I would like to do is to create a stored proc that executes this command, somehow determine if any errors were found, and then notify the appropriate person for follow-up. I am at a loss to know how to programmicatically determine if DBCC CheckDB encountered any errors during its run.

Thanks for your help.

A few different things - in the automated routine you are using, you can save the output to a file and search for the errors with a tool like findstr. Or import the file into a table and search for errors in the table. Or create a table that will use DBCC CHECKDB WITH TABLERESULTS, so an insert into that table, along the lines of:

Insert Into YourCheckDBTableResults
Exec ('dbcc checkdb with tableresults')
And then check the table you are storing the results in.

-Sue