Help required with xargs to use sqlplus

Hello All,

I have a requirement in which i need to run few Oracle sql files in parallel.
I want to use xargs command [I don't want to use & and send the job to background] to achieve parallelism.

I tried below command:

cat x|xargs -n 1 -P 5 sqlplus -s $usr/$pwd@$Host @{}

File x has the list of sql files to be executed.

I am getting the error message
SP2-0310: unable to open file "{}.sql"

Please help me.

Thanks in Advance

I wonder if that helps.

xargs -I {} -n 1 -P 5 sqlplus -s $usr/$pwd@$Host @"{}" < x
1 Like

I don't think xargs will run those programs in parallel without sending any of them into background.

Thankyou very much Aia. You solved my issue. :b::b::b:

Thanks RudiC for your reply. I know xargs runs the parallel jobs in background, but i don't want to do it myself using &.