AllExperts > Experts 
Search      

Oracle

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Oracle Answers
Question Library

Ask a question about Oracle
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Peter Choi
Expertise
I am a senior Oracle DBA, PeopleSoft Administrator and Project Manager with 10 years experience. I have been working with PeopleSoft (HRMS 5, 7, 7.x and 8.9), Oracle RDBMS (7.3 - 10gR2) on various Unix and Windows platforms, and some Oracle Application Server (9i/10gR2). I also have experience with the configuration and administration of BEA`s Tuxedo and WebLogic for PeopleSoft 8.x.

 
   

You are here:  Experts > Computing/Technology > Oracle > Oracle > Oracle commands from Windows command line...

Topic: Oracle



Expert: Peter Choi
Date: 6/16/2008
Subject: Oracle commands from Windows command line...

Question
Peter, a couple of years ago you asked the question:

"Is there a way to run oracle commands *directly* from the windows command line? In other words, is there something similar to the osql tool for SQL Server? SQL*Plus is a command line utility for Oracle, but you first have to start it and then you can issue the commands, as far as I know there is no way to type something like 'sqlplus user=scott@mydb pwd=tiger command="exec myproc;' at the windows command line prompt."

I have the same question/need. Did you ever get a good answer to this question?

Thanks,
Stephen

Answer
Hi Stephen,

With Oracle 8i and higher, you can now invoke SQL*PLUS from a MS-DOS command line in Windows.

The easiest way is to ensure that you've setup the proper paths and environment variables such as

ORACLE_HOME specifies the (home) directory where Oracle products are installed. This directory is exactly one level below ORACLE_BASE.

ORACLE_SID specifies the database (System Identifier) that you wish to connect to.

You can create a <file_name>.BAT file that can be scheduled using Task Scheduler to be launched at a specified date/time or recurrence.

Within the .bat file, you would have something like this:

%ORACLE_HOME%\bin\sqlplusw.exe <user>/<passwd>@<%ORACLE_SID%> @<path>\<file>.sql

Where <path>\<file>.sql contains the SQL code that you want to execute.

Hope this helps.

Peter  

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.