Solved

SQL Server 2008 Rebuild Index Fails

Posted on 2014-01-28
1
1,451 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore 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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

773 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