how to connect to Oracle by cmd script

I have a set of sql scripts to go to oracle instance database. I have a .cmd files with all the sql script. I have an oracle database in local Windows XP machine

How to connect to oracle? How to write the connection string?
Who is Participating?
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:

%1 = username
%2 = password
%3 = database

In case you would want to specify your script as a parameter as well, your script could look like this:

set _SCRIPT=%4

and call it like this:

runsql.cmd <user> <password> <database> <scriptname>
wasabi3689Author Commented:
Does someone understand what the following mean


If I have  a sever name : John
and Oracle instance name : ABC
and user name: sys
password: xxxx

So, how to write the connection statement to oracle in cmd.file?
slightwv (䄆 Netminder) Commented:
Normally in Windows you have the sql commands in another file like myscript.sql

Then use sqlpus to execute it:
sqlplus username/password@ABC @myscript.sql
slightwv (䄆 Netminder)Connect With a Mentor Commented:
>>Does someone understand what the following mean

I Missed this.  This is just setting local variables to the script command line arguments.

using the same sqlplus and your variables:
sqlplus %_DATABASE_SECURITY% @myscript.sql
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.