RMAN format element %t in backup piece name

From time to time I receive log files from one Oracle customer that is using Windows robocopy tool for backing up RMAN backup set files to their backup server. Robocopy report constains lines such as:

...
New File  186.0 m    \\oraprod1\BACKUP$\RMAN01\PROD_647989204_520_1.BAK
New File      3.0 g     \\oraprod1\BACKUP$\RMAN01\PROD_651902404_608_1.BAK
...

Since I don’t see file timestamps in the report, the only timestamp that is available to me is the one that is the result of RMAN format parameter %t in the backup piece name, such as 647989204 or 651902404 from example above. What is the meaning of %t? According to Oracle documentation the parameter %t means:

Quote:
%t Specifies the backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of %s and %t can be used to form a unique name for the backup set.

They’re not mentioning what is actually a “fixed reference time” (known as an epoch), but it’s not hard to figure this out with a little help from python time module. Someone at Oracle has chosen an epoch that starts with 17.08.1987 00:00:00 (dd.mm.yyyy hh24:mi:ss) and here is my handy python script that takes integer (such as 651902404 from an example above) and print out human readable time stamp:

# 
# rman_t.py - Converting RMAN %t timestamp to human readable timestamp
# Example:
# cmd> python rman_t.py 651902404
#cmd>  Timestamp [RMAN %t] = Sun Apr 13 04:00:04 2008
#
import sys
import time
epoch = 556149600             # ctime(556149600) represents 17.8.1987 00:00:00
print "Timestamp [RMAN %t] = " + time.ctime(epoch + int(sys.argv[1]))
# End rman_t.py

Posted on 17.04.2008, in Oracle and tagged . Bookmark the permalink. Comments Off on RMAN format element %t in backup piece name.

Comments are closed.