Databases Reference
In-Depth Information
Table 9-2. Crontab Entries
Field Position
Example
Description
1
20
Shows the minute of the time component. You can place multiple values here,
such as 10 , 20 , 30 to execute at the 10th, 20th, and 30th minute. You can also
specify a range such as 10-12 to denote the 10th, 11th, and 12th minutes.
2
12
Shows the hour of the time component in 24-hour format. For instance, to set
something for 1:23 p.m., you will place 13 in this field and 23 in the minutes field
(the first field). Like the minutes, you can place a range here as well. If you place an
asterisk on this field, the task is executed every hour, on that minute. For instance,
if fields 1 and 2 are 20 and *, the task executes every 20 minutes of every hour.
3
25
Date when this task is run, 25th in this case. An asterisk in this field means every day.
4
12
Month when the task will run. In this example, it will run on December 25. An
asterisk in this field means every month on that date, shown in field 3.
4
3
Weekday, starting with 0 for Sunday. So, 3 means it will execute on Wednesday.
myrman.sh
5
The actual task name.
Developing a Windows Batch File to Run RMAN
Problem
You want to develop a Windows batch file to kick off RMAN to back up the database on a Windows server.
Solution
A batch file in Windows to script RMAN commands is similar in concept to a shell script in Unix, but you need to shift
directions. In the Unix script, you used the RMAN commands inline in the script. In Windows, you will use a slightly
different approach, as shown here:
1.
Create a RMAN command file with all the parameters you want.
2.
Call the command file from the RMAN command line.
The batch file needs some utilities outside what are available in Windows:
A utility to get the date and time in the format you want; here we have used a tool called
realdate . We give a source for this utility in the “How It Works” section.
bmail . Again, see “How It Works” for where to
A utility to send e-mail; here we use a tool called
find this utility.
Here are the steps for creating a batch file:
Check whether realdate is installed. If not, install realdate .
1.
Install bmail . Again, see “How It Works” for the source of this utility.
2.
3.
Prepare the batch file as shown in the upcoming code. Please note that the lines are
preceded by line numbers for easy explanation; they do not actually appear in the code.
4.
Schedule the batch file for execution via any scheduler, such as Windows Scheduler or the
at command (described in Recipe 9-6).
 
 
Search WWH ::




Custom Search