diff options
author | DX37 | 2020-09-27 21:21:54 +0700 |
---|---|---|
committer | DX37 | 2020-09-27 21:21:54 +0700 |
commit | 97282c827e528640a36d00251909c61235f7820e (patch) | |
tree | c9790296e02c42f8977296b484caf1e9564655b0 | |
parent | 2bff87c190812e810c872074e1db83f85d096499 (diff) | |
download | aur-97282c827e528640a36d00251909c61235f7820e.tar.gz |
18.4.0
-rw-r--r-- | .SRCINFO | 38 | ||||
-rw-r--r-- | PKGBUILD | 70 | ||||
-rw-r--r-- | listener.ora | 20 | ||||
-rw-r--r-- | oracle-xe | 777 | ||||
-rw-r--r-- | oracle-xe-18c | 622 | ||||
-rw-r--r-- | oracle-xe-18c.conf | 18 | ||||
-rw-r--r-- | oracle-xe-18c.ld.so.conf | 1 | ||||
-rw-r--r-- | oracle-xe.conf | 1 | ||||
-rw-r--r-- | oracle-xe.install | 539 | ||||
-rw-r--r-- | oracle-xe.service | 4 | ||||
-rw-r--r-- | oracle.install | 118 | ||||
-rw-r--r-- | oracle_env.csh | 3 | ||||
-rw-r--r-- | oracle_env.sh | 3 |
13 files changed, 1235 insertions, 979 deletions
@@ -1,35 +1,35 @@ pkgbase = oracle-xe pkgdesc = a non free DBMS - pkgver = 11.2.0_1.0 - pkgrel = 4 + pkgver = 18.4.0_1.0 + pkgrel = 1 url = http://www.oracle.com/ - install = oracle.install + install = oracle-xe.install arch = x86_64 license = custom - depends = libaio>=0.3.104 - depends = gcc>=4.1.2 - depends = binutils>=2.16.91.0.5 - depends = make>=3.80 - depends = glibc>=2.3.4-2.41 + depends = libaio>=0.3.112-2 + depends = gcc>=9.3.0-1 + depends = binutils>=2.34-2.1 + depends = make>=4.3-1 + depends = glibc>=2.31-2 depends = bc depends = net-tools provides = oracle-xe conflicts = oracle-xe options = !strip - source = manual://download/file/from/oracle/page/oracle-xe-11.2.0-1.0.x86_64.rpm.zip + source = manual://download/file/from/oracle/page/oracle-database-xe-18c-1.0-1.x86_64.rpm source = oracle_env.csh source = oracle_env.sh - source = oracle-xe - source = oracle-xe.conf - source = listener.ora + source = oracle-xe-18c + source = oracle-xe-18c.conf + source = oracle-xe-18c.ld.so.conf source = oracle-xe.service - md5sums = dd7881a55569d890241f11cd0eeb7d48 - md5sums = cff2a6dbbbbf4d3454c05970183cc1b8 - md5sums = 6dd1d97571b823e8f682f290edeb9e7b - md5sums = e558d7dcb9e455f8cb03db8638832774 - md5sums = 5a3eaff3cb867d97cd250f04fe372ae7 - md5sums = 4d4a2e1bcc29b9c1fd197b42ccc4e0ac - md5sums = 3dd923ac2df9fd38827fc9fc0048273a + sha256sums = 4df0318d72a0b97f5468b36919a23ec07533f5897b324843108e0376566d50c8 + sha256sums = 5472f8ea19a2b33780146bc95e5dc9263bb9c05b18150d24d08a85f04ed86b84 + sha256sums = 9b584b6403ec0a3c8567d1720347769c92ba9f02ee460979506d641a5aa32f8b + sha256sums = 5e8296afc2c6402146cec06c3c1f73516e340f3104581c59e0f66af12f80b8e8 + sha256sums = 2d96e23869665f3648e54c85f004bf1b99f22ca227d7b148727b239135ae0e6b + sha256sums = 067e68295e4e2bcefe290ba0b8fcbe6594adc89de66875cc79c5e9f1190f8932 + sha256sums = dc59dd2abd55678abd4566af7b0cabfe7837d5c43db6612905c3f8c7b498c992 pkgname = oracle-xe @@ -5,10 +5,11 @@ # Contributor: untseac # Contributor: siasia # Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com> +# Contributor: JuliusTZM <julius dot tzm at gmail dot com> pkgname=oracle-xe -pkgver=11.2.0_1.0 -pkgrel=4 +pkgver=18.4.0_1.0 +pkgrel=1 pkgdesc="a non free DBMS" url="http://www.oracle.com/" license=('custom') @@ -16,47 +17,49 @@ arch=('x86_64') conflicts=('oracle-xe') provides=('oracle-xe') options=('!strip') -depends=('libaio>=0.3.104' 'gcc>=4.1.2' 'binutils>=2.16.91.0.5' 'make>=3.80' 'glibc>=2.3.4-2.41' 'bc' 'net-tools') -install='oracle.install' +depends=('libaio>=0.3.112-2' 'gcc>=9.3.0-1' 'binutils>=2.34-2.1' 'make>=4.3-1' 'glibc>=2.31-2' 'bc' 'net-tools') +install='oracle-xe.install' source=( - 'manual://download/file/from/oracle/page/oracle-xe-11.2.0-1.0.x86_64.rpm.zip' - 'oracle_env.csh' - 'oracle_env.sh' - 'oracle-xe' - 'oracle-xe.conf' - 'listener.ora' - 'oracle-xe.service' + 'manual://download/file/from/oracle/page/oracle-database-xe-18c-1.0-1.x86_64.rpm' + 'oracle_env.csh' + 'oracle_env.sh' + 'oracle-xe-18c' + 'oracle-xe-18c.conf' + 'oracle-xe-18c.ld.so.conf' + 'oracle-xe.service' ) DLAGENTS+=('manual::/usr/bin/echo The source file for this package needs to be downloaded manually, since it requires a login and is not redistributable. Please visit http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html') -md5sums=( - 'dd7881a55569d890241f11cd0eeb7d48' - 'cff2a6dbbbbf4d3454c05970183cc1b8' - '6dd1d97571b823e8f682f290edeb9e7b' - 'e558d7dcb9e455f8cb03db8638832774' - '5a3eaff3cb867d97cd250f04fe372ae7' - '4d4a2e1bcc29b9c1fd197b42ccc4e0ac' - '3dd923ac2df9fd38827fc9fc0048273a' -) +sha256sums=('4df0318d72a0b97f5468b36919a23ec07533f5897b324843108e0376566d50c8' + '5472f8ea19a2b33780146bc95e5dc9263bb9c05b18150d24d08a85f04ed86b84' + '9b584b6403ec0a3c8567d1720347769c92ba9f02ee460979506d641a5aa32f8b' + '5e8296afc2c6402146cec06c3c1f73516e340f3104581c59e0f66af12f80b8e8' + '2d96e23869665f3648e54c85f004bf1b99f22ca227d7b148727b239135ae0e6b' + '067e68295e4e2bcefe290ba0b8fcbe6594adc89de66875cc79c5e9f1190f8932' + 'dc59dd2abd55678abd4566af7b0cabfe7837d5c43db6612905c3f8c7b498c992') build() { cd $srcdir - bsdtar -xf Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm +# bsdtar -xf oracle-xe-18.4.0-1.0.x86_64.rpm } package() { cd $srcdir mkdir -p $pkgdir/etc/rc.d - cp $srcdir/oracle-xe $pkgdir/etc/rc.d/ - chmod +x $pkgdir/etc/rc.d/oracle-xe + cp $srcdir/oracle-xe-18c $pkgdir/etc/rc.d/ + chmod +x $pkgdir/etc/rc.d/oracle-xe-18c + + #Fix for ***[FATAL] [DBT-50000] Unable to check for available memory.**** + corr1="s_-sampleSchema_-J-Doracle.assistants.dbca.validate.ConfigurationParams=false -sampleSchema_g" + sed -i "${corr1}" $pkgdir/etc/rc.d/oracle-xe-18c - mkdir -p $pkgdir/usr/lib - mv $srcdir/u01/app/oracle $pkgdir/usr/lib/ + mkdir -p $pkgdir/etc/sysconfig + cp $srcdir/oracle-xe-18c.conf $pkgdir/etc/sysconfig - # Fix the listener.ora - cp -f $srcdir/listener.ora $pkgdir/usr/lib/oracle/product/11.2.0/xe/network/admin/ + mkdir -p $pkgdir/opt + mv $srcdir/opt/oracle $pkgdir/opt find $pkgdir -exec chmod 755 {} \; @@ -70,20 +73,11 @@ package() { # LD_LIBRARY_PATH mkdir -p $pkgdir/etc/ld.so.conf.d/ - cp $srcdir/oracle-xe.conf $pkgdir/etc/ld.so.conf.d/ + cp $srcdir/oracle-xe-18c.ld.so.conf $pkgdir/etc/ld.so.conf.d/oracle-xe-18c.conf # License mkdir -p $pkgdir/usr/share/licenses/custom/$pkgname - cp $srcdir/usr/share/doc/oracle_xe/LICENSE $pkgdir/usr/share/licenses/custom/$pkgname - - # Directory corrections - corr1="s_/u01/app/_/usr/lib/_g" - corr2="s_/usr/bin/groups_/bin/groups_g" - sed -i "${corr1}" $pkgdir/usr/lib/oracle/product/11.2.0/xe/config/scripts/* - sed -i "${corr2}" $pkgdir/usr/lib/oracle/product/11.2.0/xe/config/scripts/* - sed -i "${corr1}" $pkgdir/usr/lib/oracle/product/11.2.0/xe/odbc/lib/env_odbc.mk - sed -i "${corr1}" $pkgdir/usr/share/applications/* - sed -i "${corr1}" $pkgdir/usr/lib/oracle/product/11.2.0/xe/bin/oracle_env.* + cp $srcdir/usr/share/doc/oracle-xe-18c/LICENSE $pkgdir/usr/share/licenses/custom/$pkgname # For systemd mkdir -p $pkgdir/etc/systemd/system diff --git a/listener.ora b/listener.ora deleted file mode 100644 index cb53cc7dfe86..000000000000 --- a/listener.ora +++ /dev/null @@ -1,20 +0,0 @@ -# listener.ora Network Configuration File: - -SID_LIST_LISTENER = - (SID_LIST = - (SID_DESC = - (SID_NAME = PLSExtProc) - (ORACLE_HOME = /usr/lib/oracle/product/11.2.0/xe) - (PROGRAM = extproc) - ) - ) - -LISTENER = - (DESCRIPTION_LIST = - (DESCRIPTION = - (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) - (ADDRESS = (PROTOCOL = TCP)(HOST = %hostname%)(PORT = %port%)) - ) - ) - -DEFAULT_SERVICE_LISTENER = (XE) diff --git a/oracle-xe b/oracle-xe deleted file mode 100644 index 8c4309906f7b..000000000000 --- a/oracle-xe +++ /dev/null @@ -1,777 +0,0 @@ -#!/bin/bash -# -# -# chkconfig: 2345 80 05 -# description: This is a program that is responsible for taking care of -# configuring the Oracle Database 11g Express Edition and its associated -# services. -# -# processname: oracle-xe -# Red Hat or SuSE config: /etc/sysconfig/oracle-xe -# Debian or Ubuntu config: /etc/default/oracle-xe -# -# change log: -# svaggu 02/19/11 - /etc/oratab permissions are updated to 664 -# svaggu 12/20/10 - apex updates. -# svaggu 07/28/10 - Creation -# - -# Source fuction library -if [ -f /lib/lsb/init-functions ] -then - . /lib/lsb/init-functions -elif [ -f /etc/rc.d/functions ] -then - . /etc/rc.d/functions -fi - -# Set path if path not set (if called from /etc/rc) -case $PATH in - "") PATH=/bin:/usr/bin:/sbin:/etc - export PATH ;; -esac - -# Save LD_LIBRARY_PATH -SAVE_LLP=$LD_LIBRARY_PATH -RETVAL=0 -export ORACLE_HOME=/usr/lib/oracle/product/11.2.0/xe -export ORACLE_SID=XE -export ORACLE_BASE=/usr/lib/oracle -export PATH=$ORACLE_HOME/bin:$PATH -export LD_LIBRARY_PATH=$ORACLE_HOME/lib -LSNR=$ORACLE_HOME/bin/lsnrctl -SQLPLUS=$ORACLE_HOME/bin/sqlplus -ORACLE_OWNER=oracle -LOG="$ORACLE_HOME_LISTNER/listener.log" - -if [ -z "$CHOWN" ]; then CHOWN=/bin/chown; fi -if [ -z "$CHMOD" ]; then CHMOD=/bin/chmod; fi -if [ -z "$HOSTNAME" ]; then HOSTNAME=/bin/hostname; fi -if [ -z "$NSLOOKUP" ]; then NSLOOKUP=/usr/bin/nslookup; fi -if [ -z "$GREP" ]; then GREP=/usr/bin/grep; fi -if [ ! -f "$GREP" ]; then GREP=/bin/grep; fi -if [ -z "$SED" ]; then SED=/bin/sed; fi -if [ -z "$AWK" ]; then AWK=/bin/awk; fi -if [ -z "$SU" ];then SU=/bin/su; fi - -export LC_ALL=C - -if [ $(id -u) != "0" ] -then - echo "You must be root user to run the configure script. Login as root user and -then run the configure script." - exit 1 -fi - -CONFIG_NAME=oracle-xe -CONFIGURATION="/etc/sysconfig/$CONFIG_NAME" -if [ -f /etc/redhat-release ] -then - . /etc/rc.d/functions - - init_status() - { - return 0 - } - exit_status() - { - exit $? - } - success_status() - { - success - echo - } - failure_status() - { - failure $? - echo - } - -elif [ -f /etc/SuSE-release ] -then - . /etc/rc.status - - init_status() - { - rc_reset - } - success_status() - { - echo "OK" - return 0 - } - failure_status() - { - echo "Failed" - return 1 - } - exit_status() - { - exit $? - } - -else - if [ -d /etc/default ] - then - CONFIGURATION="/etc/default/$CONFIG_NAME" - fi - - init_status() - { - return 0 - } - - success_status() - { - echo "OK" - return 0 - } - - failure_status() - { - echo "Failed" - return 0 - } - - exit_status() - { - exit $? - } -fi - -# Source configuration - -[ -f "$CONFIGURATION" ] && . "$CONFIGURATION" - -init_status - -# -# if_fail() -# -# Evaluates return codes. If 0, prints "OK", if 1, prints "Failed" -# and exits. If 2, status is "already done" and nothing is printed. -# The rest of the functions in here all honor this convention. -# -if_fail() -{ - RC="$1" - REASON="$2" - if [ "$RC" = "0" ] - then - return - elif [ "$RC" = "2" ] - then - return - fi - failure_status "${REASON}" - exit 1 -} - - -# -# write_sysconfig() -# -# Writes the system configuration -# -write_sysconfig() -{ - cat >"$CONFIGURATION" <<EOF - -#This is a configuration file for automatic starting of the Oracle -#Database and listener at system startup.It is generated By running -#'/etc/rc.d/oracle-xe configure'.Please use that method to modify this -#file - -# ORACLE_DBENABLED:'true' means to load the Database at system boot. -ORACLE_DBENABLED=${ORACLE_DBENABLED:-false} - -# LISTENER_PORT: Database listener -LISTENER_PORT=${LISTENER_PORT} - -# HTTP_PORT : HTTP port for Oracle Application Express -HTTP_PORT=${HTTP_PORT} - -# Configuration : Check whether configure has been done or not -CONFIGURE_RUN=${CONFIGURE_RUN} - -EOF - - if [ $? != 0 ] - then - return 1 - fi - return 0 -} - - -# configure_perform() -# -# Instantantiate listener.ora,tnsnames.ora,and create the database, -# sets the password,start the listener,and adds database to inittab -# if necessary - -configure_perform() -{ - $SED -i "s/%hostname%/$HOSTNAME/g" $ORACLE_HOME/network/admin/listener.ora - $SED -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/listener.ora - $CHOWN oracle:dba $ORACLE_HOME/network/admin/listener.ora - - sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/postDBCreation.sql - $CHOWN oracle:dba $ORACLE_HOME/config/scripts/postDBCreation.sql - $SED -i "s/%hostname%/$HOSTNAME/g" $ORACLE_HOME/network/admin/tnsnames.ora - $SED -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/tnsnames.ora - $CHOWN oracle:dba $ORACLE_HOME/network/admin/tnsnames.ora - - if test $LISTENER_PORT -ne 1521 - then - if [ -f /tmp/local_listener ] - then - cat >/tmp/local_listener$$ <<EOF -########################################### -# Registration of instance with listsner -########################################### -local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))" -EOF - $CHMOD 664 /tmp/local_listener$$ - cat /tmp/local_listener$$ >> $ORACLE_HOME/config/scripts/init.ora - else - cat >/tmp/local_listener <<EOF -########################################### -# Registration of instance with listsner -########################################### -local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))" -EOF - $CHMOD 664 /tmp/local_listener - cat /tmp/local_listener >> $ORACLE_HOME/config/scripts/init.ora - fi - - if test -f /tmp/local_listener - then - rm -fr /tmp/local_listener - elif test -f /tmp/local_listener$$ - then - rm -fr /tmp/local_listener$$ - fi - - $SED -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/config/scripts/init.ora - $SED -i "s/%hostname%/$HOSTNAME/g" $ORACLE_HOME/config/scripts/init.ora - $CHOWN oracle:dba $ORACLE_HOME/config/scripts/init.ora - - fi - - sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/gettingstarted.sh - $CHOWN oracle:dba $ORACLE_HOME/config/scripts/gettingstarted.sh - - if [ -f $ORACLE_HOME/bin/tnslsnr ] - then - echo -n "Starting Oracle Net Listener..." - $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start" > /dev/null 2>&1 - touch /var/lock/subsys/listener - echo "Done" - fi - - echo -n "Configuring database..." - $SU -s /bin/bash $ORACLE_OWNER -c "$ORACLE_HOME/config/scripts/XE.sh" > /dev/null 2>&1 - if [ -d $ORACLE_HOME/config/log ] - then - err=`grep "ORA-44410" $ORACLE_HOME/config/log/*.log` - out=`grep "ORA-01034" $ORACLE_HOME/config/log/*.log` - if [ "$err" != "" ] || [ "$out" != "" ] - then - echo - echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details" - exit 1 - fi - fi - - pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | $GREP -v $GREP` - - if [ "$pmon" = "" ]; - then - echo - echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details" - exit 1 - fi - - echo alter user sys identified by \"$ORACLE_PASSWORD\"\; | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1 - echo alter user system identified by \"$ORACLE_PASSWORD\"\; | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1 - - echo @$ORACLE_HOME/apex/apxxepwd.sql \"$ORACLE_PASSWORD\"\; | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1 - echo "Done" - mkdir -p /usr/lib/oracle/oradata /usr/lib/oracle/diag - $CHOWN oracle:dba /usr/lib/oracle/oradata - $CHOWN oracle:dba /usr/lib/oracle/diag - - $CHMOD 750 /usr/lib/oracle/oradata - $CHMOD -R 775 /usr/lib/oracle/diag - rm -fr $ORACLE_HOME/config/seeddb - - if [ -f /etc/oratab ] - then - echo "XE:$ORACLE_HOME:N" >> /etc/oratab - else - echo "XE:$ORACLE_HOME:N" >> /etc/oratab - $CHOWN oracle:dba /etc/oratab - $CHMOD 664 /etc/oratab - fi - - echo -n "Starting Oracle Database 11g Express Edition instance..." - pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep` - - if [ "$pmon" = "" ]; - then - $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev/null 2>&1 - touch /var/lock/subsys/oracle-xe - fi - echo "Done" - - echo "Installation completed successfully." - - - return 0 -} - -# -#configure_ask() -# -# Ask configuration questions,setting the variables. -# - -configure_ask() -{ - cat <<EOF - -Oracle Database 11g Express Edition Configuration -------------------------------------------------- -This will configure on-boot properties of Oracle Database 11g Express -Edition. The following questions will determine whether the database should -be starting upon system boot, the ports it will use, and the passwords that -will be used for database accounts. Press <Enter> to accept the defaults. -Ctrl-C will abort. - -EOF - #get the http port value - while : - do - while [ 1 ] - do - echo -n Specify the HTTP port that will be used for Oracle Application Express [8080]: - read LINE - if [ -z $LINE ] - then - LINE=8080 - fi - echo - port=`netstat -n --tcp --listen | grep :$LINE | awk -F: '{print $4}' | sed 's/ //g'` - if [ "$port" = "$LINE" ] - then - if [ ! -z $1 ] - then - echo - echo "Port $LINE appears to be in use by another application. Specify a different -port and retry the configuration." - trap "rm -fr $1" exit - exit - fi - echo "Port $port appears to be in use by another application. Specify a different port." - else - break; - fi - done - - case "$LINE" in - "") - break - ;; - *[^0-9]*) - echo "Invalid http port: $LINE" - ;; - *) - HTTP_PORT=$LINE - break - ;; - esac - done - - #get the listener port value - while : - do - while [ 1 ] - do - echo -n Specify a port that will be used for the database listener [1521]: - read LINE - if [ -z $LINE ] - then - LINE=1521 - fi - echo - port=`netstat -n --tcp --listen | $GREP :$LINE | $AWK -F: '{print $4}' | $SED 's/ //g'` - if [ "$port" = "$LINE" ] - then - if [ ! -z $1 ] - then - echo - echo "Port $LISTENER_PORT appears to be in use by another application. Specify a different -port and retry the configuration." - trap "rm -fr $1" exit - exit - fi - echo Port $port appears to be in use by another application.\ - Specify a different port. - else - break; - fi - done - - case "$LINE" in - "") - break - ;; - *[^0-9]*) - echo "Invalid port: $LINE" >&2 - ;; - *) - if [ "$HTTP_PORT" != "$LINE" ] - then - LISTENER_PORT=$LINE - break - else - echo Database listener cannot be configured on the same port as Oracle Application Express. - fi - ;; - esac - done - - #get the database password - while : - do - echo -n "Specify a password to be used for database accounts. Note that the same -password will be used for SYS and SYSTEM. Oracle recommends the use of -different passwords for each database account. This can be done after -initial configuration:" - while [ 1 ] - do - /bin/stty -echo > /dev/null 2>&1 - temp=`echo $IFS` - export IFS="\n" - while [ 1 ] - do - read LINE - while [ -z "$LINE" ] - do - echo - echo -n "Password can't be null. Enter password:" - read LINE - done - - result=`expr index "$LINE" [\!\@\%\^\&\*\(\)\+\=\\|~\[\]{}\;\:\'\"\,\<\>\/\?]` - if [ $result != 0 ]; - then - echo - echo -n "The password you entered contains invalid characters. Enter password:" - else - break - fi - done - echo - echo -n "Confirm the password:" - read LINE1 - echo - if [ "$LINE" != "$LINE1" ]; - then - if [ ! -z $1 ] - then - echo - echo "Passwords do not match. Specify the same password for both ORACLE_PASSSWORD and -ORACLE_CONFIRM_PASSWORD, and retry the configuration." - trap "rm -fr $1" exit - exit - fi - echo - echo -n "Passwords do not match. Enter the password:" - else - break - fi - done - /bin/stty echo > /dev/null 2>&1 - ORACLE_PASSWORD=$LINE - export IFS=$temp - break; - done - - while : - do - if [ "$ORACLE_DBENABLED" = "true" ] - then - CUR=y - else - CUR=n - fi - echo - echo -n "Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:" - read LINE - if [ -z $LINE ] - then - ORACLE_DBENABLED=true - fi - echo - case "$LINE" in - "") - break - ;; - y|Y) - ORACLE_DBENABLED=true - break - ;; - n|N) - ORACLE_DBENABLED=false - break - ;; - *) - echo "Invalid response: $LINE " >&2 - break - esac - done -} - -configure() -{ - if test -f "$CONFIGURATION" - then - echo "Oracle Database 11g Express Edition is already configured" - exit 1 - fi - configure_ask - configure_perform - CONFIGURE_RUN=true - write_sysconfig -} - -start() { - - if [ "$CONFIGURE_RUN" != "true" ] - then - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - status=`ps -ef | grep tns | grep oracle` - if [ "$status" == "" ] - then - if [ -f $ORACLE_HOME/bin/tnslsnr ] - then - echo "Starting Oracle Net Listener." - $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start" > /dev/null 2>&1 - touch /var/lock/subsys/listener - fi - fi - pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep` - if [ "$pmon" = "" ]; - then - echo "Starting Oracle Database 11g Express Edition instance." - $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev/null 2>&1 - else - echo "Oracle Database 11g Express Edition instance is already started" - fi - RETVAL=$? - if [ $RETVAL -eq 0 ] - then - echo - touch /var/lock/subsys/oracle-xe - else - echo Failed to start Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr\ - and Oracle Express Database using $ORACLE_HOME/bin/sqlplus. - RETVAL=1 - fi - return $RETVAL -} - -stop() { - if [ "$CONFIGURE_RUN" != "true" ] - then - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - - # Stop Oracle 11g Express Edition Database and Listener - echo Shutting down Oracle Database 11g Express Edition instance. - $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/stopdb.sql" > /dev/null 2>&1 - echo Stopping Oracle Net Listener. - $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR stop" > /dev/null 2>&1 - RETVAL=$? - echo - if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/listener - then - rm -f /var/lock/subsys/oracle-xe - return $RETVAL - fi -} - -dostatus() { - if test ! -f "$CONFIGURATION" - then - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - elif [ "$CONFIGURE_RUN" != "true" ] - then - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - - $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR status" - RETVAL=$? -} - -configure_with_user_inputs() -{ - -case "$1" in - start) - if [ "$0" != "/etc/rc.d/oracle-xe" ] - then - if test -f "$CONFIGURATION" - then - if test "$ORACLE_DBENABLED" != "true" - then - exit 0 - fi - else - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - fi - start - ;; - configure) - configure - ;; - stop) - stop - ;; - restart|reload|force-reload) - stop - start - RETVAL=$? - ;; - status) - dostatus - ;; - enable) - if test -f "$CONFIGURATION" - then - ORACLE_DBENABLED=true - write_sysconfig - else - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - ;; - - disable) - if test -f "$CONFIGURATION" - then - ORACLE_DBENABLED=false - write_sysconfig - else - echo "Oracle Database 11g Express Edition is not configured. You must run -'/etc/rc.d/oracle-xe configure' as the root user to configure the database." - exit 0 - fi - ;; - - *) - echo $"Usage: $0 {start|stop|restart|force-reload|configure|status|enable|disable}" - exit 1 -esac -} - -readFromResponseFile() -{ - - HTTP_PORT=`sed '/^\#/d' $1 | grep -w ^ORACLE_HTTP_PORT | tail -n -1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'` - LISTENER_PORT=`sed '/^\#/d' $1 | grep -w ^ORACLE_LISTENER_PORT | tail -n -1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'` - PASSWORD=`sed '/^\#/d' $1 | grep -w ^ORACLE_PASSWORD | tail -n -1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'` - CONFIRM_PASSWORD=`sed '/^\#/d' $1 | grep -w ^ORACLE_CONFIRM_PASSWORD | tail -n -1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'` - ORACLE_DBENABLE=`sed '/^\#/d' $1 | grep -w ^ORACLE_DBENABLE | tail -n -1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'` - - RESTOREUMASK=$(umask) - while : ;do - umask 0077 - MYTEMPFILE="${TMPDIR:-/tmp}/$(basename $0).$$.$(date +%s)" - echo $HTTP_PORT > $MYTEMPFILE - echo $LISTENER_PORT >> $MYTEMPFILE - echo $PASSWORD >> $MYTEMPFILE - echo $CONFIRM_PASSWORD >> $MYTEMPFILE - echo $ORACLE_DBENABLE >> $MYTEMPFILE - break - done - umask "$RESTOREUMASK" -} - -configure_with_responsefile_values() -{ - RESPONSEFILE=`echo $1 | awk -F"=" '{print $2}'` - if [ -z $RESPONSEFILE ];then - echo "Please provide a valid responseFile" - exit 1 - fi - if [ X`ls $RESPONSEFILE` = X ] - then - echo $RESPONSEFILE does not exists - exit 1 - fi - - if [ `stat -c "%a" $RESPONSEFILE` -lt 400 ]; then - echo "$RESPONSEFILE exists but is not readable" - else - readFromResponseFile $RESPONSEFILE -# exit - RETVAL=$? - if [ $RETVAL -eq 0 ];then - configure_ask $MYTEMPFILE < $MYTEMPFILE - trap "rm -fr $MYTEMPFILE" exit - configure_perform - CONFIGURE_RUN=true - write_sysconfig -# echo To access the Database Home Page go to \"http://127.0.0.1:$HTTP_PORT/apex\" - - else - echo "Please check the responseFile for required variables" - exit 1 - fi - - fi -} - -case "$#" in - "1") - configure_with_user_inputs $1 - ;; - "2") - if test -f "$CONFIGURATION" - then - echo "Oracle Database 11g Express Edition is already configured" - exit 1 - fi - - case "$2" in - responseFile=*) - ;; - *) - echo "Usage: $0 $1 responseFile=<responseFile location>" - exit 1 - esac - configure_with_responsefile_values $2 - ;; - *) - echo $"Usage: $0 {start|stop|restart|force-reload|configure|status|enable|disable}" - exit 1 - ;; - -esac diff --git a/oracle-xe-18c b/oracle-xe-18c new file mode 100644 index 000000000000..cb8f60ab924d --- /dev/null +++ b/oracle-xe-18c @@ -0,0 +1,622 @@ +#!/bin/bash +# +# chkconfig: 2345 80 05 +# description: This script is responsible for taking care of configuring the RPM Oracle XE Database and its associated services. +# +# processname: oracle-xe-18c +# Red Hat or SuSE config: /etc/sysconfig/oracle-xe-18c +# +# change log: +# ivalopez 12/13/17 - Creation +# mstalin 04/30/18 - DB configuration changes +# rfgonzal 05/14/28 - Enh 27965960 & 27965939 - Enable service and clean env vars when launching dbca +# rfgonzal 05/14/18 - Enh 27965960 & 27965939 - Enable service and clean env vars when launching dbca +# mstalin 05/20/18 - 21261445 RTI, disable the checks +# mstalin 05/29/18 - 28121518 password handling and connection string handling +# mstalin 06/07/18 - Add memory distribution logic +# rfgonzal 07/09/18 - Bug 28243127 - Cannot start/stop DB after fresh installation +# mstalin 07/18/18 - 28243186 Print EM configuration URL +# mstalin 07/06/18 - Add sample schema to XE +# mstalin 08/02/18 - 28353388 Add delete option to the usage text +# mstalin 08/02/18 - 28242894 Reduce verbose of the script +# mstalin 10/06/18 - 28735641 Fix duplicate success messages and product name +# + + +# Set path if path not set +case $PATH in + "") PATH=/bin:/usr/bin:/sbin:/etc + export PATH ;; +esac + +# Check if the root user is running this script +if [ $(id -u) != "0" ] +then + echo "You must be root user to run the configure script. Login as root user and then run the configure script." + exit 1 +fi + +# DB defaults +export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE +export ORACLE_SID=XE +export TEMPLATE_NAME=XE_Database.dbc +export PDB_NAME=XEPDB1 +export LISTENER_NAME=LISTENER +export NUMBER_OF_PDBS=1 +export CREATE_AS_CDB=true + +# General exports and vars +export PATH=$ORACLE_HOME/bin:$PATH +LSNR=$ORACLE_HOME/bin/lsnrctl +SQLPLUS=$ORACLE_HOME/bin/sqlplus +NETCA=$ORACLE_HOME/bin/netca +DBCA=$ORACLE_HOME/bin/dbca +ORACLE_OWNER=oracle +RETVAL=0 +CONFIG_NAME="oracle-xe-18c.conf" +CONFIGURATION="/etc/sysconfig/$CONFIG_NAME" +ORACLE_HOME_NAME="OraHomeXE" +MINIMUM_MEMORY=1048576 +MAXIMUM_MEMORY=2097152 +MINIMUM_MEMORY_STR="1GB" + +MINIMUM_SPACE=4718592 +MINIMUM_SPACE_STR="4.5GB" + +# Commands +if [ -z "$SU" ];then SU=/bin/su; fi +if [ -z "$AWK" ];then AWK=/bin/awk; fi +if [ -z "$DF" ];then DF=/bin/df; fi +if [ -z "$GREP" ]; then GREP=/usr/bin/grep; fi +if [ ! -f "$GREP" ]; then GREP=/bin/grep; fi +if [ -z "$TAIL" ]; then TAIL=/usr/bin/tail; fi +if [ ! -f "$TAIL" ]; then TAIL=/bin/tail; fi +HOSTNAME_CMD="/bin/hostname" +MKDIR_CMD="/bin/mkdir" + +# To start the DB +start() +{ + check_for_configuration + RETVAL=$? + if [ $RETVAL -eq 1 ] + then + echo "The Oracle Database is not configured. You must run '/etc/init.d/oracle-xe-18c configure' as the root user to configure the database." + exit + fi + # Check if the DB is already started + pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | $GREP -v grep` + if [ "$pmon" = "" ]; + then + # Unset the proxy env vars before calling sqlplus + unset_proxy_vars + echo "Starting Oracle Net Listener." + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start $LISTENER_NAME" > /dev/null 2>&1 + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo "Oracle Net Listener started." + fi + + echo "Starting Oracle Database instance $ORACLE_SID." + $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog << EOF + connect / as sysdba + startup + alter pluggable database all open + exit; + EOF" > /dev/null 2>&1 + RETVAL1=$? + if [ $RETVAL1 -eq 0 ] + then + echo "Oracle Database instance $ORACLE_SID started." + fi + else + echo "The Oracle Database instance $ORACLE_SID is already started." + exit 0 + fi + + echo + if [ $RETVAL -eq 0 ] && [ $RETVAL1 -eq 0 ] + then + return 0 + else + echo "Failed to start Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr and Oracle Database using $ORACLE_HOME/bin/sqlplus." + exit 1 + fi +} + +# To stop the DB +stop() +{ + check_for_configuration + RETVAL=$? + if [ $RETVAL -eq 1 ] + then + echo "The Oracle Database is not configured. You must run '/etc/init.d/oracle-xe-18c configure' as the root user to configure the database." + exit 1 + fi + # Check if the DB is already stopped + pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | $GREP -v grep` + if [ "$pmon" = "" ] + then + echo "Oracle Database instance $ORACLE_SID is already stopped." + exit 1 + else + # Unset the proxy env vars before calling sqlplus + unset_proxy_vars + echo "Shutting down Oracle Database instance $ORACLE_SID." + $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog << EOF + connect / as sysdba + shutdown immediate + exit; + EOF" > /dev/null 2>&1 + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo "Oracle Database instance $ORACLE_SID shut down." + fi + + echo "Stopping Oracle Net Listener." + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR stop $LISTENER_NAME" > /dev/null 2>&1 + RETVAL1=$? + if [ $RETVAL1 -eq 0 ] + then + echo "Oracle Net Listener stopped." + fi + fi + + echo + if [ $RETVAL -eq 0 ] && [ $RETVAL1 -eq 0 ] + then + return 0 + else + echo "Failed to stop Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr and Oracle Database using $ORACLE_HOME/bin/sqlplus." + exit 1 + fi +} + +configure_delete() +{ + # Unset the proxy env vars before deleting the db + unset_proxy_vars + ORABASE=`$ORACLE_HOME/bin/orabase` + NETCA_LOG_DIR="$ORABASE/cfgtoollogs/netca" + if [ ! -d "$NETCA_LOG_DIR" ] + then + $SU -s /bin/bash $ORACLE_OWNER -c "$MKDIR_CMD -p $NETCA_LOG_DIR" + fi + NETCA_LOG="$NETCA_LOG_DIR/netca_deinst_out.log" + + echo "Deleting Oracle Listener." + + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR stop $LISTENER_NAME" > /dev/null 2>&1 + + $SU -s /bin/bash $ORACLE_OWNER -c "$NETCA /deinst >>$NETCA_LOG" + + echo "Deleting Oracle Database $ORACLE_SID." + + $SU -s /bin/bash $ORACLE_OWNER -c "$DBCA -silent -deleteDatabase -sourceDB $ORACLE_SID -skipSYSDBAPasswordPrompt true" + +} +# To call DBCA to configure the DB +configure_perform() +{ + + DBFILE_CONSTRUCT="" + if [ "x$DBFILE_DEST" != "x" ] + then + DBFILE_CONSTRUCT="-storageType FS -datafileDestination $DBFILE_DEST" + fi + + LSNRPORT_CONSTRUCT="" + if [ "x$LISTENER_PORT" != "x" ] + then + LSNRPORT_CONSTRUCT="/lisport $LISTENER_PORT" + fi + + # Unset the proxy env vars before calling DBCA and NETCA + unset_proxy_vars + + MEMORY_CONSTRUCT="" + mem=`cat /proc/meminfo |grep MemTotal` + # Total physical memory + if [ "x$mem" != "x" ] + then + + #Convert into string array + + OLDIFS="$IFS" + IFS=' ' + str=($mem) + IFS=$OLDIFS + + #40 percent of physical memory + dbmem=$(( 40*${str[1]}/100 )) + + #Oracle memory is less than 2GB distribute to pga and sga + if [ "$dbmem" -lt "$MAXIMUM_MEMORY" ] + then + memory=$(( $dbmem/1024 )) + pga=$(( $memory/4 )) + sga=$(( 3*$memory/4 )) + MEMORY_CONSTRUCT="-initParams sga_target=${sga}M,pga_aggregate_target=${pga}M" + fi + + fi + ## Adding env var to disable custom scripts run post db creation + # + SQLSCRIPT_CONSTRUCT="-customScripts $ORACLE_HOME/assistants/dbca/postdb_creation.sql" + if [ "x$NO_POSTSCRIPT" != "x" ] + then + SQLSCRIPT_CONSTRUCT="" + fi + + echo "Configuring Oracle Listener." + + ORABASE=`$ORACLE_HOME/bin/orabase` + NETCA_LOG_DIR="$ORABASE/cfgtoollogs/netca" + if [ ! -d "$NETCA_LOG_DIR" ] + then + $SU -s /bin/bash $ORACLE_OWNER -c "$MKDIR_CMD -p $NETCA_LOG_DIR" + fi + NETCA_LOG="$NETCA_LOG_DIR/netca_configure_out.log" + + $SU -s /bin/bash $ORACLE_OWNER -c "$NETCA /orahome $ORACLE_HOME /instype typical /inscomp client,oraclenet,javavm,server,ano /insprtcl tcp /cfg local /authadp NO_VALUE /responseFile $ORACLE_HOME/network/install/netca_typ.rsp /silent /orahnam $ORACLE_HOME_NAME /listenerparameters DEFAULT_SERVICE=XE $LSNRPORT_CONSTRUCT >> $NETCA_LOG" + + RETVALNETCA=$? + if [ $RETVALNETCA -eq 0 ] + then + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start $LISTENER_NAME > /dev/null" + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR status $LISTENER_NAME > /dev/null" + RETVALLSNRCTL=$? + if [ $RETVALLSNRCTL -eq 0 ] + then + echo "Listener configuration succeeded." + else + echo "Listener configuration failed. Check logs under '$NETCA_LOG_DIR'." + exit 1 + fi + else + echo "Listener configuration failed. Check log '$NETCA_LOG' for more details." + exit 1 + fi + + + echo "Configuring Oracle Database $ORACLE_SID." + + + $SU -s /bin/bash $ORACLE_OWNER -c "(echo '$ORACLE_PASSWORD'; echo '$ORACLE_PASSWORD'; echo '$ORACLE_PASSWORD') | $DBCA -silent -createDatabase -gdbName $ORACLE_SID -templateName $TEMPLATE_NAME -characterSet $CHARSET -createAsContainerDatabase $CREATE_AS_CDB -numberOfPDBs $NUMBER_OF_PDBS -pdbName $PDB_NAME -sid $ORACLE_SID -emConfiguration DBEXPRESS -emExpressPort $EM_EXPRESS_PORT -J-Doracle.assistants.dbca.validate.DBCredentials=false -sampleSchema true $SQLSCRIPT_CONSTRUCT $DBFILE_CONSTRUCT $MEMORY_CONSTRUCT" + + RETVAL=$? + + echo + if [ $RETVAL -eq 0 ] + then + print_success_connect + return 0 + else + echo "Database configuration failed. Check logs under '$ORABASE/cfgtoollogs/dbca'." + exit 1 + fi + return 0 +} +print_success_connect() +{ + + connectstr=`$ORACLE_HOME/bin/lsnrctl status $LISTENER_NAME |grep Connecting` + if [ "x$connectstr" != "x" ] + then + str1=($connectstr) + portfound=0 + i=0 + for str in "${str1[@]}" + do + istr=`echo $str` + if [ "$portfound" = "1" ] + then + break + else + if [ "x$istr" != "x" ] + then + if [ "$istr" != "${istr/\(PORT/}" ] + then + portfound=1 + index=$i + fi + fi + fi + i=$(( $i+1 )) + done + fi + if [ index = 0 ] + then + portv="PORT" + else + finalstr="${str1[index]}" + finalstr=`echo $finalstr |cut -d'=' -f 6` + portv="${finalstr/\)*/}" + fi + if [ "x$portv" = "x" ] + then + portv="PORT" + fi + hostname=`$HOSTNAME_CMD` + if [ "x$portv" = "x1521" ] + then + connectstr1="$hostname" + connectstr2="$hostname/$PDB_NAME" + else + connectstr1="$hostname:$portv" + connectstr2="$hostname:$portv/$PDB_NAME" + fi + + echo "Connect to Oracle Database using one of the connect strings:" + echo ' Pluggable database: '$connectstr2'' + echo ' Multitenant container database: '$connectstr1'' + em_url="https://localhost:$EM_EXPRESS_PORT/em" + echo 'Use '$em_url' to access Oracle Enterprise Manager for Oracle Database XE' + +} + +# Enh 27965939 - Unsets the proxy env variables +unset_proxy_vars() +{ + if [ "$http_proxy" != "" ] + then + unset http_proxy + fi + + if [ "$HTTP_PROXY" != "" ] + then + unset HTTP_PROXY + fi + + if [ "$https_proxy" != "" ] + then + unset https_proxy + fi + + if [ "$HTTPS_PROXY" != "" ] + then + unset HTTPS_PROXY + fi +} + +# Check if the DB is already configured +check_for_configuration() +{ + configfile=`$GREP --no-messages $ORACLE_SID:$ORACLE_HOME /etc/oratab` > /dev/null 2>&1 + if [ "$configfile" = "" ] + then + return 1 + fi + return 0 +} + +read_config_file() +{ + if [ -f "$CONFIGURATION" ] + then + . "$CONFIGURATION" + else + echo "The Oracle Database is not configured. Unable to read the configuration file '$CONFIGURATION'" + exit 1; + fi +} + +# Validation method to check for the port availability for Oracle DB listener +check_port_availability() +{ + if [ "x$SKIP_VALIDATIONS" = "xtrue" ] + then + return 0 + fi + if [ "x$LISTENER_PORT" = "x" ] + then + return 0 + fi + + $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR status LISTENER" > /dev/null 2>&1 + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo "Oracle Net Listener configured." + return 0 + fi + port=`netstat -n --tcp --listen | $GREP :$LISTENER_PORT` + if [ "$port" != "" ] + then + echo "Port $LISTENER_PORT appears to be in use by another application. Specify a different port in the configuration file '$CONFIGURATION'" + exit 1; + fi +} + +# Validation method to check for port availability for Oracle EM Express +check_em_express_port_availability() +{ + + if [ "x$SKIP_VALIDATIONS" = "xtrue" ] + then + return 0 + fi + if [ "x$EM_EXPRESS_PORT" = "x" ] + then + EM_EXPRESS_PORT="5500" + fi + port=`netstat -n --tcp --listen | $GREP :$EM_EXPRESS_PORT` + if [ "$port" != "" ] + then + echo "Port $EM_EXPRESS_PORT appears to be in use by another application. Specify a different Oracle EM Express port in the configuration file '$CONFIGURATION'" + exit 1; + fi +} + +check_memory() +{ + if [ "x$SKIP_VALIDATIONS" = "xtrue" ] + then + return 0 + fi + mem=`cat /proc/meminfo |grep MemFree` + if [ "x$mem" != "x" ] + then + str=($mem) + echo "Free memory available in the system ${str[1]}" + if [ "${str[1]}" -lt "$MINIMUM_MEMORY" ] + then + echo "Free memory available is not enough for database configuration" + echo "Need at least $MINIMUM_MEMORY_STR free for database configuration" + exit 1 + fi + fi +} + +check_space() +{ + if [ "x$SKIP_VALIDATIONS" = "xtrue" ] + then + return 0 + fi + + DBF_DEST_VALID=$DBFILE_DEST + if [ "x$DBF_DEST_VALID" = "x" ] + then + DBF_DEST_VALID=`$ORACLE_HOME/bin/orabase` + fi + if [ "x$DBF_DEST_VALID" != "x" ] + then + dspace=`$DF -k $DBF_DEST_VALID --direct | $TAIL -n 1| $AWK '{print $4}'` + dspace="${dspace//[$'\t\r\n ']}" + if [ "x$dspace" != "x" ] + then + if [ "$dspace" -lt "$MINIMUM_SPACE" ] + then + echo "The location '$DBF_DEST_VALID' specified for database files has insufficient space." + echo "Database creation needs at least '$MINIMUM_SPACE_STR' disk space." + echo "Specify a different database file destination that has enough space in the configuration file '$CONFIGURATION'." + exit 1 + fi + fi + fi +} + + +# Entry point to configure the DB +configure() +{ + check_for_configuration + RETVAL=$? + if [ $RETVAL -eq 0 ] + then + echo "Oracle Database instance $ORACLE_SID is already configured." + exit 1 + fi + read_config_file + check_space + check_port_availability + check_em_express_port_availability + configure_ask + configure_perform +} + + + +configure_ask() +{ + if [ "x$ORACLE_PASSWORD" != "x" ] + then + return 0 + fi + + #get the database password + while : + do + echo -n "Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:" + while [ 1 ] + do + /bin/stty -echo > /dev/null 2>&1 + temp=`echo $IFS` + export IFS="\n" + while [ 1 ] + do + read LINE + while [ -z "$LINE" ] + do + echo + echo -n "Password cannot be null. Enter password:" + read LINE + done + + result=`expr index "$LINE" [\!\@\%\^\&\*\(\)\+\=\\|~\[\]{}\;\:\'\"\,\<\>\/\?]` + if [ $result != 0 ]; + then + echo + echo -n "The password you entered contains invalid characters. Enter password:" + else + break + fi + done + echo + echo -n "Confirm the password:" + read LINE1 + echo + if [ "$LINE" != "$LINE1" ]; + then + if [ ! -z $1 ] + then + echo + echo "Passwords do not match. Specify the same password for both ORACLE_PASSSWORD and +ORACLE_CONFIRM_PASSWORD, and retry the configuration." + trap "rm -fr $1" exit + exit + fi + echo + echo -n "Passwords do not match. Enter the password:" + else + break + fi + done + /bin/stty echo > /dev/null 2>&1 + ORACLE_PASSWORD=$LINE + export IFS=$temp + break; + done + +} + +restart() +{ + # Check if the DB is already stopped + pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | $GREP -v grep` + if [ "$pmon" = "" ] + then + start + else + stop + start + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + configure) + configure + ;; + delete) + configure_delete + ;; + restart) + restart + ;; + *) + echo $"Usage: $0 {start|stop|restart|configure|delete}" + exit 1 + ;; +esac + +exit 0 diff --git a/oracle-xe-18c.conf b/oracle-xe-18c.conf new file mode 100644 index 000000000000..e7a36e2eaf06 --- /dev/null +++ b/oracle-xe-18c.conf @@ -0,0 +1,18 @@ +#This is a configuration file to setup the Oracle Database. +#It is used when running '/etc/init.d/oracle-xe-18c configure'. + +# LISTENER PORT used Database listener, Leave empty for automatic port assignment +LISTENER_PORT= + +# EM_EXPRESS_PORT Oracle EM Express URL port +EM_EXPRESS_PORT=5500 + +# Character set of the database +CHARSET=AL32UTF8 + +# Database file directory +# If not specified, database files are stored under Oracle base/oradata +DBFILE_DEST= + +# SKIP Validations, memory, space +SKIP_VALIDATIONS=false diff --git a/oracle-xe-18c.ld.so.conf b/oracle-xe-18c.ld.so.conf new file mode 100644 index 000000000000..7d49a2def487 --- /dev/null +++ b/oracle-xe-18c.ld.so.conf @@ -0,0 +1 @@ +/usr/lib/oracle/product/18c/dbhomeXE/lib
\ No newline at end of file diff --git a/oracle-xe.conf b/oracle-xe.conf deleted file mode 100644 index f47da8171004..000000000000 --- a/oracle-xe.conf +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/oracle/product/11.2.0/xe/lib
\ No newline at end of file diff --git a/oracle-xe.install b/oracle-xe.install new file mode 100644 index 000000000000..3cb6f3e37bb8 --- /dev/null +++ b/oracle-xe.install @@ -0,0 +1,539 @@ +pre_install(){ + #Create the corresponding log for the RPM installation + RPM_LOG_LOCATION=/var/log/oracle-database-xe-18c/results + RPM_LOG_FILE=$RPM_LOG_LOCATION/oraInstall.log + + mkdir -p $RPM_LOG_LOCATION + #Start the logging og the installation + echo '[INFO] Starting the installation process of the Oracle Database...' >> $RPM_LOG_FILE + echo $(date +%x-%r) >> $RPM_LOG_FILE + + # Do not execute %pre section during upgrade + RPM_ORCL_USR='oracle' + RPM_ORCL_USR_ID='54321' + + #Declare the arrays required to validate and create if necessary the required user groups + declare -a USER_GROUP_NAMES=('oinstall' 'dba' 'oper' 'backupdba' 'dgdba' 'kmdba' 'racdba') + declare -a USER_GROUP_IDS=('54321' '54322' '54323' '54324' '54325' '54326' '54330') + + #User group data organized for Oracle home owner creation + PRIMARY_USER_GROUP_NAME='oinstall' + SECONDARY_USER_GROUPS_NAMES='dba,oper,backupdba,dgdba,kmdba,racdba' + + # Identify platform on which this script is running, it might happen that it is running + # on a platform where rpm logic doesn't work as the rpm might have been converted to other + # installation media. + DISTRO='' + + if [ -f /etc/debian_version ]; then + DISTRO='DEBIAN' + elif [ -f /etc/ubuntu_version ]; then + DISTRO='UBUNTU' + elif [ -f /etc/redhat-release ]; then + DISTRO='REDHAT' + elif [ -f /etc/lsb-release ]; then + DISTRO_NAME=$(lsb_release -si) + DISTRO="$(tr [a-z] [A-Z] <<< $DISTRO_NAME)" + else + DISTRO=$(uname -s) + fi + + # User must be root + + if [ $(id -u) != "0" ]; then + echo "[SEVERE] You must be the root user to install the software" >&2 + exit 1 + fi + + # ORACLE_BASE must be unset + if `env | grep -q ORACLE_BASE`; then + unset ORACLE_BASE + fi + #check if the required user groups exists, if not then they are created. + + USER_GROUP_INDEX=0 + #Declare an array to store the detected remote groups during the pre check installation + declare -a REMOTE_GROUP_LIST=(); + + for TARGET_USER_GROUP in "${USER_GROUP_NAMES[@]}" + do + getent group "${TARGET_USER_GROUP}" >> /dev/null + if [ "$?" -ne "0" ]; then + #In case that the group is there, but not a primary one, then we lastly check locally + grep "^${TARGET_USER_GROUP}:" -q /etc/group + if [ "$?" -ne "0" ]; then + #group doesn't exist create it + groupadd -g "${USER_GROUP_IDS[USER_GROUP_INDEX]}" "${TARGET_USER_GROUP}" + if [ "$?" -ne "0" ]; then + echo "[SEVERE] Unable to create group $TARGET_USER_GROUP" + exit 1 + fi + fi + else + REMOTE_GROUP_LIST+=("${TARGET_USER_GROUP}") + fi + ((USER_GROUP_INDEX++)) + done + + #check if rpm_oracle user exist, if not, create it + id "${RPM_ORCL_USR}" > /dev/null 2>&1; + if [ "$?" -ne "0" ]; then + #user doesn't exist, create it + useradd --uid "${RPM_ORCL_USR_ID}" --gid "${PRIMARY_USER_GROUP_NAME}" -G "${SECONDARY_USER_GROUPS_NAMES}" -M "${RPM_ORCL_USR}" + + if [ "$?" -ne "0" ]; then + echo "[SEVERE] Unable to create user $RPM_ORCL_USR" + exit 1 + fi + else + #If the user does exist then we check for the added groups + for TARGET_GROUP_NAME in "${USER_GROUP_NAMES[@]}" + do + getent group "${TARGET_GROUP_NAME}" | grep -w "${RPM_ORCL_USR}" > /dev/null + if [ "$?" -ne "0" ]; then + #If the user name is not currently part of the determined group,then we add it + /usr/sbin/usermod -a -G "${TARGET_GROUP_NAME}" "${RPM_ORCL_USR}" + + #Check for operation status + if [ "$?" -ne "0" ]; then + echo "[WARNING] Unable to add ${RPM_ORCL_USR} to $TARGET_GROUP_NAME group. Verify and add it manually. Not doing so may cause some features to not work properly due incorrect user privileges on the system." + fi + fi + done + fi + + #Verify that all the detected remote user groups were indeed added to the target user. Otherwise we flag the warning + for DETECTED_USER_GROUP in "${REMOTE_GROUP_LIST[@]}" + do + groups "${RPM_ORCL_USR}" | grep -q "\b${DETECTED_USER_GROUP}\b" + if [ "$?" -ne "0" ]; then + #The target user is not currently part not was added to a given remote group, therefore we need to flag it to the user + #It can proceed with no issues. + echo "[WARNING] The ${RPM_ORCL_USR} user couldn't be added to the ${DETECTED_USER_GROUP} group because such group is defined in a remote directory. It is recommended to complete this operation manually, not doing so may cause some features to not work properly due incorrect user privileges on the system." + fi + done + + if [ -f '/etc/oraInst.loc' ]; then + INVENTORY_GROUP_NAME=`cat /etc/oraInst.loc | grep -o ^inst_group=.* | sed -e 's/^inst_group=//'` + + echo "[INFO] Existing Oracle inventory detected. Currently owned by ${INVENTORY_GROUP_NAME}" >> $RPM_LOG_FILE + + #if the user name is not currently part of the determined group,then we add it + /usr/sbin/usermod -a -G "${INVENTORY_GROUP_NAME}" "${RPM_ORCL_USR}" + + #Check if indeed the user group was added to the oracle user + groups "${RPM_ORCL_USR}" | grep -q "\b${INVENTORY_GROUP_NAME}\b" + if [ "$?" -ne "0" ]; then + #The user group could not be added using the local command, therefore, we need to confirm that indeed is a remote (LDAP) group + getent group "${INVENTORY_GROUP_NAME}" >> /dev/null + if [ "$?" -eq "0" ]; then + echo "[WARNING] The ${RPM_ORCL_USR} user couldn't be added to the ${INVENTORY_GROUP_NAME} group because such group is defined in a remote directory. Verify and try again to register manually the Oracle home into the existing inventory." + else + echo "[WARNING] There was an issue when attempting to register the Oracle home into the existing inventory" + fi + fi + fi + + # Check and disallow installation of 12.2, if oracle home directory + # exists and is not empty + + if [ -d /opt/oracle/product/18c/dbhomeXE ]; then + if [ X"`ls -A /opt/oracle/product/18c/dbhomeXE`" != "X" ]; then + echo "[SEVERE] The install cannot proceed because the directory \"/opt/oracle/product/18c/dbhomeXE\" + is not empty. Remove its contents and retry the installation." + echo + exit 1 + fi + fi + + # Check and disallow if ORACLE_BASE directory /opt/oracle exists and not owned by oracle:oinstall + + if [ -d /opt/oracle ]; then + if [ "`ls -ld /opt/oracle | grep ^d | awk '{ print $3}'`" != "${RPM_ORCL_USR}" ]; then + echo + echo "[SEVERE] The install cannot proceed because ORACLE_BASE directory (/opt/oracle) +is not owned by \"${RPM_ORCL_USR}\" user. You must change the ownership of ORACLE_BASE + directory to \"$RPM_ORCL_USR\" user and retry the installation." + echo + exit 1 + fi + fi + + if [ -d /opt/oracle ]; then + if [ "`ls -ld /opt/oracle | grep ^d | awk '{ print $4}'`" != "${PRIMARY_USER_GROUP_NAME}" ]; then + echo + echo "[SEVERE] The install cannot proceed because ORACLE_BASE directory (/opt/oracle) +is not owned by \"${PRIMARY_USER_GROUP_NAME}\" group. You must change the ownership of + ORACLE_BASE directory to \"${PRIMARY_USER_GROUP_NAME}\" group and retry the installation." + echo + exit 1 + fi + fi + + # Check and change directory permissions to 755 if it is less at all the levels of the Oracle home path. + + if [ -d /opt/oracle ]; then + if test `stat -c "%a" /opt` -lt 755; then + chmod 755 /opt + fi + fi + + if [ -d /opt/oracle ]; then + if test `stat -c "%a" /opt/oracle` -lt 755; then + chmod 755 /opt/oracle + fi + fi + + if [ -d /opt/oracle/product ]; then + if test `stat -c "%a" /opt/oracle/product` -lt 755; then + chmod 755 /opt/oracle/product + fi + fi + + if [ -d /opt/oracle/product/18c ]; then + if test `stat -c "%a" /opt/oracle/product/18c` -lt 755; then + chmod 755 /opt/oracle/product/18c + fi + fi + + if [ -d /opt/oracle/product/18c/dbhomeXE ]; then + if test `stat -c "%a" /opt/oracle/product/18c/dbhomeXE` -lt 755; then + chmod 755 /opt/oracle/product/18c/dbhomeXE + fi + fi + + # Check and disallow for the required diskspace is not present on the system + if [ -d /opt/oracle ] + then + diskspace=`df -Pk /opt/oracle | grep % | tr -s " " | cut -d" " -f4 | tail -1` + diskspace=`expr $diskspace / 1024` + if [ $diskspace -lt 7680 ] + then + echo "[SEVERE] You have insufficient diskspace in the destination directory (/opt/oracle) +to install Oracle Database 18c Express Edition. The installation requires at + least 7680 MB free on this disk." + exit 1 + fi +elif [ -d /opt ] + then + diskspace=`df -k /opt | grep % | tr -s " " | cut -d" " -f4 | tail -1` + diskspace=`expr $diskspace / 1024` + if [ $diskspace -lt 7680 ] + then + echo "[SEVERE] You have insufficient diskspace in the destination directory (/opt) to +install Oracle Database 18c Express Edition. The installation requires at + least 7680 MB free on this disk." + exit 1 + fi + else + diskspace=`df -Pk / | grep % | tr -s " " | cut -d" " -f4 | tail -1` + diskspace=`expr $diskspace / 1024` + if [ $diskspace -lt 7680 ] + then + echo "[SEVERE] You have insufficient diskspace to install Oracle Database 18c Express Edition. + The installation requires at least 7680 MB free diskspace." + exit 1 + + fi + fi + + # Check and disallow install, if RAM is less than 1 GB + space=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'` + PhyMem=`expr $space / 1024` + swapspace=`free -m | grep Swap | awk '{print $4}'` + + if [ $PhyMem -lt 1024 ] + then + echo "[SEVERE] Oracle Database 18c Express Edition requires a minimum of 1GB of physical +memory (RAM). This system has $PhyMem MB of RAM and does not meet minimum + requirements." + echo + exit 1 + fi + + # Finally, we check for the docker-based installs that we disable the hard memlock parameter for the oracle user + # to assure that the post installation and database lifecycle in the environment. + if `env | grep -q ORACLE_DOCKER_INSTALL` + then + echo "[INFO] Container installation detected, adjusting corresponding parameters..." >> $RPM_LOG_FILE + target_security_file=/etc/security/limits.d/oracle-database-preinstall-18c.conf + + if [ -f $target_security_file ] + then + # Proceed to update the corresponding parameter + target_txt=`cat $target_security_file | grep -e 'oracle *hard *memlock*'` + `sed -i "/^$target_txt/ c#$target_txt" $target_security_file` + echo "[INFO] Container related settings updated" >> $RPM_LOG_FILE + else + echo "[WARNING] Container parameters not found, skipping parameters modification" + fi + fi + + # At the end we need to check that the RPM_ORCL_USR has the required su privilegies for the post install and + # further configuration actions for the Oracle Database. + su $RPM_ORCL_USR -c "echo Testing..." >> /dev/null + if [ $? -ne "0" ] + then + echo "[SEVERE] The su command is not configured properly or the $RPM_ORCL_USR user does not have the required privileges to install the Oracle database. If you are running in a Docker environment, ensure to set the environment variable ORACLE_DOCKER_INSTALL=true and try again."; + exit 1 + fi +} + +post_install(){ + RPM_LOG_FILE=/var/log/oracle-database-xe-18c/results/oraInstall.log; + INVENTORY_SETUP_ALREADY=false; + if [ -f '/etc/oraInst.loc' ]; then + INVENTORY_LOC=`cat /etc/oraInst.loc | grep -o ^inventory_loc=.* | sed -e 's/^inventory_loc=//'`; + echo "[INFO] Inventory located at: ${INVENTORY_LOC}" >> $RPM_LOG_FILE; + INVENTORY_SETUP_ALREADY=true; + else + INVENTORY_LOC='/opt/oracle/oraInventory'; + fi + INVENTORY_FILE="${INVENTORY_LOC}/ContentsXML/inventory.xml"; + SEQ=1; + MAX_VAL=0; + ORA_HOME_NAME_PREFIX='OraHome_'; + NEW_ORA_HOME_NAME='OraHomeXE'; + if [ -f "${INVENTORY_FILE}" ]; then + LAST_ORA_HOME_NAME=`cat ${INVENTORY_FILE} | grep -o 'NAME=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^NAME=["'"'"']//' -e 's/["'"'"']$//' | sort | uniq | tail -n 1`; + if [ ! -z "${LAST_ORA_HOME_NAME}" ]; then + MAX_VAL="${LAST_ORA_HOME_NAME//[!0-9]/}"; + if [ -z "${MAX_VAL}" ]; then + ORA_HOME_NAME_PREFIX="${LAST_ORA_HOME_NAME}_" + fi + SEQ="$(($MAX_VAL + 1))" + fi + NEW_ORA_HOME_NAME="$ORA_HOME_NAME_PREFIX$SEQ" + echo "[INFO] Oracle home name defined as: ${NEW_ORA_HOME_NAME}" >> $RPM_LOG_FILE; + fi + chown -R oracle:oinstall /opt/oracle + echo "[INFO] Registering Oracle home to the Oracle inventory..." >> $RPM_LOG_FILE; + su -c "/opt/oracle/product/18c/dbhomeXE/oui/bin/runInstaller.sh -silent -ignoreSysPrereqs -detachHome ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE ORACLE_BASE=/opt/oracle ORACLE_HOME_NAME=${NEW_ORA_HOME_NAME} INVENTORY_LOCATION=${INVENTORY_LOC} " >> /dev/null -m oracle + su -c "/opt/oracle/product/18c/dbhomeXE/oui/bin/runInstaller.sh -silent -ignoreSysPrereqs -attachHome ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE ORACLE_BASE=/opt/oracle ORACLE_HOME_NAME=${NEW_ORA_HOME_NAME} INVENTORY_LOCATION=${INVENTORY_LOC} " >> /dev/null -m oracle + if [ $? -ne "0" ]; then + echo "[SEVERE] An error occurred while registering the Oracle home. Verify logs in ${RPM_LOG_FILE} and ${INVENTORY_LOC} for more details and try again." + exit 1 + fi + echo "[INFO] Oracle home registered to the Oracle inventory." >> $RPM_LOG_FILE; + echo "[INFO] Executing post installation scripts...">> $RPM_LOG_FILE; + echo "[INFO] Executing post installation scripts..."; + if [ "$INVENTORY_SETUP_ALREADY" = "false" ]; then + echo "[INFO] Setting up inventory as it has not been setup on this machine." >> $RPM_LOG_FILE; + if [ -f "${INVENTORY_LOC}/orainstRoot.sh" ] + then + ${INVENTORY_LOC}/orainstRoot.sh >> /dev/null + fi + fi + /opt/oracle/product/18c/dbhomeXE/root.sh >> /dev/null + chmod 6751 /opt/oracle/product/18c/dbhomeXE/bin/oracle >> /dev/null + if [ "$INVENTORY_SETUP_ALREADY" = "false" ]; then + if [ -f "/etc/oratab" ] + then + chown -R oracle:oinstall /etc/oratab + fi + fi + echo "[INFO] Configuring ADR directories..." >> $RPM_LOG_FILE; + su -c "/opt/oracle/product/18c/dbhomeXE/bin/diagsetup clustercheck=false basedir=/opt/oracle oraclehome=/opt/oracle/product/18c/dbhomeXE " >> /dev/null -m oracle + if [ $? -ne "0" ]; then + echo "[SEVERE] An error occurred while configuring the ADR directories for the Oracle home. Verify the execution of the following command: /opt/oracle/product/18c/dbhomeXE/bin/diagsetup clustercheck=false basedir=/opt/oracle oraclehome=/opt/oracle/product/18c/dbhomeXE " + exit 1 + fi + echo "[INFO] ADR directories configured." >> $RPM_LOG_FILE; + echo "[INFO] Post installation scripts executed successfully." >> $RPM_LOG_FILE; + + echo "[INFO] Oracle home installed successfully and ready to be configured." >> $RPM_LOG_FILE; + echo "[INFO] Oracle home installed successfully and ready to be configured."; + echo "To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-18c.conf' and then execute '/etc/init.d/oracle-xe-18c configure' as root." +} + +pre_remove(){ + RPM_LOG_FILE=/var/log/oracle-database-xe-18c/results/oraInstall.log; + echo "[PRE-UNINSTALL]" >> $RPM_LOG_FILE; + echo "[INFO] Performing uninstall actions on Oracle home..." >> $RPM_LOG_FILE; + echo "$(date +%x-%r)" >> $RPM_LOG_FILE; + TMP_FOLDER='/tmp'; + FOLDER_NAME_FRM="deinstall_rsp_"; + SEQ=1; + IS_ENV_CLEAN=false; + SEARCH_RES=`find $TMP_FOLDER -maxdepth 1 -type d -name $FOLDER_NAME_FRM* | sort -t'_' -n -k3 | tail -n 1`; + if [ ! -z "$SEARCH_RES" ]; then + MAX_VAL="${SEARCH_RES//[!0-9]/}"; + SEQ="$(($MAX_VAL + 1))"; + fi + DEINST_FOLDER="$FOLDER_NAME_FRM$SEQ"; + mkdir -p "$TMP_FOLDER"/"$DEINST_FOLDER" + chmod -R 777 "$TMP_FOLDER" + echo "[INFO] Discovering configuration in Oracle home ..." >> $RPM_LOG_FILE; + if [ -f "/opt/oracle/product/18c/dbhomeXE/deinstall/deinstall" ]; then + su -c "/opt/oracle/product/18c/dbhomeXE/deinstall/deinstall -silent -checkonly -tmpdir $TMP_FOLDER/$DEINST_FOLDER > /dev/null" -m oracle + if [ $? -ne "0" ]; then + echo "[SEVERE] An error occured while discovering the configuration of the Oracle home. Verify the deinstall logs for more details." + exit 1 + fi + echo "[INFO] Configuration discovering completed ..." >> $RPM_LOG_FILE; + DEINST_SPEC_FILE=`find $TMP_FOLDER/$DEINST_FOLDER -type f -name *.rsp`; + if [ ! -z "$DEINST_SPEC_FILE" ]; then + LISTENERS_VALUE=`awk -F= -v key="NETCA_LOCAL_LISTENERS" '$1==key {print $2}' $DEINST_SPEC_FILE`; + DBS_VALUE=`awk -F= -v key="DB_UNIQUE_NAME_LIST" '$1==key {print $2}' $DEINST_SPEC_FILE`; + if [ -z "$LISTENERS_VALUE" ] && [ -z "$DBS_VALUE" ] + then + IS_ENV_CLEAN=true; + fi + else + echo "[SEVERE] Deinstall parameter file not found. Automatic deinstallation cannot proceed."; + exit 1 + fi + if [ "$IS_ENV_CLEAN" = true ]; then + echo "[INFO] Proceeding with RPM deinstallation ..." >> $RPM_LOG_FILE; + su -c "/opt/oracle/product/18c/dbhomeXE/oui/bin/detachHome.sh > /dev/null" -m oracle + if [ $? -ne "0" ]; then + echo "[SEVERE] An error occured while detaching the Oracle home from the inventory. Verify and try again." + exit 1 + fi + else + echo "[SEVERE] Database or a listener exists. To delete the database and the listener run '/etc/init.d/oracle-xe-18c delete' as root."; + exit 1 + fi + else + echo "[INFO] Oracle home software not found ..." >> $RPM_LOG_FILE + fi + echo "[INFO] Oracle home software removed successfully." >> $RPM_LOG_FILE +} + +post_remove(){ + if [ -f '/etc/oraInst.loc' ]; then + #Existing inventory found!! + INVENTORY_LOCATION=`cat /etc/oraInst.loc | grep -o ^inventory_loc=.* | sed -e 's/^inventory_loc=//'`; + INVENTORY_FILE="${INVENTORY_LOCATION}/ContentsXML/inventory.xml"; + #First validate if the inventory is already empty + if `grep -q '<HOME *NAME=' $INVENTORY_FILE`; then + #Registered homes found + if `grep -v '<HOME *NAME=.*LOC=\"/opt/oracle/.*REMOVED=\"T\"' $INVENTORY_FILE | grep -q '<HOME *NAME=.*LOC=\"/opt/oracle/'`; then + #Remove everything under RPM home; + rm -rf /opt/oracle/product/18c/dbhomeXE >> /dev/null; + grep -v '<HOME *NAME=.*LOC=\"/opt/oracle/product/18c.*REMOVED=\"T\"' $INVENTORY_FILE | grep -q '<HOME *NAME=.*LOC=\"/opt/oracle/product/18c' + if [ $? != 0 ];then + #Remove up to version location since there are no more homes registered to that product version + rm -rf /opt/oracle/product/18c >> /dev/null; + fi + else + #Cleaning oracle base with exception of oraInventory + rm -rf /opt/oracle/product/18c/dbhomeXE >> /dev/null; + ADMIN_FOLDER=/opt/oracle/admin; + if [ -d "$ADMIN_FOLDER" ] && [ -z "$(ls -A $ADMIN_FOLDER)" ]; then + rm -rf $ADMIN_FOLDER >> /dev/null; + fi + AUDIT_FOLDER=/opt/oracle/audit; + if [ -d "$AUDIT_FOLDER" ] && [ -z "$(ls -A $AUDIT_FOLDER)" ]; then + rm -rf $AUDIT_FOLDER >> /dev/null; + fi + CFGTOOLLOGS_FOLDER=/opt/oracle/cfgtoollogs; + if [ -d "$CFGTOOLLOGS_FOLDER" ] && [ -z "$(ls -A $CFGTOOLLOGS_FOLDER)" ]; then + rm -rf $CFGTOOLLOGS_FOLDER >> /dev/null; + fi + CHECKPOINTS_FOLDER=/opt/oracle/checkpoints; + if [ -d "$CHECKPOINTS_FOLDER" ] && [ -z "$(ls -A $CHECKPOINTS_FOLDER)" ]; then + rm -rf $CHECKPOINTS_FOLDER >> /dev/null; + fi + DIAG_FOLDER=/opt/oracle/diag; + #Using files to assure cross console env compatibility + if [ -d "$DIAG_FOLDER" ]; then + DIAG_EMPTY_LOG=/tmp/diag_empty_folders.tmp; + DIAG_FOLDER_LOG=/tmp/diag_folders.tmp; + find $DIAG_FOLDER/* -type d -empty > $DIAG_EMPTY_LOG; + find $DIAG_FOLDER/* -type d > $DIAG_FOLDER_LOG; + if [ -z "$(diff $DIAG_EMPTY_LOG $DIAG_FOLDER_LOG)" ]; then + rm -rf $DIAG_FOLDER >> /dev/null; + fi + rm -rf $DIAG_EMPTY_LOG >> /dev/null; + rm -rf $DIAG_FOLDER_LOG >> /dev/null; + fi + FRA_FOLDER=/opt/oracle/fast_recovery_area; + if [ -d "$FRA_FOLDER" ] && [ -z "$(ls -A $FRA_FOLDER)" ]; then + rm -rf $FRA_FOLDER >> /dev/null; + fi + ORADATA_FOLDER=/opt/oracle/oradata; + if [ -d "$ORADATA_FOLDER" ] && [ -z "$(ls -A $ORADATA_FOLDER)" ]; then + rm -rf $ORADATA_FOLDER >> /dev/null; + fi + PRODUCT_FOLDER=/opt/oracle/product; + #Using files to assure cross console env compatibility + if [ -d "$PRODUCT_FOLDER" ]; then + PRODUCT_EMPTY_LOG=/tmp/product_empty_folders.tmp; + PRODUCT_FOLDER_LOG=/tmp/product_folders.tmp; + find $PRODUCT_FOLDER/* -type d -empty > $PRODUCT_EMPTY_LOG; + find $PRODUCT_FOLDER/* -type d > $PRODUCT_FOLDER_LOG; + if [ -z "$(diff $PRODUCT_EMPTY_LOG $PRODUCT_FOLDER_LOG)" ]; then + rm -rf $PRODUCT_FOLDER >> /dev/null; + fi + rm -rf $PRODUCT_EMPTY_LOG >> /dev/null; + rm -rf $PRODUCT_FOLDER_LOG >> /dev/null; + fi + fi + else + #Can wipe everything + rm -rf /opt/oracle/product/18c/dbhomeXE >> /dev/null; + ADMIN_FOLDER=/opt/oracle/admin; + if [ -d "$ADMIN_FOLDER" ] && [ -z "$(ls -A $ADMIN_FOLDER)" ]; then + rm -rf $ADMIN_FOLDER >> /dev/null; + fi + AUDIT_FOLDER=/opt/oracle/audit; + if [ -d "$AUDIT_FOLDER" ] && [ -z "$(ls -A $AUDIT_FOLDER)" ]; then + rm -rf $AUDIT_FOLDER >> /dev/null; + fi + CFGTOOLLOGS_FOLDER=/opt/oracle/cfgtoollogs; + if [ -d "$CFGTOOLLOGS_FOLDER" ] && [ -z "$(ls -A $CFGTOOLLOGS_FOLDER)" ]; then + rm -rf $CFGTOOLLOGS_FOLDER >> /dev/null; + fi + CHECKPOINTS_FOLDER=/opt/oracle/checkpoints; + if [ -d "$CHECKPOINTS_FOLDER" ] && [ -z "$(ls -A $CHECKPOINTS_FOLDER)" ]; then + rm -rf $CHECKPOINTS_FOLDER >> /dev/null; + fi + DIAG_FOLDER=/opt/oracle/diag; + #Using files to assure cross console env compatibility + if [ -d "$DIAG_FOLDER" ]; then + DIAG_EMPTY_LOG=/tmp/diag_empty_folders.tmp; + DIAG_FOLDER_LOG=/tmp/diag_folders.tmp; + find $DIAG_FOLDER/* -type d -empty > $DIAG_EMPTY_LOG; + find $DIAG_FOLDER/* -type d > $DIAG_FOLDER_LOG; + if [ -z "$(diff $DIAG_EMPTY_LOG $DIAG_FOLDER_LOG)" ]; then + rm -rf $DIAG_FOLDER >> /dev/null; + fi + rm -rf $DIAG_EMPTY_LOG >> /dev/null; + rm -rf $DIAG_FOLDER_LOG >> /dev/null; + fi + FRA_FOLDER=/opt/oracle/fast_recovery_area; + if [ -d "$FRA_FOLDER" ] && [ -z "$(ls -A $FRA_FOLDER)" ]; then + rm -rf $FRA_FOLDER >> /dev/null; + fi + ORADATA_FOLDER=/opt/oracle/oradata; + if [ -d "$ORADATA_FOLDER" ] && [ -z "$(ls -A $ORADATA_FOLDER)" ]; then + rm -rf $ORADATA_FOLDER >> /dev/null; + fi + PRODUCT_FOLDER=/opt/oracle/product; + #Using files to assure cross console env compatibility + if [ -d "$PRODUCT_FOLDER" ]; then + PRODUCT_EMPTY_LOG=/tmp/product_empty_folders.tmp; + PRODUCT_FOLDER_LOG=/tmp/product_folders.tmp; + find $PRODUCT_FOLDER/* -type d -empty > $PRODUCT_EMPTY_LOG; + find $PRODUCT_FOLDER/* -type d > $PRODUCT_FOLDER_LOG; + if [ -z "$(diff $PRODUCT_EMPTY_LOG $PRODUCT_FOLDER_LOG)" ]; then + rm -rf $PRODUCT_FOLDER >> /dev/null; + fi + rm -rf $PRODUCT_EMPTY_LOG >> /dev/null; + rm -rf $PRODUCT_FOLDER_LOG >> /dev/null; + fi + + rm -rf $INVENTORY_LOCATION >> /dev/null; + + ORACLE_BASE=/opt/oracle; + if [ -z "$(ls -A $ORACLE_BASE)" ]; then + rm -rf $ORACLE_BASE >> /dev/null; + fi + fi + fi + + #Also remove the corresponding RPM log location + rm -rf /var/log/oracle-database-xe-18c >> /dev/null + rm -fr /usr/share/doc/oracle-xe-18c >> /dev/null +} diff --git a/oracle-xe.service b/oracle-xe.service index 92c3f12e0811..e84e5e6b72b0 100644 --- a/oracle-xe.service +++ b/oracle-xe.service @@ -3,6 +3,6 @@ Description=Oracle XE [Service] Type=oneshot -ExecStart=/etc/rc.d/oracle-xe start -ExecStop=/etc/rc.d/oracle-xe stop +ExecStart=/etc/rc.d/oracle-xe-18c start +ExecStop=/etc/rc.d/oracle-xe-18c stop RemainAfterExit=yes diff --git a/oracle.install b/oracle.install deleted file mode 100644 index 6bc18a8d55b0..000000000000 --- a/oracle.install +++ /dev/null @@ -1,118 +0,0 @@ -post_install() { - if [ -e `grep dba /etc/group` ]; then - echo - echo -n "creating group \"dba\" ..." - groupadd dba - echo "done" - echo - fi - - if [ -e `grep oracle /etc/passwd` ]; then - echo -n "creating user \"oracle\" ..." - useradd -d /usr/lib/oracle -g dba -s /bin/false oracle - echo "done" - echo - fi - - echo -n "change directory rights ..." - chown -R oracle:dba /usr/lib/oracle - echo "done" - echo - - echo -n "set sticky bit to oracle executable ..." - chmod 6755 /usr/lib/oracle/product/11.2.0/xe/bin/oracle - echo "done" - echo - - if [ ! -d /etc/sysconfig ]; then - echo -n "creating /etc/sysconfig ..." - mkdir /etc/sysconfig - echo "done" - echo - fi - - if [ ! -d /var/log/oracle ]; then - echo -n "creating /var/log/oracle ..." - mkdir /var/log/oracle - chown -R oracle:dba /var/log/oracle - echo "done" - echo - fi - - availphymem=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'` - availphymem=`echo $availphymem / 1024 | bc` - memory_target=`echo 0.40 \* $availphymem | bc | sed "s/\..*//"` - if [ $memory_target -gt 1024 ]; - then - memory_target=`echo 1024 \* 1048576 | bc` - else - memory_target=`echo $memory_target \* 1048576 | bc` - fi - - /bin/sed -i "s/%memory_target%/$memory_target/g" /usr/lib/oracle/product/11.2.0/xe/config/scripts/init.ora - /bin/sed -i "s/%memory_target%/$memory_target/g" /usr/lib/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora - - echo - echo "add your user to the \"dba\" group in order to use the oracle tools" - echo "run \"/etc/rc.d/oracle-xe configure\" to configure oracle-xe and start using it" - echo -} - -post_remove() { - - if [ `grep oracle /etc/passwd` ]; then - echo -n "remove user \"oracle\" ..." - userdel oracle - echo "done" - fi - - if [ `grep dba /etc/group` ]; then - echo -n "remove group \"dba\" ..." - groupdel dba - echo "done" - fi - - if [ -f /etc/rc.d/oracle-xe ]; then - echo -n "remove /etc/rc.d/oracle-xe ..." - rm /etc/rc.d/oracle-xe - echo "done" - fi - - if [ -f /etc/oratab ]; then - echo -n "remove /etc/oratab ..." - rm /etc/oratab - echo "done" - fi - - if [ -d /etc/sysconfig ]; then - - if [ -f /etc/sysconfig/oracle-xe ]; then - echo -n "remove /etc/sysconfig/oracle-xe ..." - rm -rf /etc/sysconfig/oracle-xe - echo "done" - fi - - if [ `ls /etc/sysconfig/|wc -l` -eq 0 ]; then - echo -n "remove /etc/sysconfig ..." - rm -rf /etc/sysconfig - echo "done" - fi - fi - if [ -f /etc/default/oracle-xe ]; then - echo -n "remove /etc/default/oracle-xe ..." - rm -rf /etc/default/oracle-xe - echo "done" - fi - - if [ -d /usr/lib/oracle ]; then - echo -n "remove /usr/lib/oracle ..." - rm -rf /usr/lib/oracle - echo "done" - fi - - if [ -d /var/log/oracle ]; then - echo -n "remove /var/log/oracle ..." - rm -rf /var/log/oracle - echo "done" - fi -} diff --git a/oracle_env.csh b/oracle_env.csh index 25501df8d1d6..7d9e86e84767 100644 --- a/oracle_env.csh +++ b/oracle_env.csh @@ -1,4 +1,3 @@ -setenv ORACLE_HOME /usr/lib/oracle/product/11.2.0/xe +setenv ORACLE_HOME /opt/oracle/product/18c/dbhomeXE setenv ORACLE_SID XE -setenv NLS_LANG `$ORACLE_HOME/bin/nls_lang.sh` setenv PATH $PATH:$ORACLE_HOME/bin diff --git a/oracle_env.sh b/oracle_env.sh index fb01848c9487..b9d6dcff3ed6 100644 --- a/oracle_env.sh +++ b/oracle_env.sh @@ -1,4 +1,3 @@ -export ORACLE_HOME=/usr/lib/oracle/product/11.2.0/xe +export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE export ORACLE_SID=XE -export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh` export PATH=$PATH:$ORACLE_HOME/bin |