therealkevinc / SLOB_distribution

A Git repository used only for distributing the official SLOB release.
Other
40 stars 8 forks source link

setup.sh script fails with syntax error #3

Open rgibbard opened 4 years ago

rgibbard commented 4 years ago
./setup.sh SLOB 3
NOTIFY  : 2020.10.23-12:23:41 : Begin SLOB 2.5.2 setup.
NOTIFY  : 2020.10.23-12:23:41 : ADMIN_CONNECT_STRING: "system/manager"
NOTIFY  : 2020.10.23-12:23:41 : Load parameters from slob.conf:

SCALE: 80M (10240 blocks)
SCAN_TABLE_SZ: 1M (128 blocks)
LOAD_PARALLEL_DEGREE: 2
ADMIN_SQLNET_SERVICE: ""
SYSDBA_PASSWD: "manager"
DBA_PRIV_USER: "system"

Note: setup.sh will use the following connect strings as per slob.conf:
        Admin Connect String: "system/manager"
        Non-Admin Connect String: " "

NOTIFY  : 2020.10.23-12:23:41 : Testing Admin connect using "sqlplus -L system/manager"
./setup.sh: line 250: [[: 0
1: syntax error in expression (error token is "1")
./setup.sh: line 252: return: too many arguments
FATAL   : 2020.10.23-12:23:44 :
FATAL   : 2020.10.23-12:23:44 : Please run the following query:
                                SELECT COUNT(*) FROM V$SESSION WHERE USERNAME LIKE 'USER%';
FATAL   : 2020.10.23-12:23:44 : There are existing connections to the database.
FATAL   : 2020.10.23-12:23:44 : Cannot drop schemas while sessions are connected.
FATAL   : 2020.10.23-12:23:44 : Abort.

This is caused by the fact that the query to check for the session count does not disable row feedback and the regex used to parse it does not filter it out.

bash -x setup.sh SLOB 3

+ num_sessions='
         0

1 row selected.'
++ echo '
         0

1 row selected.'
++ f_sqlplus_numeric_only_output
++ sed -e '/[A-Z]/d' -e /---/d -e '/^$/d' -e 's/[^0-9]//g'
+ num_sessions='0
1'
+ [[ 0
1 -ne 0 ]]
setup.sh: line 247: [[: 0
1: syntax error in expression (error token is "1")
+ return 0 1
setup.sh: line 249: return: too many arguments

The simple fix is to disable feedback for this query:

num_sessions=`sqlplus -S -L $constring  <<EOF
set head off feedback off
SELECT COUNT(*) FROM V\\$SESSION WHERE USERNAME LIKE 'USER%';
EOF
`
therealkevinc commented 4 years ago

Thanks for the feedback

therealkevinc commented 3 years ago

Was SLOB installed on a Linux system when this issue was hit or was this an attempt to get SLOB deployed on Solaris or AIX perhaps?

rgibbard commented 3 years ago

Was SLOB installed on a Linux system when this issue was hit or was this an attempt to get SLOB deployed on Solaris or AIX perhaps?

No it was RHEL 7. These were the SQLPLUS login profile settings.

SET feedback OFF SET termout OFF SET sqlprompt "_user'@'_connect_identifier>" ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-RR HH24:MI:SS'; ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-RR HH24:MI:SS.FF'; SET feedback ON SET linesize 300 SET pagesize 1000 SET long 10000000 SET longchunksize 10000000 SET arraysize 500 SET trimspool ON set trimout ON SET serveroutput ON size unlimited SET termout ON