Skip to content
Home » Oracle » How RMAN Set NLS_DATE_FORMAT

How RMAN Set NLS_DATE_FORMAT

NLS_DATE_FORMAT for RMAN

After you set RMAN log location, the next problem that you want to solve is the format of timestamp in the log, which was too coarse to judge the actual time like this:

08-OCT-12

In this post, we introduce 2 ways to set correct datetime in RMAN.

  1. OS Level
  2. Session Level

OS Level

If you are using sqlplus, you can use ALTER SESSION SET NLS_DATE_FORMAT to modify the date format, but in RMAN, there's no such command to run. As a matter of fact, NLS_DATE_FORMAT can also be an environment variable on OS-level for RMAN to use.

Linux or Unix

$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
$ rman target /
...

Windows

> set NLS_DATE_FORMAT=yyyy-mm-dd hh24:mi:ss
> rman target /
...

Please notice that, you cannot use any quotes to set the environment variable in Windows platform, otherwise, you will see errors in RMAN.

Session Level

From 12c, it's somewhat improved, we can run SQL statement ALTER SESSION to set the date time format during the session in RMAN. For example:

RMAN> alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';

Statement processed

Another environment variable that you may need to set is NLS_LANG in order to notify database to set correct NLS conventions.

To know more ways to use NLS_DATE_FORMAT, you may follow the link to know it.

Leave a Reply

Your email address will not be published. Required fields are marked *