Using tags in RMAN

backupsetTag smallUsually, there are multiple different backupsets in the Fast Recovery Area: full backups, incremental backups, archivelog backups made on different dates and times. Their names are not meaningful. You can always look at creation dates which often is good enough but "often" is not "always".

Fortunately, backupsets can be tagged. And tags are subject of this article.



A tag is a symbolic name. It can be used to reference a backupset, an image copy or a control file copy. A tag is powerful in this context because it may be meaningful for a human unlike a default backupset name.

If you do not specify your own tag, RMAN assigns a default tag automatically to all backupsets created. The default tag has a format TAGYYYYMMDDTHHMMSS, where YYYYMMDD is a date and HHMMSS is a time of when taking the backup was started. The instance timezone is used. Example: TAG20130928T204917 - the backupset was started to be taken on 2013-09-28 at 20:49:17.

RMAN> list backupset;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 20 Incr 0 215.97M DISK 00:01:10 2013-09-28:20:50:27 BP Key: 20 Status: AVAILABLE Compressed: YES Tag: TAG20130928T204917 Piece Name: +DATA/CDBRAC/E1933EA7D8F75A31E043C8C9A8C08F26/BACKUPSET/2013_09_28/nnndn0_tag20130928t204917_0.295.827354959


TAG for BACKUP command

The default tag is not always meaningful enough so a different one can be used. For example, a backup taken before a major change in the database - BEFORE_CLEANUP. And after the change - AFTER_CLEANUP. To assign a customized tag taking a backup use TAG keyword:

for a backupset:

backup database tag BEFORE_CLEANUP;

for a control file backup:

backup current controlfile tag BEFORE_CLEANUP;

for an archivelogs backup:

backup archivelog all tag BEFORE_CLEANUP;

Tags can duplicate. It is possible to create multiple backupset with the same tag. Maximum allowed length of a tag is 30 bytes.


TAG for RESTORE command

To restore a specific backupset, you can define it by a tag:

restore database from TAG='BEFORE_CLEANUP';

an archivelog backup:

restore archivelog all from TAG='BEFORE_CLEANUP';

If there are more than one backupset with the tag, the latest one will be used for a restore.



Tags are very useful. You can customize all backupsets’ tags. It may make sense even for backups created on regular basis. But from the other hand, you may want to keep uniqueness of tags for simplicity. So instead of using WEEKLY_BACKUP tag for all weekly backups, you may want to keep the default ones based on a date and a time.

Anyway, if I create a manual backupset, I always use a customized tag.

Do not miss valuable content. You will receive a monthly summary email. You can unsubscribe anytime.

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.