Click to See Complete Forum and Search --> : Connect DB in a windows script


rnavarrc
01-14-2009, 05:19 AM
Hello all,

I want to connect to oracle with a windows .bat for execute some commands. I create the script like this:

***************************
echo off
sqlplus "sys as sysdba"
passwd
commands
exit
***************************

When I execute the .bat i only obtain the passwd request. The problem is that only execute the first line.

How can I execute this script? what are the commands that i have to modify?

Thanks in advanced.

onkar.nath
02-12-2009, 06:03 AM
You can do so by this way:
1. create sql file containing whatever commands you want to execute.ex:
d:\test.sql
<command1>;
<command2>;
<command3>;
.
.
<command n>;

2. create another sql file containing , say con.sql
"sys/passwd@<string> as sysdba" @d:\test.sql

3. create a .bat file as :

echo off
sqlplus @con.sql

Hope this helps