Solved

Error rebuilding indexes via Database Maintainence Plan in SQL 2000

Posted on 2002-04-24
11
4,393 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
  • 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
 

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 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

15 Experts available now in Live!

Get 1:1 Help Now