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
=/usr
/lib
/oracle
/xe
/app
/oracle
/product
/10.2.0/server
16 LSNR
=$ORACLE_HOME/bin
/lsnrctl
17 SQLPLUS
=$ORACLE_HOME/bin
/sqlplus
21 export PATH
=$ORACLE_HOME/bin
:$PATH
22 LOG
="$ORACLE_HOME_LISTNER/listener.log"
26 if [ $
(id
-u) != "0" ]
28 echo "You must be root to run the configure script. Login as root and then run the configure script."
33 CONFIGURATION
="/etc/sysconfig/$CONFIG_NAME"
35 if [ -f /etc
/arch-release
]
62 # Source configuration
64 [ -f "$CONFIGURATION" ] && .
"$CONFIGURATION"
71 # Evaluates return codes. If 0, prints "OK", if 1, prints "Failed"
72 # and exits. If 2, status is "already done" and nothing is printed.
73 # The rest of the functions in here all honor this convention.
85 failure_status
"${REASON}"
93 # Writes the system configuration
97 cat >"$CONFIGURATION" <<EOF
99 #This is a configuration file for automatic starting of the Oracle
100 #Database and listener at system startup.It is generated By running
101 #'/etc/init.d/oracle-xe configure'.Please use that method to modify this
104 # ORACLE_DBENABLED:'true' means to load the Database at system boot.
105 ORACLE_DBENABLED=${ORACLE_DBENABLED:-false}
107 # LISTENER_PORT: Database listener
108 LISTENER_PORT=${LISTENER_PORT}
110 # HTTP_PORT : HTTP port for Oracle Application Express
111 HTTP_PORT=${HTTP_PORT}
113 # Configuration : Check whether configure has been done or not
114 CONFIGURE_RUN=${CONFIGURE_RUN}
128 # configure_perform()
130 # Instantantiate listener.ora,tnsnames.ora,and create the database,
131 # sets the password,start the listener,and adds database to inittab
134 configure_perform
() {
136 sed -i "s/%sga_target%/$SGA_SIZE/g" $ORACLE_HOME/config
/scripts
/init.ora
137 sed -i "s/%pga_aggregate_target%/$PGA_SIZE/g" $ORACLE_HOME/config
/scripts
/init.ora
138 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/init.ora
140 sed -i "s/%sga_target%/$SGA_SIZE/g" $ORACLE_HOME/config
/scripts
/initXETemp.ora
141 sed -i "s/%pga_aggregate_target%/$PGA_SIZE/g" $ORACLE_HOME/config
/scripts
/initXETemp.ora
142 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/initXETemp.ora
144 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network
/admin
/listener.ora
145 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network
/admin
/listener.ora
146 /bin
/chown oracle
:dba
$ORACLE_HOME/network
/admin
/listener.ora
148 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network
/admin
/tnsnames.ora
149 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network
/admin
/tnsnames.ora
150 /bin
/chown oracle
:dba
$ORACLE_HOME/network
/admin
/tnsnames.ora
152 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/postDBCreation.sql
153 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/postDBCreation.sql
155 if test $LISTENER_PORT -ne 1521
157 if [ -f /tmp
/local_listener
]
159 cat >/tmp
/local_listener$$
<<EOF
160 ###########################################
161 # Registration of instance with listsner
162 ###########################################
163 local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
165 /bin
/chmod 664 /tmp
/local_listener$$
166 cat /tmp
/local_listener$$
>> $ORACLE_HOME/config
/scripts
/init.ora
168 cat >/tmp
/local_listener
<<EOF
169 ###########################################
170 # Registration of instance with listsner
171 ###########################################
172 local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
174 /bin
/chmod 664 /tmp
/local_listener
175 cat /tmp
/local_listener
>> $ORACLE_HOME/config
/scripts
/init.ora
178 if test -f /tmp
/local_listener
180 rm -fr /tmp
/local_listener
181 elif test -f /tmp
/local_listener$$
183 rm -fr /tmp
/local_listener$$
186 sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/config
/scripts
/init.ora
187 sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/config
/scripts
/init.ora
188 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/init.ora
192 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/DatabaseHomePage.sh
193 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/DatabaseHomePage.sh
195 sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config
/scripts
/readonlinehelp.sh
196 /bin
/chown oracle
:dba
$ORACLE_HOME/config
/scripts
/readonlinehelp.sh
199 if [ "$homedir" = "/root" ]
201 homedir
=`sh -c "echo ~$USER"`
204 if [ -f $homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
]
206 /bin
/chown oracle
:dba
$homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
207 /bin
/chmod 664 $homedir/.gnome-desktop
/oraclexe-gettingstarteddesktop.desktop
209 if [ -f $homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
]
211 /bin
/chown oracle
:dba
$homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
212 /bin
/chmod 664 $homedir/Desktop
/oraclexe-gettingstarteddesktop.desktop
215 if [ -f $ORACLE_HOME/bin
/tnslsnr
]
217 echo -n "Starting Oracle Net Listener..."
218 $SU -s /bin
/bash
$ORACLE_OWNER -c "$LSNR start" ## > /dev/null 2>&1
222 echo -n "Configuring Database..."
223 $SU -s /bin
/bash
$ORACLE_OWNER -c "$ORACLE_HOME/config/scripts/XE.sh" ## > /dev/null 2>&1
224 err
=`grep "ORA-44410" $ORACLE_HOME/config/log/*.log`
227 echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details"
230 echo alter user sys identified by
\"$ORACLE_PASSWORD\"\
; |
$SU -s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" ## > /dev/null 2>&1
231 echo alter user system identified by
\"$ORACLE_PASSWORD\"\
; |
$SU -s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" ## > /dev/null 2>&1
234 /bin
/chmod -R 640 /usr
/lib
/oracle
/xe
/oradata
/XE
235 /bin
/chmod 750 /usr
/lib
/oracle
/xe
/oradata
/XE
236 rm -fr $ORACLE_HOME/config
/seeddb
238 if [ -f /etc
/oratab
]
240 echo "XE:$ORACLE_HOME:N" >> /etc
/oratab
242 echo "XE:$ORACLE_HOME:N" >> /etc
/oratab
243 /bin
/chown oracle
:dba
/etc
/oratab
244 /bin
/chmod 644 /etc
/oratab
247 echo -n "Starting Oracle Database 10g Express Edition Instance..."
248 pmon
=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep`
252 $SU -s /bin
/bash
$ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" ## > /dev/null 2>&1
256 echo "Installation Completed Successfully."
265 # Ask configuration questions,setting the variables.
271 Oracle Database 10g Express Edition Configuration
272 -------------------------------------------------
273 This will configure on-boot properties of Oracle Database 10g Express
274 Edition. The following questions will determine whether the database should
275 be starting upon system boot, the ports it will use, and the passwords that
276 will be used for database accounts. Press <Enter> to accept the defaults.
281 #get the http port value
286 echo -n Specify the HTTP port that will be used
for Oracle Application Express
[8080]:
292 port
=`netstat -n --tcp --listen | grep :$LINE | awk '{print $4}' | cut -d':' -f2`
293 if [ "$port" = "$LINE" ]
295 echo Port
$port appears to be
in use by another application.\
296 Please specify a different port.
307 echo "Invalid http port: $LINE"
316 #get the listener port value
322 echo -n Specify a port that will be used
for the database listener
[1521]:
329 port
=`netstat -n --tcp --listen | grep :$LINE | awk '{print $4}' | cut -d':' -f2`
330 if [ "$port" = "$LINE" ]
332 echo Port
$port appears to be
in use by another application.\
333 Please specify a different port.
344 echo "Invalid port: $LINE" >&2
347 if [ "$HTTP_PORT" != "$LINE" ]
352 echo Database listener cannot be configured on the same port as Oracle Application Express.
364 echo -n Specify your sga size
[128M
]:
386 #get the pga_aggregate_target size
392 echo -n Specify your pga size
[96M
]:
414 #get the database password
417 echo -n "Specify a password to be used for database accounts. Note that the same
418 password will be used for SYS and SYSTEM. Oracle recommends the use of
419 different passwords for each database account. This can be done after
420 initial configuration:"
423 /bin
/stty
-echo ## > /dev/null 2>&1
432 echo -n "Password can't be null. Enter password:"
436 result
=`expr index "$LINE" [\'\"]`
440 echo -n "The password you entered contains invalid characters. Enter password:"
446 echo -n "Confirm the password:"
449 if [ "$LINE" != "$LINE1" ];
452 echo -n "Passwords do not match. Enter the password:"
457 /bin
/stty
echo ## > /dev/null 2>&1
458 ORACLE_PASSWORD
=$LINE
463 if [ "$ORACLE_DBENABLED" = "true" ]
470 ORACLE_DBENABLED
=true
480 echo To access the Database Home Page go to
\"http
://127.0.0.1:$HTTP_PORT/apex
\"