Databases Reference
In-Depth Information
You can add comments to your RMAN commands, which makes it easy to follow the logic of your RMAN
commands when you use several of them inside a command file (we discuss RMAN command files later in this
chapter). Each comment must be preceded by the # sign. Here's an example of an RMAN command file that performs
an incremental backup of the database:
# this command will be run daily
backup incremental level 1
for recover of copy # uses incrementally updated backups
database;
This RMAN code includes two comments, each preceded by the hash (#) sign. Notice how you can make an
entire line into a comment, or merely append a comment to the end of a line containing a command. The example
shows both approaches.
How It Works
When you begin entering a command, RMAN buffers every line that you enter until you end a line with a semicolon.
Any text on a line following a # sign is considered commentary and is ignored. When you enter the terminating
semicolon, RMAN executes the command that you've entered. Although you aren't supposed to use reserved
keywords as part of the arguments you supply to RMAN commands, you can, if you want, use reserved keywords
(such as file name, tablespace name, or tag name) by simply enclosing them within single or double quotes, as shown
in the following example, which specifies a tag named “full” (which is an RMAN reserved word):
RMAN> backup database tag 'full';
In general, it's probably best to avoid using RMAN keywords for things such as channel names.
Saving RMAN Output to a Text File
Problem
You want to save the output of an RMAN session to a text file.
Solution
You can save RMAN output to a text file by issuing the spool command and specifying the name of the log file. You
don't have to create the log file beforehand. Here's an example showing how to use the spool command:
RMAN> spool log to '/tmp/rman/backuplog.f';
RMAN> backup datafile 1;
RMAN> spool log off;
Spooling for log turned off
Recovery Manager12.1.0.0.2
RMAN>
RMAN will create the log file if it doesn't already exist. If a file with the same name exists,RMAN will overwrite
the older file.
 
Search WWH ::




Custom Search