RE: NT script question ???

2001-06-05 Thread Gogala, Mladen

Yeah, directly from the pharaoh Larry Wall the Magnificent.

-Original Message-
Sent: Monday, June 04, 2001 10:30 PM
To: Multiple recipients of list ORACLE-L


cripting tools? Mladen, is that some new Egyptian software?


From: Gogala, Mladen [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Subject: RE: NT script question ???
Date: Mon, 04 Jun 2001 16:20:49 -0800

Go to http://www.activestate.com, get perl, DBI  DBD::Oracle and you'll
have all the cripting tools that you'll ever need. Associative arrays, 
state
of the art reuglar expressions, functions, format commands and well
documented
ways of accessing the oracle database from within a script (O'Reilly book).
That version of perl supports Andy Duncan's Orac_DBA and Adam von Nieda's
Oracletool (http://www.oracletool.com), two excellent DBA utilities with 
the

unbeatable price.

-Original Message-
Sent: Saturday, June 02, 2001 7:15 PM
To: Multiple recipients of list ORACLE-L


Hi,

I have couple of questions about bat file in NT 4.0
for Oracle 8.1.5.

1. how to make bat file take parameters.  I had a
backup.bat, and like to pass in Oracle SID, so the
script can backup any database.

2. in the bat file, how to dynamically append
date/time into a directory name,  like
backup_06022001121314

Thank you!

Andrea

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Andrea Oracle
   INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Gogala, Mladen
   INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

_
Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gogala, Mladen
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NT script question ???

2001-06-04 Thread Gogala, Mladen

Go to http://www.activestate.com, get perl, DBI  DBD::Oracle and you'll
have all the cripting tools that you'll ever need. Associative arrays, state
of the art reuglar expressions, functions, format commands and well
documented 
ways of accessing the oracle database from within a script (O'Reilly book).
That version of perl supports Andy Duncan's Orac_DBA and Adam von Nieda's 
Oracletool (http://www.oracletool.com), two excellent DBA utilities with the

unbeatable price.

-Original Message-
Sent: Saturday, June 02, 2001 7:15 PM
To: Multiple recipients of list ORACLE-L


Hi, 

I have couple of questions about bat file in NT 4.0
for Oracle 8.1.5.

1. how to make bat file take parameters.  I had a
backup.bat, and like to pass in Oracle SID, so the
script can backup any database.

2. in the bat file, how to dynamically append
date/time into a directory name,  like
backup_06022001121314

Thank you!

Andrea

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Andrea Oracle
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gogala, Mladen
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NT script question ???

2001-06-04 Thread Rachel Carmichael

cripting tools? Mladen, is that some new Egyptian software?


From: Gogala, Mladen [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Subject: RE: NT script question ???
Date: Mon, 04 Jun 2001 16:20:49 -0800

Go to http://www.activestate.com, get perl, DBI  DBD::Oracle and you'll
have all the cripting tools that you'll ever need. Associative arrays, 
state
of the art reuglar expressions, functions, format commands and well
documented
ways of accessing the oracle database from within a script (O'Reilly book).
That version of perl supports Andy Duncan's Orac_DBA and Adam von Nieda's
Oracletool (http://www.oracletool.com), two excellent DBA utilities with 
the

unbeatable price.

-Original Message-
Sent: Saturday, June 02, 2001 7:15 PM
To: Multiple recipients of list ORACLE-L


Hi,

I have couple of questions about bat file in NT 4.0
for Oracle 8.1.5.

1. how to make bat file take parameters.  I had a
backup.bat, and like to pass in Oracle SID, so the
script can backup any database.

2. in the bat file, how to dynamically append
date/time into a directory name,  like
backup_06022001121314

Thank you!

Andrea

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Andrea Oracle
   INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Gogala, Mladen
   INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

_
Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: NT script question ???

2001-06-03 Thread Reardon, Bruce (CALBBAY)

Andrew,

Batch parameters are referred to as %1, %2 etc
%0 is the name of the calling command.
%* refers to all parameters
You can use the shift command to move parameters (do help shift)

As an example:
C:\batchtype param_test.bat
@echo off
echo %1
echo %2
echo %0
echo %*
C:\batch
C:\batch
C:\batchparam_test.bat one two three four five
one
two
param_test.bat
one two three four five

C:\batch
To append the date / time, use the for command to split up the output of
time and date commands.


For example:


C:\batch test_time.bat
[08504789]
[0604Mon]

---

@echo off
rem test_time.bat

call :get_timestamp

call :get_datestamp

goto :EOF

:::


:get_timestamp

:: get the time in format hhmmssxx, where 'xx' is hundredths of a
second
::  because want ssxx can not use time/t
   for /f tokens=1-8 delims=:.  %%a in ('echo.^| time ^| find current')
do (
   set zhh=%%e
   set zmm=%%f
   set zss=%%g
   set zxx=%%h
   )

   if 10 GTR %zhh% set zhh=0%zhh%

:: assign the values to ztimefull
   set ztimefull=%zhh%%zmm%%zss%%zxx%
 
   echo [%ztimefull%]

rem cleanup
   set zhh=
   set zmm=
   set zss=
   set zxx=

   goto :EOF

:::


:get_datestamp

:: get the time in format mmdd
   for /f tokens=1-8 delims=:.-/  %%a in ('echo.^| date ^| find
current') do (
   set z=%%h
   set zmm=%%g
   set zdd=%%f
   )


:: assign the values to zdatefull
   set zdatefull=%z%%zmm%%zdd%
 
   echo [%zdatefull%]

rem cleanup
   set z=
   set zmm=
   set zdd=

   goto :EOF

:::





---




A more useful example of parameters might be:

@echo off

rem PURPOSE
remdelete_oldfiles.bat
remdeletes files greater than or equal to x days old
rem Note - directories are not deleted.

rem does not delete read only, hidden or system files

rem  18-Apr-2000 , Bruce Reardon : Creation.

rem USEAGE
rem Parameters - %1 = path , %2 = file mask , 
rem %3 = how many days old , %4 (optional) - recurse



rem ASSUMPTIONS
rem none.


rem REQUIRES
rem forfiles.exe - distributed with NT Resource kit
rem that forfiles.exe be located at c:\nt4reskit

rem SIDE EFFECTS
rem envdelold env variable will be overwritten and deleted if it exists.

rem MODIFICATIONS

::

rem Parameter validation.

IF %3== goto param_problem   :: not enough params

IF NOT %5== goto param_problem  :: too many params

rem check parameter 3 is a valid number
set envdelold=
IF %3==0 goto param3_ok 

   set /a envdelold = 1*%3  2 nul:
   IF %envdelold%==0 goto param3_problem 
   IF %envdelold%== goto param3_problem 

:param3_ok


IF NOT %4== IF NOT %4==-s goto param4_problem  :: invalid param 4

IF NOT EXIST %1. goto param1_problem



rem we now have 3 (possibly 4) parameters and they have been
validated.

echo %1 %2 %3 %4


rem the actual command - put quotes around to allow for names with
spaces.

c:\nt4reskit\forfiles -p%1 -m%2 %4 -d-%3 -ccmd /c if @ISDIR==FALSE  del
0x22@FILE0x22


goto end



:param_problem
   echo %0
   echo ERROR - Must pass in 3 parameters (4 max)
   echo Param 1 is the path
   echo Param 2 is file mask
   echo Param 3 is number of days
   echo Param 4 (optional) : if -s then recurse subdir's.
   echo.
   echo eg %0 c:\temp *.* 5 would delete ALL files in c:\temp directory 5
or more days old
   goto end


:param1_problem
   echo %0 [--[%1]--] %2 %3 %4
   echo ERROR - 1st parameter invalid
   echo Param 1 is the path and it must exist.
   echo.
   echo   eg %0 c:\temp *.* 5 would delete ALL files 
   echo in c:\temp directory 5 or more days old
   goto end

:param3_problem
   echo %0 %1 %2 [--[%3]--] %4
   echo ERROR - 3rd parameter invalid
   echo Param 3 is the number of days and it must be a valid number
   echo.
   echo   eg %0 c:\temp *.* 5 would delete ALL files 
   echo in c:\temp directory 5 or more days old
   goto end


:param4_problem
   echo %0 %1 %2 %3 [--[%4]--]
   echo ERROR - 4th parameter invalid
   echo Param 4 (optional) : must be -s (to recurse subdir's) or be
blank.
   echo.
   echo   eg %0 c:\temp *.* 5 -s would delete ALL files 
   echo in c:\temp directory (incl subdirs) 5 or more days old
   goto end


:end
   rem - batch file finished
   set envdelold=

---

-Original Message-
Sent: Sunday, 3 June 2001 9:15 

Hi, 

I have couple of questions about bat file in NT 4.0
for Oracle 8.1.5.

1. how to make bat file take parameters.  I had a
backup.bat, and like to pass in Oracle SID, so the
script can backup any database.

2. in the bat file, how to dynamically append
date/time into a 

NT script question ???

2001-06-02 Thread Andrea Oracle

Hi, 

I have couple of questions about bat file in NT 4.0
for Oracle 8.1.5.

1. how to make bat file take parameters.  I had a
backup.bat, and like to pass in Oracle SID, so the
script can backup any database.

2. in the bat file, how to dynamically append
date/time into a directory name,  like
backup_06022001121314

Thank you!

Andrea

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Andrea Oracle
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).