Home » Infrastructure » Windows » Batch file issues
Batch file issues [message #99977] |
Tue, 04 June 2002 07:59  |
Leo Hernandez
Messages: 1 Registered: June 2002
|
Junior Member |
|
|
Dear Oracle DBA (or anyone good with dos commands...)
I ran into something quirky in WinNT4.0 with regards to SQL*plus, batch file, and dos commands.
I have created script files and a batch file to automate a hotbackup. The scripts and batch file works!
However, the simplest part of the project is what is giving me a road block.
For some reason, in WinNT4.0, when a batch file executes sql*plus, which in turn issue a command like this:
Host echo "some string......"
The echo to host does not get outputted, rather I get a "The handle is invalid" on the console.
Why am I trying to echo out to "some string..." from within sql*plus (you might ask)? Well the batch file and sql-scripts works a little something like this:
The batch file will start sql*plus, login, start the first sql-script, AND redirect output to a log file.
For example: my_batch.bat
---------------------------------------------------------------------------
set oracle_sid=orcl
set oracle_home=c:oracleora81
sqlplus system/manager @my_sqlscript.sql > my_err.log
---------------------------------------------------------------------------
my_sqlscript.sql then would run it's on sql statements, issue os copy commands (host copy c:filepath.... f::filepath......), run other sql-scripts, AND echo out strings to host (host echo "some string...."). I echo out the strings to host so that it becomes part of the output to the log file (my_err.log). This way, I can make notation regarding the stages of the scripts.
For example: my_sqlscript.sql
---------------------------------------------------------------------------
alter tablespace system begin backup;
host copy c:oradataorclsystem01.dbf f:system.dbf
alter tablespace system end backup;
host echo "end of system tablespace backup..."
---------------------------------------------------------------------------
Here's the quirk: When I developed these scripts in Windows2000, the output to my_err.log read like this:
---------------------------------------------------------------------------
Tablespace altered.
1 file(s) copied
Tablespace altered.
"end of system tablespace backup..."
---------------------------------------------------------------------------
This is what I expected to get. All feedbacks coming from both sql*plus ("Tablespace altered") and all os feedback ("1 file(s) copied) and the echo were outputted and redirected to my_err.log.
HOWEVER, the DBs I need to run these scripts against are on WinNT4.0. And when I run these same scripts there, this is all I get:
---------------------------------------------------------------------------
Tablespace altered.
Tablespace altered.
---------------------------------------------------------------------------
Obviously, the os feedbacks and echo are missing. In addition, a message gets outputted to the console while this batch runs: "The handle is invalid" And the amount of times this message gets outputted to the console while the batch runs corresponds to the how many "host echo..." commands the sql-scripts issued.
Anyone ever run into this? Does anyone know if this is a patch issue with NT or SQL*plus. I appreciate any "feedbacks.."
I can live without the "host echo..." I can simply replace it with a "select 'some string...' from dual;" But the os feedbacks are crucial.
Thanks,
Leo D. Hernandez
(303) 401-1696
dbbyleo@yahoo.com
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 17 01:16:05 CDT 2025
|