3 # Set path if path not set (if called from /etc/rc)
5 "") PATH
=/bin
:/usr
/bin
:/sbin
:/etc
10 SAVE_LLP
=$LD_LIBRARY_PATH
13 ORACLE_HOME
=/u01
/app
/oracle
/product
/11.2.0/xe
14 ORACLE_BASE
=/u01
/app
/oracle
17 LSNR
=$ORACLE_HOME/bin
/lsnrctl
18 SQLPLUS
=$ORACLE_HOME/bin
/sqlplus
23 export PATH
=$ORACLE_HOME/bin
:$PATH
24 LOG
="$ORACLE_HOME_LISTNER/listener.log"
28 if [ $
(id
-u) != "0" ]
30 echo "You must be root to run the configure script. Login as root and then run the configure script."
35 CONFIGURATION
="/etc/sysconfig/$CONFIG_NAME"
37 if [ -f /etc
/arch-release
]
64 # Source configuration
66 [ -f "$CONFIGURATION" ] && .
"$CONFIGURATION"
73 # Evaluates return codes. If 0, prints "OK", if 1, prints "Failed"
74 # and exits. If 2, status is "already done" and nothing is printed.
75 # The rest of the functions in here all honor this convention.
87 failure_status
"${REASON}"
95 # Writes the system configuration
99 cat >"$CONFIGURATION" <<EOF
101 #This is a configuration file for automatic starting of the Oracle
102 #Database and listener at system startup.It is generated By running
103 #'/etc/init.d/oracle-xe configure'.Please use that method to modify this
106 # ORACLE_DBENABLED:'true' means to load the Database at system boot.
107 ORACLE_DBENABLED=${ORACLE_DBENABLED:-false}
109 # LISTENER_PORT: Database listener
110 LISTENER_PORT=${LISTENER_PORT}
112 # HTTP_PORT : HTTP port for Oracle Application Express
113 HTTP_PORT=${HTTP_PORT}
115 # Configuration : Check whether configure has been done or not
116 CONFIGURE_RUN=${CONFIGURE_RUN}
130 # configure_perform()
132 # Instantantiate listener.ora,tnsnames.ora,and create the database,
133 # sets the password,start the listener,and adds database to inittab
139 sed -i "s/%sga_target%/$SGA_SIZE/g" $ORACLE_HOME/config
/scripts
/init.ora
140 sed -i "s/%pga_aggregate_target%/$PGA_SIZE/g" $ORACLE_HOME/config
/scripts
/init.ora
141 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/init.ora
143 sed -i "s/%sga_target%/$SGA_SIZE/g" $ORACLE_HOME/config
/scripts
/initXETemp.ora
144 sed -i "s/%pga_aggregate_target%/$PGA_SIZE/g" $ORACLE_HOME/config
/scripts
/initXETemp.ora
145 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/initXETemp.ora
147 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network
/admin
/listener.ora
148 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network
/admin
/listener.ora
149 /bin
/chown oracle
:dba
$ORACLE_HOME/network
/admin
/listener.ora
151 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network
/admin
/tnsnames.ora
152 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network
/admin
/tnsnames.ora
153 /bin
/chown oracle
:dba
$ORACLE_HOME/network
/admin
/tnsnames.ora
155 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/postDBCreation.sql
156 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/postDBCreation.sql
158 if test $LISTENER_PORT -ne 1521
160 if [ -f /tmp
/local_listener
]
162 cat >/tmp
/local_listener$$
<<EOF
163 ###########################################
164 # Registration of instance with listsner
165 ###########################################
166 local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
168 /bin
/chmod 664 /tmp
/local_listener$$
169 cat /tmp
/local_listener$$
>> $ORACLE_HOME/config
/scripts
/init.ora
171 cat >/tmp
/local_listener
<<EOF
172 ###########################################
173 # Registration of instance with listsner
174 ###########################################
175 local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
177 /bin
/chmod 664 /tmp
/local_listener
178 cat /tmp
/local_listener
>> $ORACLE_HOME/config
/scripts
/init.ora
181 if test -f /tmp
/local_listener
183 rm -fr /tmp
/local_listener
184 elif test -f /tmp
/local_listener$$
186 rm -fr /tmp
/local_listener$$
189 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/config
/scripts
/init.ora
190 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/config
/scripts
/init.ora
191 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/init.ora
195 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/gettingstarted.sh
196 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/gettingstarted.sh
198 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/readonlinehelp.sh
199 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/readonlinehelp.sh
202 if [ "$homedir" = "/root" ]
204 homedir
=`sh -c "echo ~$USER"`
207 if [ -f $homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
]
209 /bin
/chown oracle
:dba
$homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
210 /bin
/chmod 664 $homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
212 if [ -f $homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
]
214 /bin
/chown oracle
:dba
$homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
215 /bin
/chmod 664 $homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
218 if [ -f $ORACLE_HOME/bin
/tnslsnr
]
220 echo -n "Starting Oracle Net Listener..."
221 su
-s /bin
/bash
$ORACLE_OWNER -c "$LSNR start" > /dev
/null
2>&1
225 echo -n "Configuring database..."
226 su
-s /bin
/bash
$ORACLE_OWNER -c "$ORACLE_HOME/config/scripts/XE.sh" > /dev
/null
2>&1
227 if [ -d $ORACLE_HOME/config
/log
]
229 err
=`grep "ORA-44410" $ORACLE_HOME/config/log/*.log`
230 out
=`grep "ORA-01034" $ORACLE_HOME/config/log/*.log`
231 if [ "$err" != "" ] ||
[ "$out" != "" ]
234 echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details"
239 pmon
=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep`
244 echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details"
248 echo alter user sys identified by
\"$ORACLE_PASSWORD\"\
; | su
-s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev
/null
2>&1
249 echo alter user system identified by
\"$ORACLE_PASSWORD\"\
; | su
-s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev
/null
2>&1
251 echo @
$ORACLE_HOME/apex
/apxxepwd.sql
\"$ORACLE_PASSWORD\"\
; | su
-s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev
/null
2>&1
254 /bin
/chmod -R 640 /u01
/app
/oracle
/oradata
/XE
255 /bin
/chmod 750 /u01
/app
/oracle
/oradata
/XE
256 /bin
/chmod -R 775 /u01
/app
/oracle
/diag
257 rm -fr $ORACLE_HOME/config
/seeddb
259 if [ -f /etc
/oratab
]
261 echo "XE:$ORACLE_HOME:N" >> /etc
/oratab
263 echo "XE:$ORACLE_HOME:N" >> /etc
/oratab
264 /bin
/chown oracle
:dba
/etc
/oratab
265 /bin
/chmod 664 /etc
/oratab
268 echo -n "Starting Oracle Database 11g Express Edition instance..."
269 pmon
=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep`
273 su
-s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev
/null
2>&1
277 echo "Installation completed successfully."
286 # Ask configuration questions,setting the variables.
293 Oracle Database 11g Express Edition Configuration
294 -------------------------------------------------
295 This will configure on-boot properties of Oracle Database 11g Express
296 Edition. The following questions will determine whether the database should
297 be starting upon system boot, the ports it will use, and the passwords that
298 will be used for database accounts. Press <Enter> to accept the defaults.
302 #get the http port value
307 echo -n Specify the HTTP port that will be used
for Oracle Application Express
[8080]:
314 port
=`netstat -n --tcp --listen | grep :$LINE | awk -F: '{print $4}' | sed 's/ //g'`
315 if [ "$port" = "$LINE" ]
320 echo "Port $LINE appears to be in use by another application. Specify a different
321 port and retry the configuration."
322 trap "rm -fr $1" exit
325 echo "Port $port appears to be in use by another application. Specify a different port."
336 echo "Invalid http port: $LINE"
345 #get the listener port value
350 echo -n Specify a port that will be used
for the database listener
[1521]:
357 port
=`netstat -n --tcp --listen | grep :$LINE | awk -F: '{print $4}' | sed 's/ //g'`
358 if [ "$port" = "$LINE" ]
363 echo "Port $LISTENER_PORT appears to be in use by another application. Specify a different
364 port and retry the configuration."
365 trap "rm -fr $1" exit
368 echo Port
$port appears to be
in use by another application.\
369 Specify a different port.
380 echo "Invalid port: $LINE" >&2
383 if [ "$HTTP_PORT" != "$LINE" ]
388 echo Database listener cannot be configured on the same port as Oracle Application Express.
400 echo -n Specify your sga size
[128M
]:
422 #get the pga_aggregate_target size
428 echo -n Specify your pga size
[96M
]:
450 #get the database password
453 echo -n "Specify a password to be used for database accounts. Note that the same
454 password will be used for SYS and SYSTEM. Oracle recommends the use of
455 different passwords for each database account. This can be done after
456 initial configuration:"
459 /bin
/stty
-echo > /dev
/null
2>&1
468 echo -n "Password can't be null. Enter password:"
472 result
=`expr index "$LINE" [\'\"]`
476 echo -n "The password you entered contains invalid characters. Enter password:"
482 echo -n "Confirm the password:"
485 if [ "$LINE" != "$LINE1" ];
490 echo "Passwords do not match. Specify the same password for both ORACLE_PASSSWORD and
491 ORACLE_CONFIRM_PASSWORD, and retry the configuration."
492 trap "rm -fr $1" exit
496 echo -n "Passwords do not match. Enter the password:"
501 /bin
/stty
echo > /dev
/null
2>&1
502 ORACLE_PASSWORD
=$LINE
509 if [ "$ORACLE_DBENABLED" = "true" ]
516 echo -n "Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:"
520 ORACLE_DBENABLED
=true
528 ORACLE_DBENABLED
=true
532 ORACLE_DBENABLED
=false
536 echo "Invalid response: $LINE " >&2
543 if test -f "$CONFIGURATION"
545 echo "Oracle Database 11g Express Edition is already configured"
552 echo To access the Database Home Page go to
\"http
://127.0.0.1:$HTTP_PORT/apex
\"