Running scripts parallely

Hi,
Posting my first query in this Forum,here's my query

i want to execute 100 .sql files in unix having some code for connecting with db and executing procedures inside that,that to be run parallel like threads.want to run all the 100 .sql files simultanously.

thanks in advance.

Note - you may run into process limits if you try 100 files at once.
Plus, you will run into performance problems unless your boxes has dozens of cpus.
I'm limiting it to 16, you can change that.

create a file (call it sql.lis ) with fully qualified names of the .sql files - e.g.,
/path/to/file1.sql
/path/to/file2.sql

#!/bin/ksh
let cnt=1
let lgcnt=0
username="me"
passwd="foo"
while read sql 
do
     echo "
       @"$sql"
       exit
     " | sqlplus -s "$username"/"$password"@myoracleinstance > /path/to/logs/sqllog_"$lgcnt".log_$$   &
    let cnt=$cnt+1
    let lgcnt=$lgcnt+1
    if [[ $cnt -eq 16 ]] ; then
         let cnt=0
         wait
    fi
done <  /path/to/sql.lis

thanks for your reply.
but the log file are updating one after the other.
so i think it's executing one by one..

Yes, I just gave an Oracle example.

Unless you have multiple cpus, you will have only one process executing at a time, in a round-robin kind of affair. In other words, process #1 runs for 20ms, then process #2 gets 20ms, then process #3... and so on.

What UNIX and how many cpus on the box you are running these processes on?

Actually we are having a single unix server sun solaris 5.
simulatanouly 100 users will access the system.