Solved

SQL Server 2008 Rebuild Index Fails

Posted on 2014-01-28
1
1,400 Views
Last Modified: 2014-01-28
Hi everyone,

I have a major problem with my SQL Server 2008 maintenance plan.

I have a huge database (40 Go) that need to be re-indexed every day.
Since four days, I have the following error :

******************
Code: 0xC0024104    
Source: Rebuild Index      
Description: The Execute method on the task returned error code 0x80004002 (Unable to cast object of type 'System.DBNull' to type 'System.String'.). The Execute method must succeed, and indicate the result using an "out" parameter.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).
******************

I made some searches on the web but found nothing.

Can you help me or get a hint on what to check to make this work again?

Thank you
0
Comment
Question by:luminis86
1 Comment
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 500 total points
ID: 39816390
Step 1:
Use the below code to generate the reorganize script

Select 'Alter Index All on ' + name + ' REORGANIZE ; ' From sys.tables

Open in new window


once this code is executed you will get a set of alter statments in your SSMS query result windows copy them back into the query window and execute them.

If there is an error for a particular table, then that table is the culprit when reorganizing is done -- Go to step 3 then,

If the reorganize gets done succesfully.

Then run the below code

Select 'ALTER INDEX ALL ON ' + name + ' REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON,STATISTICS_NORECOMPUTE = ON); ' From sys.tables

Open in new window



once this code is executed you will get a set of alter statments in your SSMS query result windows copy them back into the query window and execute them.

If there is an error for a particular table, then that table is the culprit when rebuilding is done -- Go to step 3 then,


Step 3

Try to do drop the indexes and recreate them here... they will solve the isssue completly.


Step 4
If you didn't find the issue at all with step1 and step2 then try running DBCC CHECKDB and re-run the maintance plan.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now