Skip to content

Instantly share code, notes, and snippets.

@ChrisLGardner
Last active January 23, 2019 15:41
Show Gist options
  • Save ChrisLGardner/62f67f15aa25ad24e111642e04e2430b to your computer and use it in GitHub Desktop.
Save ChrisLGardner/62f67f15aa25ad24e111642e04e2430b to your computer and use it in GitHub Desktop.
################
### Rollback ###
################
# Use with : './apply_oracle_secpatch.bat -rollback'
Function rollback
{
Param
(
[Parameter()]
[switch]$rollback
)
if ($rollback) {
# Revert '$ORACLE_SECURITY_PATCH_NUMBER' patch
"$ORACLE_HOME/OPatch -rollback -id $ORACLE_SECURITY_PATCH_NUMBER"
# Put back the saved 'old' OPatch version folder
copy-item -Force -Recurse -path $ORACLE_HOME/OPatch_BACKUP-$DATE $ORACLE_HOME/OPatch
Write-Output ">>> Rollback of OPatch tool and Oracle patch successfully completed. <<<"
Exit 1
}
else {
Write-Output "The only parameter you can set is '-rollback', no parameter needed for normal execution."
Exit 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment