OraCmd - Oracle access without client tool »

Download OraCmd Free Trial »

Run in batch-mode

Sometimes you need create a batch file to execute script:

  1. Execute sql/script on machine that without installing Oracle client. 

  2. Have several oracle procedures that you need to run every day.
	
  3. Load or Unload data every day.

  4. Create a batch file that be called by other application.

  5. ...

example (The lines wrap in this page, but in the file is 1 line):

1) sql.bat
OraCmd userid=scott/tiger@192.168.1.2:1521:xe sql="update customer set state_cd='MA' where state_cd='CA'" quit=y

2) script.bat
OraCmd userid=scott/tiger@192.168.1.2:1521:xe script="d:\data\update_data.sql" quit=y

3) load.bat
OraCmd userid=scott/tiger@192.168.1.2:1521:xe task=load table=jobs datafile="d:\data\jobs.txt" delimiter="|" quote="'" header=y loadtype=replace quit=y

4) unload.bat
OraCmd userid=scott/tiger@192.168.1.2:1521:xe task=unload table=jobs datafile="d:\data\jobs.txt" delimiter="|" quote="'" header=y quit=y log="d:\data\unload_jobs.log"

5) unloadall.bat
OraCmd userid=scott/tiger@192.168.1.2:1521:xe task=unload table=all folder="d:\data\unload" delimiter="|" quote="'" header=y quit=y log="d:\data\unload_all.log"

parameters:

userid="username/password@host:port:SID"

sql= sql command

script = sql script filename 

task = load|unload

quit = y|n (quit OraCmd after run batch file)

log = log file name

prompt = y|n (default y, when unload table, use prompt=n and without passing "datafile" parameter, can output the unload result to stdout only.

other parameters can find at relative pages.