Error rebuilding indexes via Database Maintainence Plan in SQL 2000

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.
bipinpnAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
David ToddConnect With a Mentor Senior DBACommented:
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
 
David ToddSenior DBACommented:
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
 
bipinpnAuthor Commented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
bipinpnAuthor Commented:
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
 
bipinpnAuthor Commented:
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
 
SQLPeterCommented:
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
 
bipinpnAuthor Commented:
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
 
SQLPeterCommented:
Hi,
thanks for reporting. Scripting forever!
Regards,
Peter
0
 
tmurrayeeCommented:
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
 
jfawcettCommented:
Can anyone provide a Microsoft knowledge base article number or similar link as confirmation of this bug?

Thx.

0
 
jhachmannCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.