Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

How to debug query Expand / Collapse
Author
Message
Posted Thursday, May 9, 2013 1:05 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 30, 2014 12:49 PM
Points: 318, Visits: 440
I apologize to all for my poor forum etiquette. I thought my problem was T-SQL related. I was wrong, and my query's poor performance seems to have a DB issue.

...I put CPAS into single-user mode to lock out users. I've put it back in multi-user mode and rerun the backup. It's running now.
...Even though CPAS could not back up, the error file does seem to show problems with indexes. How do I rebuild all the indexes?
...The backup job just finished normally, and the "long-running query" ran in 4 seconds. Back to normal.

...My backup job does reorganize the indexes, so maybe that fixed it. I dunno.

I really appreciate everyone's time and attention. Again, I apologize for the "dual-threaded" post. It was not meant to be that way.


Jim
Post #1451303
Posted Thursday, May 9, 2013 1:16 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 30, 2014 12:49 PM
Points: 318, Visits: 440
I apologize for my "dual-threaded" post. What I thought was a T-SQL error appears to have been corrupted indices or some other odd corruption.

...I ran the backup plan once again (with the db back in multi-user mode...) and it worked. I'm not sure why. In any case, the offending query now runs in 4 seconds (has to go through a couple million rows...) and the users' report pops up even faster. So, problem solved.

I want to thank all of you for helping me. I admit to some panic, but I do have lots of backups, so it wouldn't have been too bad, and I learned something.

If anyone wants to review my backup plan (capture.png) and criticize it, I'd be grateful. If not, thanks anyway!

Again, thank you all for the help. Oops....didn't realize I'd posted twice. Sorry


Jim
Post #1451305
Posted Thursday, May 9, 2013 1:20 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 9:05 AM
Points: 42,468, Visits: 35,540
JimS-Indy (5/9/2013)
...Even though CPAS could not back up, the error file does seem to show problems with indexes. How do I rebuild all the indexes?


What error shows problems with the indexes?

If you mean
Source: Reorganize Index
Description: The Execute method on the task returned error code 0x80131501 (An exception occurred while executing a Transact-SQL statement or batch.). The Execute method must succeed, and indicate the result using an "out" parameter.

that would be the same cause as the backups failing, specifically that the DB was in single user mode and there was already an open connection to the database, hence the rebuild failed because it could not connect to the database.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1451306
Posted Thursday, May 9, 2013 1:31 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 30, 2014 12:49 PM
Points: 318, Visits: 440
Gail, I don't know what the problem was. It seems to have gone away when I ran the backup successfully. As I said, that step includes a "reorganize index" step, so maybe that fixed the indexes. The error file had:

Error: 2013-05-09 14:50:40.63
Code: 0xC0024104
Source: Reorganize Index
Description: The Execute method on the task returned error code 0x80131501 (An exception occurred while executing a Transact-SQL statement or batch.). The Execute method must succeed, and indicate the result using an "out" parameter.
End Error

Which I (not knowing what I'm looking at...) interpreted as a separate error.


Jim
Post #1451308
Posted Thursday, May 9, 2013 4:50 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 9:05 AM
Points: 42,468, Visits: 35,540
That would have been caused by exactly the same thing that caused the backups to fail, the database being in single-user mode and an existing connection to the database, hence the reorganise would not have been able to connect and would have failed.
Once you switched out of single-user mode, the backups and reorganise could run successfully.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1451375
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse