SHELL-收集Oracle已应用的PSU信息

it2022-05-06  0

 

1. 命令收集版本信息

# 创建数据收集脚本文件 OPER_FILE=${EXECUTE_ID}_oper.sh if [[ "${OPER_USER}" = "${USER}" ]]; then echo "${PATCH_HOME}/opatch lsinventory > ${MODULE_OUT_DIR}/${OPER_USER}.info" > ${OPER_FILE} else echo "su - ${OPER_USER} -c \"${PATCH_HOME}/opatch lsinventory\" > ${MODULE_OUT_DIR}/${OPER_USER}.info" >> ${OPER_FILE} fish -x ${OPER_FILE} &

 

2. 格式化输出

grep -E $'Patch +[0-9]+.*\nUnique Patch.*\nPatch description.*\nCreated on.*' ${MODULE_OUT_DIR}/${OPER_USER}.info | tr '\n' ' ' | sed -r 's/(Patch +[0-9]+ +:)/\n\1/g' | sed -r 's/Patch +([0-9]+) +: +applied +on +(.*) +Unique.*"(.*)" +Created +on +(.*)hrs +PST8PDT/\1##\4##\2##\3/g'

 

转载于:https://www.cnblogs.com/wandering-mind/p/10793021.html


最新回复(0)