docker-oracle-xe-11g icon indicating copy to clipboard operation
docker-oracle-xe-11g copied to clipboard

First run takes long time on startup.

Open Solisol opened this issue 9 years ago • 4 comments

Since the last update, we have discovered that the startup of the container the first time takes several minutes, compared to starting later on which takes seconds. This have been tested on newly started, clean amazon instances.

Commands run:

docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
docker exec -it <name> bash

When trying to access the db with

sqlplus system/oracle

we get the following error messages

SQL*Plus: Release 11.2.0.2.0 Production on Thu May 7 07:43:10 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0

First startup

Thu May 07 00:00:45 2015 ALTER DATABASE OPEN Thu May 07 00:06:16 2015 Thread 1 opened at log sequence 3 Current log# 1 seq# 3 mem# 0: /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_1_bbqv44l7_.log Successful open of redo thread 1 Thu May 07 00:06:16 2015 SMON: enabling cache recovery Thu May 07 00:06:17 2015 [100] Successfully onlined Undo Tablespace 2. Undo initialization finished serial:0 start:173426 end:173646 diff:220 (2 seconds) Verifying file header compatibility for 11g tablespace encryption.. Verifying 11g file header compatibility for tablespace encryption completed SMON: enabling tx recovery Database Characterset is AL32UTF8 Opening with Resource Manager plan: INTERNAL_PLAN_XE Thu May 07 00:06:17 2015 Starting background process VKRM Thu May 07 00:06:17 2015 VKRM started with pid=23, OS id=125 replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC Thu May 07 00:06:18 2015 QMNC started with pid=24, OS id=127 Completed: ALTER DATABASE OPEN Thu May 07 00:06:18 2015

Second startup

Thu May 07 00:10:41 2015 ALTER DATABASE OPEN Thu May 07 00:10:49 2015 Thread 1 opened at log sequence 3 Current log# 1 seq# 3 mem# 0: /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_1_bbqv44l7_.log Successful open of redo thread 1 Thu May 07 00:10:50 2015 SMON: enabling cache recovery [92] Successfully onlined Undo Tablespace 2. Undo initialization finished serial:0 start:446776 end:446796 diff:20 (0 seconds) Verifying file header compatibility for 11g tablespace encryption.. Verifying 11g file header compatibility for tablespace encryption completed SMON: enabling tx recovery Thu May 07 00:10:54 2015 Database Characterset is AL32UTF8 Opening with Resource Manager plan: INTERNAL_PLAN_XE Thu May 07 00:10:54 2015 Starting background p rocess VKRM Thu May 07 00:10:54 2015 VKRM started with pid=23, OS id=95 replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC Thu May 07 00:10:54 2015 QMNC started with pid=24, OS id=97 Completed: ALTER DATABASE OPEN

Solisol avatar May 07 '15 08:05 Solisol

I confirm this bug, 1st run take several minutes

alaingiller avatar Nov 07 '16 08:11 alaingiller

Confirmed as well. Is there any workaround for this? Using this container in a Continuous Integration environment and starting a new one up for each build to test deployment. The long startup time is not desirable.

craigjar avatar Feb 20 '17 16:02 craigjar

I'm not going to say it's going to be infinitely faster, but this seems to be more of an issue with Oracle's startup process. I found this link, which sped up my program's startup significantly. I just created my own dockerfile and added the following line:

COPY startdb.sh. /u01/app/oracle/product/11.2.0/xe/config/scripts/startdb.sh

Where in my startdb.sh I simply moved line 38 in the startdb.sh to be after the following if statement. Line 38 is this: $SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql > /dev/null 2>&1

Or you can copy the following script if you want.

#!/bin/bash
#
#       svaggu 09/28/05 -  Creation
#       svaggu 11/09/05 -  dba groupd check is added
#

xsetroot -cursor_name watch
case $PATH in
    "") PATH=/bin:/usr/bin:/sbin:/etc
        export PATH ;;
esac

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
LSNR=$ORACLE_HOME/bin/lsnrctl
SQLPLUS=$ORACLE_HOME/bin/sqlplus
LOG="$ORACLE_HOME_LISTNER/listener.log"
user=`/usr/bin/whoami`
group=`/usr/bin/groups $user | grep -i dba`

if test -z "$group"
then
        if [ -f /usr/bin/zenity ]
        then
                /usr/bin/zenity --error --text="$user must be in the DBA OS group to start the database."
                exit 1
        elif [ -f /usr/bin/kdialog ]
        then
                /usr/bin/kdialog --error "$user must be in the DBA OS group to start the database."
                exit 1
        elif [ -f /usr/bin/xterm ]
        then
                /usr/bin/xterm -T "Error" -n "Error" -hold -e "echo $user must be in the DBA OS group to start the database."
                exit 1
        fi
else
# Starting Oracle Database 11g Express Edition instance and Listener
        if [ ! `ps -ef | grep tns | cut -f1 -d" " | grep -q oracle` ]
        then
                $LSNR start > /dev/null 2>&1
        else
                echo ""
        fi
        $SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql > /dev/null 2>&1
fi

xsetroot -cursor_name left_ptr

avborhanian avatar Jun 16 '17 16:06 avborhanian

Same problem.

indvd00m avatar Jun 28 '17 08:06 indvd00m