From a34d3fb8eb607ae5d25d657f01c6299e33e2188d Mon Sep 17 00:00:00 2001 From: wpuziewicz <35240389+wpuziewicz@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:32:24 -0500 Subject: [PATCH] Handle embedded pipe characters in data. (#190) --- .../dbSQLCollector/extracts/dataguard.sql | 17 ++++++++++++++--- .../dbSQLCollector/extracts/dbparameters.sql | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/db_assessment/dbSQLCollector/extracts/dataguard.sql b/db_assessment/dbSQLCollector/extracts/dataguard.sql index 446f865b..7438d033 100644 --- a/db_assessment/dbSQLCollector/extracts/dataguard.sql +++ b/db_assessment/dbSQLCollector/extracts/dataguard.sql @@ -6,9 +6,20 @@ SELECT '&&v_host' || '&&v_dbname' || '_' || '&&v_hora' AS pkey, - &v_a_con_id as con_id, inst_id, dest_id, dest_name, destination, status, target, schedule, register, - alternate, transmit_mode, affirm, valid_role, verify, - CASE WHEN target = 'STANDBY' OR target = 'REMOTE' THEN (SELECT DECODE(listagg(value, ';') WITHIN GROUP (ORDER BY value), NULL, 'LOG_ARCHIVE_CONFIG_NOT_CONFIGURED', listagg(value, ';') WITHIN GROUP (ORDER BY value)) FROM gv$parameter WHERE UPPER(name) = 'LOG_ARCHIVE_CONFIG') ELSE 'LOCAL_DESTINATION_CONFIG_NOT_APPLICABLE' END log_archive_config + &v_a_con_id as con_id, inst_id, + dest_id, + dest_name, + REPLACE(destination ,'|', ' ')destination, + status, + REPLACE(target ,'|', ' ')target, + schedule, + register, + REPLACE(alternate ,'|', ' ')alternate, + transmit_mode, + affirm, + REPLACE(valid_role ,'|', ' ') valid_role, + verify, + REPLACE(SUBSTR(CASE WHEN target = 'STANDBY' OR target = 'REMOTE' THEN (SELECT DECODE(listagg(value, ';') WITHIN GROUP (ORDER BY value), NULL, 'LOG_ARCHIVE_CONFIG_NOT_CONFIGURED', listagg(value, ';') WITHIN GROUP (ORDER BY value)) FROM gv$parameter WHERE UPPER(name) = 'LOG_ARCHIVE_CONFIG') ELSE 'LOCAL_DESTINATION_CONFIG_NOT_APPLICABLE' END, 1, 100), '|', ' ') log_archive_config FROM gv$archive_dest a WHERE destination IS NOT NULL) SELECT pkey , con_id , inst_id , log_archive_config , dest_id , dest_name , destination , status , diff --git a/db_assessment/dbSQLCollector/extracts/dbparameters.sql b/db_assessment/dbSQLCollector/extracts/dbparameters.sql index dbfdade7..957cd5fa 100644 --- a/db_assessment/dbSQLCollector/extracts/dbparameters.sql +++ b/db_assessment/dbSQLCollector/extracts/dbparameters.sql @@ -8,9 +8,9 @@ SELECT '&&v_host' || '&&v_hora' AS pkey, inst_id, &v_a_con_id AS con_id, - REPLACE(name, ',', '/') name, - TRANSLATE(REPLACE(SUBSTR(value, 1, 60), ',', '/'), chr(10)||chr(13) , ' ') value, - TRANSLATE(REPLACE(SUBSTR(&v_dbparam_dflt_col, 1, 30), ',', '/'), chr(10)||chr(13), ' ') default_value, + replace(name, chr(39), chr(34)) name, + TRANSLATE(SUBSTR(value, 1, 60), chr(124)||chr(10)||chr(13)||chr(39), ' ') value, + TRANSLATE(SUBSTR(&v_dbparam_dflt_col, 1, 30), chr(124)||chr(10)||chr(13)||chr(39), ' ') default_value, isdefault FROM gv$parameter a ORDER BY 2,3 )