Saturday 24 September 2016

Setting the date format in RMAN 12c

The common problem is that rman shows times in default format which is not helpful when we need to know how much time the backup takes.

RMAN> backup incremental level 0 database;
Starting backup at 24-SEP-16


The typical way of fixing it is to set the NLS_DATE_FORMAT='YY/MM/DD HH24:MI'

However it doesn't work in RMAN, even version 12c:

RMAN> SQL 'ALTER SESSION SET NLS_DATE_FORMAT="DD.MM.YYYY HH24:MI:SS"';
sql statement: ALTER SESSION SET NLS_DATE_FORMAT="DD.MM.YYYY HH24:MI:SS"
RMAN> backup incremental level 0 database;
Starting backup at 24-SEP-16


The workaround is:

1. Set the NLS_DATE_FORMAT variable for the os shell

export NLS_DATE_FORMAT='YY/MM/DD HH24:MI'
rman target / 
RMAN>
Starting backup at 16/09/24 16:39



2. Or in the scripts, use host command to produce the timestamp

RMAN> run {
2> host 'date';
3> backup incremental level 0 database;
4> host 'date';
5> }
Sat Sep 24 16:09:57 BST 2016
host command complete
Starting backup at 24-SEP-16

No comments:

Post a Comment