Harry Asked: 2019-11-12 03:43:30 +0800 CST2019-11-12 03:43:30 +0800 CST 2019-11-12 03:43:30 +0800 CST RMAN - 如何在备份标签中添加日期 772 我知道 RMAN 的默认设置是以以下格式添加日期:TAGYYYYMMDDTHHMMSS,但如果我想要这样的:BKP_FULL_11112019。我该怎么做?我尝试使用%T但它不起作用。 我想做这样的事情: backup as compressed backupset incremental level 0 database tag = 'BKP_FULL_current_date_here' 其中 current_date_here 必须是当前日期。 oracle rman 1 个回答 Voted Best Answer Balazs Papp 2019-11-12T10:56:48+08:002019-11-12T10:56:48+08:00 在脚本中构造标签并将其作为替换变量传递。在 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.
在脚本中构造标签并将其作为替换变量传递。在 Linux 上使用 bash 的示例:
如您所见,标签设置为
tag=BKP_FULL_20191111195400
.