Solved

Error rebuilding indexes via Database Maintainence Plan in SQL 2000

Posted on 2002-04-24
11
4,429 Views
Last Modified: 2012-08-14
In SQL 2000 I get the following error when the Database Maintainence Plan rebuilds indexes on a particular database.
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC SQL Server Driver][SQL Server]DBCC failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER, ARITHABORT'.
The maintainence plan was built using the maintainence plan wizard. Rebuilding indexes is just one of the steps in the plan. All other steps pass except for the rebuild indexes step.
I've tried setting Quoted_Identifier to OFF at both the server level as well as the database level with no success. I also know that sqlmaint.exe is what is called by the maintainence plan and sqlmaint connects to the SQL Server using an ODBC connection and logs in using the same account information as the SQL Server Service. I've edited the Windows System DSN ODBC Data Source called "Local Server" and set Quoted_Identifier to OFF there as well, but again with no success.
I'm not sure if this is relevant but, there are tables with calculated members in this database.
I also get the same error when I update statistics on the same database through the maintainence plan. However, if I run sp_updatestats from Query Analyser, the sp executes just fine.
I've gone around in circles on this one. Any help would be greatly appreciated.
0
Comment
Question by:bipinpn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 35

Expert Comment

by:David Todd
ID: 6969973
Hi,

I know that using the maintenance plans is easier,

but try running DBCC DBReindex on individual tables and see what you get.

I'd suggest in this instance to do this in a stored procedure, then schedule running the stored procedure.

Let me know if you want/need the code for this.

Regards
  David
0
 

Author Comment

by:bipinpn
ID: 6971337
Thanks dtodd, but doing a DBReindex on every table in a database is a lot of work. We have a ton of tables+indexes. I knew I could do this but am looking for a way to use sqlmaint.exe
0
 
LVL 35

Accepted Solution

by:
David Todd earned 100 total points
ID: 6975736
Hi,

There isn't that much work invovled. You only need to do the clustered index as the non-clustered indexes are then rebuilt automatically.

Something like this will rebuilt all the indexes ...

declare @TableName     sysname

declare c_Tables cursor for
select Table_Name
from information_schema.tables
where Table_Type = 'Base Table'

open c_Tables
fetch next from c_Tables into @TableName
while @@fetch_status = 0 begin
     print @TableName
     dbcc dbreindex( @TableName, '', 90 )

     --declare @SQLStr     nvarchar( 2000 )
     --set @SQLStr = N' Update Statistics ' + @TableName
     --execute( @SQLStr )
     execute( N' Update Statistics ' + @TableName )

     fetch next from c_Tables into @TableName

end
close c_Tables
deallocate c_Tables

Note that I have set the fillfactor to 90 percent. I would generally use a variable for this and set it that the top of the procedure so it is easy to change.

This isn't a lot of work ...

If you had to write one line for each index in each table then I agree thats way too much work.

Regards
  David
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bipinpn
ID: 6977651
Thanks David,
            But this is something that I knew how to do already. I ended up calling Microsoft Tech Support and found out that sqlmaint.exe has a bug where it doesn't use the ODBC connection properties but rather a set of hardcoded connection properties. Unfortunately, QUOTED_IDENTIFIER is set to OFF in the connection that sqlmaint makes. I will give you 25 points however for taking the time to assist.
0
 

Author Comment

by:bipinpn
ID: 6977663
Thanks David,
           But this is something that I knew how to do already. I ended up calling Microsoft Tech Support
and found out that sqlmaint.exe has a bug where it doesn't use the ODBC connection properties but rather
a set of hardcoded connection properties. Unfortunately, QUOTED_IDENTIFIER is set to OFF in the connection
that sqlmaint makes. I will give you 25 points however for taking the time to assist.
0
 

Expert Comment

by:SQLPeter
ID: 8368057
Hi bipinpn,

i have the same problem like you a year ago. in the microsoft knowledge base article - 301292 (8/15/2002) it is recommand to use

SET ARITHABORT ON
SET QUOTED_IDENTIFIER ON

i tried this, but the same error appeared (DBCC failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER, ARITHABORT'.)

did you get a solution?

regards,
Peter
0
 

Author Comment

by:bipinpn
ID: 8373327
Peter,
     I did not find a solution, unfortunately. I did speak to Microsoft and figured out that sqlmaint.exe uses hardcoded connection properties that is part of sqlmaint.exe. So although setting ARITHABORT and QUOTED_IDENTIFIER to ON should fix this issue, the connections properties withing sqlmaint.exe overrides these settings. Microsoft has documented this bug and has promised to fix it in a subsequent release!! I ended up having to manually create the rebuild index and update statistics jobs. Good luck.
0
 

Expert Comment

by:SQLPeter
ID: 8376385
Hi,
thanks for reporting. Scripting forever!
Regards,
Peter
0
 

Expert Comment

by:tmurrayee
ID: 8382271
bipinpn,

I have the same problem with sqlmaint.exe.  How did you manually create the rebuild index and update statistics jobs?

Thanks in advance.
0
 

Expert Comment

by:jfawcett
ID: 8545837
Can anyone provide a Microsoft knowledge base article number or similar link as confirmation of this bug?

Thx.

0
 

Expert Comment

by:jhachmann
ID: 12360984
301292 - PRB: SET OPTION Considerations When Running DBCC with Indexes On Computed Columns

The script below works well for this problem.

USE dbname
GO

SET ARITHABORT ON
SET QUOTED_IDENTIFIER ON

EXECUTE sp_MSforeachtable @command1 = "print '?' DBCC DBREINDEX ('?','',90)"
GO
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

697 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