#!/bin/bash | |
[[ $UID = "54321" ]] && rman target /<<EOF | |
shutdown immediate; | |
startup mount; | |
backup as compressed backupset database format '$ORACLE_BASE/scripts/setup/%U'; | |
backup current controlfile format '$ORACLE_BASE/scripts/setup/control.bks'; | |
backup spfile format '$ORACLE_BASE/scripts/setup/spfile.bks'; | |
alter database open; | |
exit; | |
EOF | |
[[ $UID = "0" ]] && su -p oracle -c "rman target /<<EOF | |
shutdown immediate; | |
startup mount; | |
backup as compressed backupset database format '$ORACLE_BASE/scripts/setup/%U'; | |
backup current controlfile format '$ORACLE_BASE/scripts/setup/control.bks'; | |
backup spfile format '$ORACLE_BASE/scripts/setup/spfile.bks'; | |
alter database open; | |
exit; | |
EOF" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment