我知道 RMAN 的默认设置是以以下格式添加日期:TAGYYYYMMDDTHHMMSS
, 但如果我想要这样的东西:BKP_FULL_11112019
。我怎么做?我尝试使用%T
但它不起作用。
我想做这样的事情:
backup as compressed backupset incremental level 0 database tag = 'BKP_FULL_current_date_here'
Run Code Online (Sandbox Code Playgroud)
其中 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.
$
Run Code Online (Sandbox Code Playgroud)
如您所见,标签设置为tag=BKP_FULL_20191111195400
.
归档时间: |
|
查看次数: |
1860 次 |
最近记录: |