RMAN log file with date and name in Oracle 11gR2 in Linux
-
18-02-2021 - |
سؤال
I have a script and I want to create my log file with datetime and with unique name. It's my script:
.......
.......
rman target/ LOG='/u01/backup/logs/rman.log' <<EOF
.......
.......
.......
EOF
How can I do it? Thank you.
المحلول
If I were doing this in the bash shell on Linux, I'd use the date command:
$ date '+%y%m%d-%H%M%S'
20191115-111213
$ LOG_PATH="/u01/backup/logs"
$ UNIQUE="NAME"
$ rman target / LOG="${LOG_PATH}/rman.${UNIQUE}.$(date '+%y%m%d-%H%M%S').log" <<EOF
. . .
EOF
$ ls ${LOG_PATH}
rman.NAME.20191115-111314.log
Remember that you'll need to clean up all these log files, from time to time.
لا تنتمي إلى dba.stackexchange