diff --git a/fetch/feature b/fetch/feature index ad696e0..4ef3925 100755 --- a/fetch/feature +++ b/fetch/feature @@ -44,8 +44,8 @@ export ORACLE_SID=$SID export ORACLE_HOME=$HOME export PATH=$HOME/bin:$PATH -if [ $DBV == "11" ] || [ $DBV == "12" ]; then - sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/feature.sql -else +if [ $DBV == "9" ] || [ $DBV == "10" ]; then sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/feature-10.sql +else + sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/feature.sql fi diff --git a/fetch/license b/fetch/license index 3fccc78..0b27aa4 100755 --- a/fetch/license +++ b/fetch/license @@ -107,7 +107,7 @@ else fi -if [ $DBV == "10" ]; then +if [ $DBV == "10" ] || [ $DBV == "9" ]; then sqlplus -S "/ AS SYSDBA" @${ERCOLE_HOME}/sql/license-10.sql $LICENSING_CPU_CORES $FACTOR else sqlplus -S "/ AS SYSDBA" @${ERCOLE_HOME}/sql/license.sql $LICENSING_CPU_CORES $FACTOR $DB_ONE diff --git a/fetch/patch b/fetch/patch index b46c939..91eed8e 100755 --- a/fetch/patch +++ b/fetch/patch @@ -45,8 +45,8 @@ export ORACLE_SID=$SID export ORACLE_HOME=$HOME export PATH=$HOME/bin:$PATH -if [ $DBV == "12" ]; then +if [ $DBV -gt "11" ]; then sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/patch-12.sql else sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/patch.sql -fi +fi \ No newline at end of file diff --git a/fetch/psu b/fetch/psu index 048dbac..2701ed8 100755 --- a/fetch/psu +++ b/fetch/psu @@ -42,7 +42,7 @@ export PATH=$HOME/bin:$PATH ERCOLE_HOME=$(dirname "$0") ERCOLE_HOME="$(dirname "$ERCOLE_HOME")" -if [ $DBV == "10" ] || [ $DBV == "11" ]; then +if [ $DBV -lt "12" ]; then sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/psu-1.sql else sqlplus -S "/ AS SYSDBA" < ${ERCOLE_HOME}/sql/psu-2.sql diff --git a/main.go b/main.go index 2c7edb0..79cd8a5 100644 --- a/main.go +++ b/main.go @@ -79,14 +79,7 @@ func buildData(configuration config.Configuration) { out = fetcher(configuration, "dbversion", db.DBName, db.OracleHome) outVersion := string(out) - dbVersion := "12" - if strings.HasPrefix(outVersion, "11") { - dbVersion = "11" - } else if strings.HasPrefix(outVersion, "10") { - dbVersion = "10" - } else if strings.HasPrefix(outVersion, "9") { - dbVersion = "9" - } + dbVersion := strings.Split(outVersion, ".")[0] if configuration.Forcestats { fetcher(configuration, "stats", db.DBName, db.OracleHome) diff --git a/sql/dbmounted.sql b/sql/dbmounted.sql index 2dd951d..8263027 100644 --- a/sql/dbmounted.sql +++ b/sql/dbmounted.sql @@ -31,20 +31,20 @@ select (select value from v$nls_parameters where parameter='NLS_NCHAR_CHARACTERSET') as NCharset, (select value from v$parameter where name='db_block_size') as Blocksize, (select value from v$parameter where name='cpu_count') as Cpu_count, -(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS='',.'''),',') from v$parameter where name='sga_target') as Sga_Target, -(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS='',.'''),',') from v$parameter where name='pga_aggregate_target') as Pga_Target, -(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS='',.'''),',') from v$parameter where name='memory_target') as Pga_Target, -(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS='',.'''),',') from v$parameter where name='sga_max_size') as sga_max_size, +(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS=''.,'''),',') from v$parameter where name='sga_target') as Sga_Target, +(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS=''.,'''),',') from v$parameter where name='pga_aggregate_target') as Pga_Target, +(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS=''.,'''),',') from v$parameter where name='memory_target') as Pga_Target, +(select rtrim(to_char(value/1024/1024/1024, 'FM9G999G999D999', 'NLS_NUMERIC_CHARACTERS=''.,'''),',') from v$parameter where name='sga_max_size') as sga_max_size, --(select round(sum(bytes/1024/1024/1024)) from dba_segments), -'N/A', +'0', --((select round(sum(bytes/1024/1024/1024)) from v$datafile)+(select round(sum(bytes/1024/1024/1024)) from v$tempfile)+(select round(sum(bytes/1024/1024/1024)) from v$log)), -'N/A', +'0', --((select round(sum(decode(autoextensible,'NO',bytes/1024/1024/1024,'YES',maxbytes/1024/1024/1024))) from v$datafile)+(select round(sum(bytes/1024/1024/1024)) from v$tempfile)+(select round(sum(bytes/1024/1024/1024)) from v$log)), -'N/A', +'0', --(SELECT replace(replace(output,'Elapsed:',''),chr(32), '') FROM TABLE (DBMS_WORKLOAD_REPOSITORY.awr_report_text (:dbid, :inst_num, :bid, :eid, 0)) where rownum <20 and output like '%Elapsed: %'), --(SELECT replace(replace(output,'DB Time:',''),chr(32), '') FROM TABLE (DBMS_WORKLOAD_REPOSITORY.awr_report_text (:dbid, :inst_num, :bid, :eid, 0)) where rownum <20 and output like '%DB Time: %'), --:elapsed,:dbtime,(select :result from dual), -'N/A','N/A','N/A', +'0','0','0', (select case when (select count(*) from v$datafile where name like '+%') > 0 then 'Y' else 'N' end as "ASM" from dual ), case when ( select count(*) from V$DATAGUARD_CONFIG) > 1 then 'Y' else 'N' end as "Dataguard" from dual;