Database Reference
In-Depth Information
Setting NLS_DATE_FORMAT
Before running any RMAN job, I set the OS variable NLS_DATE_FORMAT to include a time (hours, minutes, seconds)
component; for example,
$ export NLS_DATE_FORMAT='dd-mon-yyyy hh24:mi:ss'
Additionally, if I have a shell script that calls RMAN, I put the prior line directly in the shell script (see the shell
script at the end of Chapter 4 for an example):
NLS_DATE_FORMAT='dd-mon-yyyy hh24:mi:ss'
This ensures that when RMAN displays a date, it always includes the hours, minutes, and seconds as part of the
output. By default, RMAN only includes the date component ( DD-MON-YY ) in the output. For instance, without setting
NLS_DATE_FORMAT , when starting a backup, here is what RMAN displays:
Starting backup at 04-SEP-14
When you set the NLS_DATE_FORMAT OS variable to include a time component, the output will look like this instead:
Starting backup at 04-sep-2014 16:43:04
When troubleshooting, it's essential to have a time component so that you can determine how long a command
took to run or how long a command was running before a failure occurred. Oracle Support will almost always ask you
to set this variable to include the time component before capturing output and sending it to them.
The only downside to setting the NLS_DATE_FORMAT is that if you set it to a value unknown to RMAN, connectivity
issues can occur. For example, here the NLS_DATE_FORMAT is set to an invalid value:
$ export NLS_DATE_FORMAT='dd-mon-yyyy hh24:mi:sd'
$ rman target /
When set to an invalid value, you get this error when logging in to RMAN:
RMAN-03999: Oracle error occurred while converting a date: ORA-01821:
To unset the NLS_DATE_FORMAT variable, set it to a blank value, like so:
$ export NLS_DATE_FORMAT=''
Setting ECHO Setting ECHO
Another value that I always set in any RMAN scripts is the ECHO command, seen here:
RMAN> set echo on;
This instructs RMAN to display the command that it's running in the output, so you can see what RMAN
command is running. along with any relevant error or output messages associated with the command. This is
especially important when you're running RMAN commands within scripts, because you're not directly typing in a
command (and may not know what command was issued within the shell script). For example, without SET ECHO ON ,
here is what is displayed in the output for a command:
Starting backup at...
 
Search WWH ::




Custom Search