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

osql batch taking long longgg time Expand / Collapse
Author
Message
Posted Wednesday, October 10, 2012 2:44 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, March 11, 2014 9:41 AM
Points: 118, Visits: 439
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?
Post #1370766
Posted Wednesday, October 10, 2012 6:07 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:21 PM
Points: 7,079, Visits: 12,568
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
Post #1370870
Posted Wednesday, October 10, 2012 6:27 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, June 30, 2014 6:45 AM
Points: 65, Visits: 948
Might be worth checking sys.dm_os_waiting_tasks and sys.dm_tran_lock
Regards
Post #1370883
Posted Wednesday, October 10, 2012 7:09 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, March 11, 2014 9:41 AM
Points: 118, Visits: 439
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



Post #1370906
Posted Wednesday, October 10, 2012 7:45 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, March 11, 2014 9:41 AM
Points: 118, Visits: 439
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

Post #1370923
Posted Wednesday, October 10, 2012 7:51 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 3:21 PM
Points: 7,079, Visits: 12,568
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
Post #1370927
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse