0

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.

3

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.

  • Thank you so much. – neworacler Nov 15 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.