RMANのデフォルトでは、日付を次の形式で追加することがわかっています。TAGYYYYMMDDTHHMMSS
、ただし、_BKP_FULL_11112019
_のようなものが必要な場合。これどうやって? _%T
_を使用してみましたが、機能しません。
私はこのようなことをしたいです:
_backup as compressed backupset incremental level 0 database tag = 'BKP_FULL_current_date_here'
_
現在の日付である必要があるcurrent_date_here。
スクリプトでタグを作成し、置換変数として渡します。 Linuxでのbashの例:
$ cat BKP_FULL.rcv
run
{
backup as compressed backupset incremental level 0 database tag '&1';
}
$ export MYTAG='BKP_FULL_'$(date +%Y%m%d%H%M%S)
$ echo $MYTAG
BKP_FULL_20191111195400
$ rman target / cmdfile=BKP_FULL.rcv using $MYTAG
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Nov 11 19:54:14 2019
Version 19.5.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: MIN19 (DBID=2133113873, not open)
RMAN> run
2> {
3> backup as compressed backupset incremental level 0 database tag 'BKP_FULL_20191111195400';
4> }
5>
Starting backup at 11-NOV-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=169 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/MIN19_O71/system01.dbf
input datafile file number=00002 name=/oradata/MIN19_O71/sysaux01.dbf
input datafile file number=00003 name=/oradata/MIN19_O71/undotbs01.dbf
input datafile file number=00004 name=/oradata/MIN19_O71/users01.dbf
channel ORA_DISK_1: starting piece 1 at 11-NOV-19
channel ORA_DISK_1: finished piece 1 at 11-NOV-19
piece handle=/u01/app/Oracle/product/19.0.0/dbhome_1/dbs/03ugkif9_1_1 tag=BKP_FULL_20191111195400 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 11-NOV-19
Starting Control File and SPFILE Autobackup at 11-NOV-19
piece handle=/u01/app/Oracle/product/19.0.0/dbhome_1/dbs/c-2133113873-20191111-01 comment=NONE
Finished Control File and SPFILE Autobackup at 11-NOV-19
Recovery Manager complete.
$
ご覧のとおり、タグはtag=BKP_FULL_20191111195400
。