Home » Infrastructure » Windows » Windows batch job Help (windows Xp,oracle 9i)
Windows batch job Help [message #359846] Tue, 18 November 2008 06:02 Go to next message
Srinandini
Messages: 13
Registered: November 2008
Junior Member
Hi All

My requirement isto call .sql script files from a windows batch (.bat) file. The filename is given as input

The SQl scripts will have stateements to create table, alter structute etc

I have developed a sample batch job that takes a Stored procedure's name as nput and executes it

But am not able to call sql files within the .bat file

Could you please help on this?

Regards
Srinandini
Re: Windows batch job Help [message #359852 is a reply to message #359846] Tue, 18 November 2008 06:06 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
Srinandini,

Can you please post the script of the batch files?

Regards,
Jo
Re: Windows batch job Help [message #359853 is a reply to message #359846] Tue, 18 November 2008 06:07 Go to previous messageGo to next message
Michel Cadot
Messages: 59750
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Can you search in the Windows forum?

Regards
Michel
Re: Windows batch job Help [message #359866 is a reply to message #359846] Tue, 18 November 2008 06:31 Go to previous messageGo to next message
Srinandini
Messages: 13
Registered: November 2008
Junior Member
@echo off
set PNAME=%1
echo Command Line Argument: %PNAME%

echo connect produser/password@cms_prd_bg01 >%0.tmp
echo set serveroutput on;>>%0.tmp
echo exec %PNAME%; >>%0.tmp


rem -- Run sql script --
sqlplus /nolog @%0.tmp

rem -- Cleanup --
del %0.tmp

goto End

:Usage
echo Usage: %0 TABLE_NAME

:End



this is the bat code. Am passing a name of the SP as input where it works fine

But i need to pass filename as input . Amexecuting the batch file from cmd prompt

I tried to place all the stmts in the SQl scripts inside the Sp.
But since i used execute immediate am facing the problem of Insufficient previleges

So can u pls help me how to go abt this?
Re: Windows batch job Help [message #359871 is a reply to message #359866] Tue, 18 November 2008 06:53 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Dont know if I understand you correctly, but if you want to "send" the filename as an input parameter to your bat file.

set procname=%1
set filename=%2

echo connect produser/password@cms_prd_bg01 >%filename%


then just
C:\>test.bat P1 C:\>myscripts\myfile.tmp


[Updated on: Tue, 18 November 2008 06:54]

Report message to a moderator

Re: Windows batch job Help [message #359874 is a reply to message #359871] Tue, 18 November 2008 07:07 Go to previous messageGo to next message
Srinandini
Messages: 13
Registered: November 2008
Junior Member
Besides passing the filename as input i have to execute the file
It's a SQL file that consists of DDL/DML scripts
Re: Windows batch job Help [message #359875 is a reply to message #359874] Tue, 18 November 2008 07:09 Go to previous message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

No problem

just
cmd /k sqlplus "%CONNECT_USER%@%TNS%" @%filename%

[Updated on: Tue, 18 November 2008 07:10]

Report message to a moderator

Previous Topic: InitialLOBFetchSize & FetchSize."oracle"
Next Topic: Oracle 10g installation with 4GB RAM
Goto Forum:
  


Current Time: Sun Nov 23 08:58:02 CST 2014

Total time taken to generate the page: 0.08298 seconds