Je sais que la valeur par défaut du RMAN est d'ajouter la date au format suivant: TAGYYYYMMDDTHHMMSS
, mais si je voulais quelque chose comme ça: BKP_FULL_11112019
. Comment je fais ça? J'ai essayé d'utiliser %T
mais ça ne marche pas.
Je veux faire quelque chose comme ça:
backup as compressed backupset incremental level 0 database tag = 'BKP_FULL_current_date_here'
Quelle current_date_here doit être la date du jour.
Construisez la balise dans votre script et passez-la comme variable de substitution. Exemple sous Linux avec 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.
$
Comme vous pouvez le voir, la balise a été définie comme tag=BKP_FULL_20191111195400
.