summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheLoko2015-11-12 23:28:16 +0100
committerTheLoko2015-11-12 23:28:16 +0100
commit2dbb05382384ffd65f6242be3739d71d28b5e22e (patch)
tree243403706f88dc1bfd846407efbf01dca5b6837a
downloadaur-2dbb05382384ffd65f6242be3739d71d28b5e22e.tar.gz
Initial import
-rw-r--r--.SRCINFO36
-rw-r--r--PKGBUILD87
-rw-r--r--listener.ora20
-rw-r--r--oracle-xe777
-rw-r--r--oracle-xe.conf1
-rw-r--r--oracle-xe.service8
-rw-r--r--oracle.install119
-rw-r--r--oracle_env.csh4
-rw-r--r--oracle_env.sh4
9 files changed, 1056 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..090dec0a693e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,36 @@
+pkgbase = oracle-xe
+ pkgdesc = a non free DBMS
+ pkgver = 11.2.0_1.0
+ pkgrel = 2
+ url = http://www.oracle.com/
+ install = oracle.install
+ arch = x86_64
+ license = custom
+ makedepends = rpmextract
+ 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 = 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 = oracle_env.csh
+ source = oracle_env.sh
+ source = oracle-xe
+ source = oracle-xe.conf
+ source = listener.ora
+ source = oracle-xe.service
+ md5sums = dd7881a55569d890241f11cd0eeb7d48
+ md5sums = 52787ddc5b4c326f333b0a250bb458fa
+ md5sums = 5dfe9321cb6db2547de95c58546309f8
+ md5sums = e558d7dcb9e455f8cb03db8638832774
+ md5sums = 5a3eaff3cb867d97cd250f04fe372ae7
+ md5sums = 4d4a2e1bcc29b9c1fd197b42ccc4e0ac
+ md5sums = 3dd923ac2df9fd38827fc9fc0048273a
+
+pkgname = oracle-xe
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..98905de4e0da
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,87 @@
+# Mantainer: The_Loko <juliolokoo at gmail dot com>
+# Contributor: Tinh Truong <xuantinh at gmail dot com>
+# Contributor: Cedric Sougne <cedric@sougne.name>
+# Contributor: untseac
+# Contributor: siasia
+# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>
+
+pkgname=oracle-xe
+pkgver=11.2.0_1.0
+pkgrel=2
+pkgdesc="a non free DBMS"
+url="http://www.oracle.com/"
+license=('custom')
+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')
+makedepends=('rpmextract')
+install='oracle.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'
+ )
+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.;/usr/bin/echo Please visit http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html.; exit 1;')
+md5sums=('dd7881a55569d890241f11cd0eeb7d48'
+ '52787ddc5b4c326f333b0a250bb458fa'
+ '5dfe9321cb6db2547de95c58546309f8'
+ 'e558d7dcb9e455f8cb03db8638832774'
+ '5a3eaff3cb867d97cd250f04fe372ae7'
+ '4d4a2e1bcc29b9c1fd197b42ccc4e0ac'
+ '3dd923ac2df9fd38827fc9fc0048273a'
+ )
+
+build() {
+ cd $srcdir
+ rpmextract.sh Disk1/oracle-xe-11.2.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
+
+ mkdir -p $pkgdir/usr/lib
+ mv $srcdir/u01/app/oracle $pkgdir/usr/lib/
+
+ # Fix the listener.ora
+ cp -f $srcdir/listener.ora $pkgdir/usr/lib/oracle/product/11.2.0/xe/network/admin/
+
+ find $pkgdir -exec chmod 755 {} \;
+
+ # Export environment variables
+ mkdir -p $pkgdir/etc/profile.d
+ cp $srcdir/oracle_env.* $pkgdir/etc/profile.d/
+ chmod +x $pkgdir/etc/profile.d/oracle_env.*
+
+ # Desktop files
+ cp -a $srcdir/usr $pkgdir
+
+ # LD_LIBRARY_PATH
+ mkdir -p $pkgdir/etc/ld.so.conf.d/
+ cp $srcdir/oracle-xe.conf $pkgdir/etc/ld.so.conf.d/
+
+ # 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.*
+
+ # For systemd
+ mkdir -p $pkgdir/etc/systemd/system
+ cp $srcdir/oracle-xe.service $pkgdir/etc/systemd/system
+}
diff --git a/listener.ora b/listener.ora
new file mode 100644
index 000000000000..cb53cc7dfe86
--- /dev/null
+++ b/listener.ora
@@ -0,0 +1,20 @@
+# 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
new file mode 100644
index 000000000000..8c4309906f7b
--- /dev/null
+++ b/oracle-xe
@@ -0,0 +1,777 @@
+#!/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.conf b/oracle-xe.conf
new file mode 100644
index 000000000000..f47da8171004
--- /dev/null
+++ b/oracle-xe.conf
@@ -0,0 +1 @@
+/usr/lib/oracle/product/11.2.0/xe/lib \ No newline at end of file
diff --git a/oracle-xe.service b/oracle-xe.service
new file mode 100644
index 000000000000..92c3f12e0811
--- /dev/null
+++ b/oracle-xe.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Oracle XE
+
+[Service]
+Type=oneshot
+ExecStart=/etc/rc.d/oracle-xe start
+ExecStop=/etc/rc.d/oracle-xe stop
+RemainAfterExit=yes
diff --git a/oracle.install b/oracle.install
new file mode 100644
index 000000000000..bd57305a01ef
--- /dev/null
+++ b/oracle.install
@@ -0,0 +1,119 @@
+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 -g dba 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
+}
+
+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
new file mode 100644
index 000000000000..97ca5a86341c
--- /dev/null
+++ b/oracle_env.csh
@@ -0,0 +1,4 @@
+setenv ORACLE_HOME /usr/lib/oracle/product/11.2.0/xe
+setenv ORACLE_SID XE
+setenv NLS_LANG `$ORACLE_HOME/bin/nls_lang.sh`
+setenv PATH $ORACLE_HOME/bin:$PATH
diff --git a/oracle_env.sh b/oracle_env.sh
new file mode 100644
index 000000000000..db9ac28e0cd7
--- /dev/null
+++ b/oracle_env.sh
@@ -0,0 +1,4 @@
+export ORACLE_HOME=/usr/lib/oracle/product/11.2.0/xe
+export ORACLE_SID=XE
+export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
+export PATH=$ORACLE_HOME/bin:$PATH