Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions scripts/collector/oracle/collect-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -388,26 +388,25 @@ function print_usage() {
echo " IF STATSPACK HAS BEEN ACTIVATED SPECIFICALLY FOR DMA COLLECTION, ENSURE THERE ARE AT LEAST 8"
echo " CALENDAR DAYS OF COLLECTION BEFORE RUNNING THE DMA COLLECTOR."

# RESERVED FOR FUTURE USE
# echo " Oracle Estate Explorer collection"
# echo " --collectOee Optional. Y or N flag to run the Oracle Estate Explorer data collection in addition to the DMA collector. Default is Y."
# echo " NOTE: This requires SQL client version 21 and above, plus Oracle database 11.2 or above."
# echo " OEE collection will not run if requirements are not met."
# echo
# echo " --oeeGroup Required if --collect_oee is Y. This is the group name (ex: Dev, Prod, QA, etc) to use for bundling multiple databases togegther within OEE."
# echo " Maximum length of 32 characters."
# echo " --oee_runId Internal use only. This is used by DMA automation to handle parallel runs of multiple collections."
# echo
# echo " Optional identifier"
# echo " --manualUniqueId Optional. Allows the end user to create a unique identifier with which to tag the collection. "
echo " Oracle Estate Explorer collection"
echo " --collectOee Optional. Y or N flag to run the Oracle Estate Explorer data collection in addition to the DMA collector. Default is Y."
echo " NOTE: This requires SQL client version 21 and above, plus Oracle database 11.2 or above."
echo " OEE collection will not run if requirements are not met."
echo
echo " --oeeGroup Required if --collect_oee is Y. This is the group name (ex: Dev, Prod, QA, etc) to use for bundling multiple databases togegther within OEE."
echo " Maximum length of 32 characters."
echo " --oeeRunId Internal use only. This is used by DMA automation to handle parallel runs of multiple collections."
echo
echo " Optional identifier"
echo " --manualUniqueId Optional. Allows the end user to create a unique identifier with which to tag the collection. "
echo " Also used internally by DMA automation."
echo
echo " Example:"
echo
echo
echo " ./collect-data.sh --connection_string {user}/{password}@//{db host}:{listener port}/{service name} --stats_source AWR"
echo " ./collect-data.sh --connectionStr {user}/{password}@//{db host}:{listener port}/{service name} --statsSrc AWR"
echo " or"
echo " ./collect-data.sh --collection_user_name {user} --collection_user_pass {password} --host_name {db host} --port {listener port} --database_service {service name} --stats_source AWR"
echo " ./collect-data.sh --collectionUserName {user} --collectionUserPass {password} --hostName {db host} --port {listener port} --databaseService {service name} --statsSrc AWR"

}
### Validate input
Expand All @@ -430,9 +429,9 @@ function parse_parameters() {
elif [[ "$1" == "--connectionStr" ]]; then connection_string="${2}"
elif [[ "$1" == "--statsWindow" ]]; then stats_window="${2}"
elif [[ "$1" == "--manualUniqueId" ]]; then manual_unique_id="${2}"
# elif [[ "$1" == "--collectOEE" ]]; then collect_oee="${2}"
# elif [[ "$1" == "--oeeGroup" ]]; then oee_group_name="${2}"
# elif [[ "$1" == "--oee_runId" ]]; then oee_run_id="${2}"
elif [[ "$1" == "--collectOEE" ]]; then collect_oee="${2}"
elif [[ "$1" == "--oeeGroup" ]]; then oee_group_name="${2}"
elif [[ "$1" == "--oeeRunId" ]]; then oee_run_id="${2}"
elif [[ "$1" == "--dmaAutomation" ]]; then dma_automation_flag="${2}" # Internal use only
else
echo "Unknown parameter ${1}"
Expand Down Expand Up @@ -479,7 +478,7 @@ function parse_parameters() {

if [[ "${collect_oee}" == "Y" ]] ; then
if [[ "${oee_group_name}" == "" ]] ; then
echo "ERROR: Parameter --oee_group_name must be specified if --collect_oee is Y."
echo "ERROR: Parameter --oeeGroup must be specified if --collectOEE is Y."
print_usage
exit
fi
Expand Down Expand Up @@ -550,7 +549,7 @@ function main() {

if [[ $retval -eq 0 ]];then
if [[ "$(echo ${sqlcmd_result} | ${grep_cmd} -E '(ORA-|SP2-)')" != "" ]];then
print_failure
print_fail
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Database version check returned error ${sqlcmd_result}"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand All @@ -573,7 +572,7 @@ function main() {
if [[ $retval -ne 0 ]];then
create_error_log $(echo ${v_tag} | ${sed_cmd} 's/.csv//g')
compress_dma_files $(echo ${v_tag} | ${sed_cmd} 's/.csv//g')
print_failure
print_fail
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Database Migration Assessment extract reported an error. Please check the error log in directory ${log_dir}"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand All @@ -584,7 +583,7 @@ function main() {
cleanup_dma_output $(echo ${v_tag} | ${sed_cmd} 's/.csv//g')
retval=$?
if [[ $retval -ne 0 ]];then
print_failure
print_fail
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Database Migration Assessment data sanitation reported an error. Please check the error log in directory ${output_dir}"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand Down Expand Up @@ -622,7 +621,7 @@ function main() {
compress_dma_files $(echo ${v_tag} | ${sed_cmd} 's/.csv//g') $database_type
retval=$?
if [[ $retval -ne 0 ]];then
print_failure
print_fail
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Database Migration Assessment data file archive encountered a problem. Exiting...."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Expand All @@ -641,7 +640,7 @@ function main() {
print_warning
;;
FAILURE )
print_failure
print_fail
;;
* )
print_complete
Expand Down
66 changes: 30 additions & 36 deletions scripts/collector/oracle/dma_batch_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,19 @@ function batchRun() {
dmaid="N/A"
fi

# RESERVED FOR FUTURE USE
oee_flag="N"
# if [[ "${oee_flag}" = "" ]] ; then
# oee_flag="N"
# else
# oee_flag=$(echo "${oee_flag}" | tr '[a-z]' '[A-Z]')
# fi
#
# if [[ "${oee_group}" = "" ]] ; then
# oee_group="DEFAULT"
# fi
#
if [[ "${oee_flag}" = "" ]] ; then
oee_flag="N"
else
oee_flag=$(echo "${oee_flag}" | tr '[a-z]' '[A-Z]')
fi

if [[ "${oee_group}" = "" ]] ; then
oee_group="DEFAULT"
fi

# Run a collection in the background, capturing screen output to a log file.
./collect-data.sh --connectionStr ''"${user}${db}"'' --statsSrc "${statssrc}" ${statsparam} --manualUniqueId "${dmaid}" --dmaAutomation Y 2>&1 | tee "DMA_COLLECT_DATA_${batchlogname}_$(date +%Y%m%d%H%M%S)_${this_pid}.log" &
# RESERVED FOR FUTURE USE
# ./collect-data.sh --connectionStr ''"${user}${db}"'' --statsSrc "${statssrc}" ${statsparam} --manualUniqueId "${dmaid}" --collectOEE "${oee_flag}" --oeeGroup "${oee_group}" --oee_runId "${run_id}" --dmaAutomation Y 2>&1 | tee "DMA_COLLECT_DATA_${batchlogname}_$(date +%Y%m%d%H%M%S)_${this_pid}.log" &
./collect-data.sh --connectionStr ''"${user}${db}"'' --statsSrc "${statssrc}" ${statsparam} --manualUniqueId "${dmaid}" --collectOEE "${oee_flag}" --oeeGroup "${oee_group}" --oeeRunId "${run_id}" --dmaAutomation Y 2>&1 | tee "DMA_COLLECT_DATA_${batchlogname}_$(date +%Y%m%d%H%M%S)_${this_pid}.log" &

# Wait a couple of seconds before starting another collection.
sleep 2
Expand All @@ -124,9 +121,7 @@ function batchRun() {
echo
err_cnt=$(ls -1 ${output_dir}/*ERROR.zip 2>/dev/null | wc -l)

# RESERVED FOR FUTURE USE
oee_err_cnt=0
# oee_err_cnt=$(grep -n "Skipping Estate Explorer collection" DMA_COLLECT_DATA_*_${this_pid}.log | wc -l )
oee_err_cnt=$(grep -n "Skipping Estate Explorer collection" DMA_COLLECT_DATA_*_${this_pid}.log | wc -l )

if [[ ${err_cnt} -eq 0 ]] && [[ ${oee_err_cnt} -eq 0 ]] ; then
return 0
Expand Down Expand Up @@ -202,25 +197,24 @@ function main() {

if [[ ${retval} -eq 0 ]] ; then
print_complete
# RESERVED FOR FUTURE USE
# oee_file_count=$(wc -l < <(ls -1 "${oee_dir}" | ${grep_cmd} "driverfile.${run_id}"))
# if [[ -d ${oee_dir} ]] && [[ ${oee_file_count} -gt 0 ]]; then
# echo "Running Oracle Estate Explorer for ${oee_file_count} groups."
# cd "${oee_dir}"
# oee_run "${run_id}" 2>&1 | tee "OEE_${dma_log_name}"
# echo "Checking log file OEE_${dma_log_name} for OEE failures}"
#
# for oee_fail_number in $(${grep_cmd} "Database extract failures" "OEE_${dma_log_name}" | cut -d ':' -f 2 | tr -d ' '); do
# oee_fail_count=$(( ${oee_fail_count} + ${oee_fail_number} ))
# done
# if [[ ${oee_fail_count} -ne 0 ]] ; then
# print_fail
# else
# print_complete
# fi
# else
# print_complete
# fi
oee_file_count=$(wc -l < <(ls -1 "${oee_dir}" | ${grep_cmd} "driverfile.${run_id}"))
if [[ -d ${oee_dir} ]] && [[ ${oee_file_count} -gt 0 ]]; then
echo "Running Oracle Estate Explorer for ${oee_file_count} groups."
cd "${oee_dir}"
oee_run "${run_id}" 2>&1 | tee "OEE_${dma_log_name}"
echo "Checking log file OEE_${dma_log_name} for OEE failures}"

for oee_fail_number in $(${grep_cmd} "Database extract failures" "OEE_${dma_log_name}" | cut -d ':' -f 2 | tr -d ' '); do
oee_fail_count=$(( ${oee_fail_count} + ${oee_fail_number} ))
done
if [[ ${oee_fail_count} -ne 0 ]] ; then
print_fail
else
print_complete
fi
else
print_complete
fi
else
print_separator
echo "One or more collections encountered errors. Please review the logs, remediate the errors and rerun the failed collection(s)."
Expand Down
37 changes: 18 additions & 19 deletions scripts/collector/oracle/dma_precheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,22 @@ function precheckConfigFileFormat() {
failcount=$(( $failcount + 1 ))
fi

# RESERVED FOR FUTURE USE
# # Check parameters for OEE if given
# if [[ "${oee_flag}" != "" ]] ; then
# if [[ "${oee_flag}" != "Y" ]] && [[ "${oee_flag}" != "N" ]] ; then
# echo "FAILED : Invalid entry ${oee_flag} for OEE Flag on line ${lineno}. Must be one of (Y, N)."
# failcount=$(( $failcount + 1 ))
# fi
#
# if [[ "${oee_flag}" == "Y" ]] ; then
# oee_entries=1
# fi
#
# if [[ "${oee_flag}" = "Y" ]] && [[ ! -f ${oee_dir}/oee_group_extract-SA.sh ]] ; then
# echo "FAILED : OEE collection is specified on line ${lineno} but the OEE collection files are not installed in ${oee_dir}. Either install OEE to the specified location or set this flag to N in the configuration file."
# failcount=$(( $failcount + 1 ))
# fi
# fi
# Check parameters for OEE if given
if [[ "${oee_flag}" != "" ]] ; then
if [[ "${oee_flag}" != "Y" ]] && [[ "${oee_flag}" != "N" ]] ; then
echo "FAILED : Invalid entry ${oee_flag} for OEE Flag on line ${lineno}. Must be one of (Y, N)."
failcount=$(( $failcount + 1 ))
fi

if [[ "${oee_flag}" == "Y" ]] ; then
oee_entries=1
fi

if [[ "${oee_flag}" = "Y" ]] && [[ ! -f ${oee_dir}/oee_group_extract-SA.sh ]] ; then
echo "FAILED : OEE collection is specified on line ${lineno} but the OEE collection files are not installed in ${oee_dir}. Either install OEE to the specified location or set this flag to N in the configuration file."
failcount=$(( $failcount + 1 ))
fi
fi

fi
done < <( tr -d ' ' < "${configuration_file}" | tr -d "${tab_char}" | ${grep_cmd} -v '^#' | ${grep_cmd} -v '^$' )
Expand Down Expand Up @@ -419,6 +418,7 @@ function precheckStats() {
fi
fi
fi
# done < <( ${sed_cmd} "s/ //g;s/${tab_char}//g" "$configuration_file" )
done < <( tr -d ' ' < "${configuration_file}" | tr -d "${tab_char}" | ${grep_cmd} -v '^#' | ${grep_cmd} -v '^$' )

retcd=${#successes[@]}
Expand Down Expand Up @@ -617,8 +617,7 @@ function runAllChecks() {
if [[ $retval -eq 0 ]]; then precheckUser; retval=$?; fi
if [[ $retval -eq 0 ]]; then precheckStats; retval=$?; fi
fi
# RESERVED FOR FUTURE USE
# if [[ $retval -eq 0 ]] && [[ $oee_entries -eq 1 ]] ; then precheck_oee_platform; retval=$?; fi
if [[ $retval -eq 0 ]] && [[ $oee_entries -eq 1 ]] ; then precheck_oee_platform; retval=$?; fi

print_separator

Expand Down