Wednesday, April 06, 2005
The script needs to be run from a commandline - and will echo usage back to you if you get it wrong and is available from the link at the right OraLoader or here.
For those of you that don't like downloading and running vbs scripts unseen the code is shown below.
'Name OraLoader.vbs
'
'Purpose: Run multiple sqlplus sessions concurrently
'
'Description: Run n instances of a named script simultaneously.
'
'Notes:
dim oShell
dim sqlScript
dim cmdLine
dim strUsage
dim iInstances
dim dbUser,dbPwd
strUsage = "Usage: cscript n scriptname username password"
strUsage = strUsage & vbCRLF & vbTab & "n = No of instances "
strUsage = strUsage & vbCRLF & vbTab & "scriptname = path to sql script"
strUsage = strUsage & vbCRLF & vbTab & "username = database username"
strUsage = strUsage & vbCRLF & vbTab & "password = database password"
if (Wscript.Arguments.count <> 4) then
Wscript.stdout.write strUsage
Wscript.Quit(1)
end if
' assign variables
iInstances = Wscript.Arguments(0)
sqlScript = Wscript.Arguments(1)
dbUser = Wscript.Arguments(2)
dbPwd = Wscript.Arguments(3)
cmdLine = "sqlplus " & dbUser & "/" & dbPwd & " @" & sqlScript
set oShell = CreateObject("wscript.shell")
wscript.stdout.write cmdline
runCommand iInstances,cmdLine
set oShell= nothing
sub runCommand(iload,strCommand)
for i = 1 to iload
oShell.exec(strCommand)
next
end sub
My advice is to be very sure that the sql scripts that you call exit cleanly at the end, otherwise you can be left with a bunch of unnecessary sqlplus sessions running.
I have a number of similar scripts for loading remote servers, but the example above should give you the idea.