Databases Reference
In-Depth Information
46. :: Merge the Logfiles
47. type %TMPLOG% >> %LOG%
48. :: Check for errors
49. ::
50. echo THE OUTPUT WAS %ERRORLEVEL% >> %LOG%
51. findstr /i "error" %LOG%
52. if errorlevel 0 if not errorlevel 1 bmail -s %MS% -t %DBAPAGER% •
-f "Database" -m %LOG%
53. @echo on
How It Works
The program realdate is freely available at www.huweb.hu/maques/realdate.htm . The program bmail is freely available
at http://retired.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm . This page also details its usage.
Table 9-3 gives a line-by-line explanation of the solution batch file.
Table 9-3. Line-by-Line Explanation of the Batch File
Lines
Description
1
This line instructs the batch program executer to stop displaying the commands in the file; just
execute them.
4
We set the Oracle Home.
5
We set the Oracle SID.
6
We set the location of this batch file.
7
We specify the type of the backup, such as disk, tape, and so on. Please note that specifying a type
here merely places the type in the name of the log file; it does not impact the type of the backup
created by this batch file. The RMAN backup commands in the batch file determine the nature of
the backup created.
8
We specify the type of backup, such as full or incremental, so that it becomes part of the name of
the log file.
The MAXPIECESIZE for the backup is specified here.
9
10
The variables that hold the location of the backup.
11-12
The addresses where an e-mail will be sent.
The catalog connection string. In this script, we have assumed that the rman repository username is
the ORACLE_SID and the password is the same as the username.
13
14
The mail server name. You can ask your e-mail administrator for this. In many small and medium
organizations, this may be mail.organization.com .
21
We want to create a log file whose name should have the current date and time. The standard
Windows date command does not easily yield a usable form of the date to be used in the log file,
as is the case with the time component. Here we have used a special program called realdate .
More information about realdate is provided following the table. In this line, we have extracted
the current date and issued the command to set a variable curdate to hold the current date. For
instance, if this program is executed on February 1, 2007, the command realdate /d /s="set
curdate=" returns set curdate=20070201 . This line is placed in the file tmp_dt.bat.
( continued )
 
Search WWH ::




Custom Search