I've written a small T-SQL script that checks the database I'm interested in
using DBCC CHECKDB and then DBCC CHECKCATALOG.
I then chekc the @@ERROR for any error number. If there is I backup to
another device else I backup to my standard place.
This all works using the SQL Server Query Analyzer tool - in under 1
seconds. But when I run the sql script using OSQL, it takes ages and I've
let it run for about 40 minutes and then gave up.
I want to run it from the command line because my external backup program
can execute the batch file and make file dumps of the databases first.
Has anyone any clues to why it's so slow?
TIA
Regards
Nick Middleweek
Unless you have an extremely small DB I doubt if it is running in under
1 sec in QA. DBCC CHECKDB can be pretty intensive and I suspect that
something is not correct when you run it in QA. Do you have the correct DB
selected or are you trying to run in against Master?
Andy
"Nick Middleweek" <ni...@trendm.co.uk> wrote in message
news:umsnRwCDAHA.196@cppssbbsa04...
I meant 10 seconds.
The exactly the same SQL script runs at different speeds when using the QA
or the OSQL tool.
Nick
----------
>From: "Andrew J. Kelly" <ake...@targitmail.com>
In article <uujGoXDDAHA.196@cppssbbsa04>, "Andrew J. Kelly"
Q. When I run a query under SQL Executive/SQL Agent it is much slower than
when run via Query Analyzer. Why?
A. Put a SET NOCOUNT ON at the start of the query/stored procedure. This will
stop most of the handshaking going on between SQL Server and SQL
Agent/Executive. This handshaking can significantly slow down a query that is
being executed by a background task.
===
v1.01 2000.04.13
Applies to SQL Server versions : All
FAQ Categories : Troubleshooting
Related FAQ articles : n/a
Related Microsoft Kb articles : n/a
Other related information : n/a
Authors : Neil Pike
Neil Pike MVP/MCSE. Protech Computing Ltd
Reply here - no email
SQL FAQ (484 entries) see
forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps (faqrtf.zip - L7
- SQL Public)
or http://www.ntfaq.com/Section.cfm?sectionID=34
or www.sqlserverfaq.com
or www.mssqlserver.com/faq