Solved

Error rebuilding indexes via Database Maintainence Plan in SQL 2000

Posted on 2002-04-24
11
4,413 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

785 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