Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


osql batch taking long longgg time


osql batch taking long longgg time

Author
Message
n00bDBA
n00bDBA
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 467
hi,

trying to understand whats going on and was hoping someone could help.

I have 10 scripts to run. Doing them 1 by 1 it takes less than a second for each to run. speeds though no problems.

If i put them into a osql batch its gets part way though and now just crawling along.. I have SP_WhoIsActive and running that its on the same query (A simple update single row)

And its just not moving.. the cpu total is just rising and rising, reads have gone into the millions! and status is suspended and its a wait on pageiolatch_ex (few mins ago it was pageiolatch_sh)

I know osql isn't a preferred choice but from the quick read around i saw its only because its limited in options compared to sqlcmd so didn't think that would factor..

the osql lines are -

osql -E -S server -d db -i "C:\temp\stage1.sql" -o "C:\temp\1.ans"

Just thought is it running all of the scripts at once? Ive just got ans files created for scripts that happen after this update!


Any ideas?
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8261 Visits: 14368
Chances are the issue has nothing to do with osql but I am compelled to say it anyway, switch to using sqlcmd.exe, osql.exe has been a deprecated feature since SQL 2005 :-)

pageiolatch_ex means a query in the script needs data from disk. You said the scripts ran in seconds when run 1 by 1. Was that is an SSMS query window? And was that against the same database with the same amount of data on a server with the same amount of activity?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Paul Brewer
Paul Brewer
SSC-Enthusiastic
SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)SSC-Enthusiastic (155 reputation)

Group: General Forum Members
Points: 155 Visits: 1294
Might be worth checking sys.dm_os_waiting_tasks and sys.dm_tran_lock
Regards
n00bDBA
n00bDBA
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 467
hi!

yes i ran them i ssms.. it was against the same database / machine seemed to get stuck but did finish eventually.. nothing else was happening on the box.

Ill see what happens with sqlcmd tomorrow, Do you know if osql was running all the scripts at the same time or it does one then proceeds to the next.

thanks
n00bDBA
n00bDBA
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 467
Sorry Paul missed your post!

ill take a look at them when i do it again.. hopefully help track it down some more...

guessing it has to be some sort of locking issue..

Thanks
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8261 Visits: 14368
n00bDBA (10/10/2012)
Do you know if osql was running all the scripts at the same time or it does one then proceeds to the next.

Separate calls to the exe will constitute a separate session to the database. Inside each script the existence of a GO will separate batches within the same session.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search