HOWTO: Install Oracle 11gR2 on Debian Wheezy

Oracle 11gR2 on Debian still isn’t an officially supported configuration (10g XE was for a while), but it is perfectly do-able with a little cajoling. Here I am starting with a fresh installation of Debian 7.1 in a VirtualBox VM, with 1G memory and a 40G dynamically allocated virtual disk. I installed just the base desktop + system utilities options from the DVD image. Once this is done I take a snapshot of it, which I can quickly clone whenever I need a new VM.

The first thing I want to do is get it set up the way I like it, including patching to the latest Guest Additions. In a root terminal (Applications → Accessories → Root Terminal):
Add the following lines to the file /etc/sysctl.conf:

kernel.shmmax=1073741824
kernel.shmall=262143

And execute the following commands:

# apt-get remove virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 gnome-shell
# apt-get install linux-headers-3.2.0-4-all
# apt-get autoremove
# eject
# cd /media/cdrom0
# sh VBoxLinuxAdditions.run
# reboot

After ejecting the distro ISO, insert the Guest Editions. This may take a while (esp. the autoremove).

After this the system will boot into the console, old-skool style. After logging in type startx to get the desktop (but no need if you just want to use the VM to run the DB server). It will be the less resource-guzzling Classic desktop only. I also disable screen locking and enable automatic login, since those are actually taken care of by the host machine (an MBP in this case):

  • Applications → System Tools → Preferences → System Settings → User Accounts → Automatic Login
  • Applications → System Tools → Preferences → System Settings → Brightness and Lock

Now I am ready to begin the actual Oracle installation, starting with the prereqs. Many of these will fail the Oracle installer precheck, e.g. it wants Make 3.8 whereas Wheezy comes with 3.81!

# apt-get install libaio-dev sysstat unixodbc-dev libelf-dev unzip g++ libstdc++6-4.7-dev libstdc++5

And create the users and groups necessary, and open up the display so this new user can see it:

# groupadd dba
# useradd -d /home/oracle -m -c "Oracle Database" -g dba -s `which bash` oracle
# mkdir /opt/oracle
# mkdir /opt/oraInventory
# mkdir /oradata
# chown oracle:dba /opt/oracle /opt/oraInventory /oradata
# xhost +

Next do some fakery to make it look like Red Hat/OEL (all these appear to be hard-coded paths in the Oracle tools):

# ln -s /usr/bin/basename /bin/basename
# ln -s /usr/bin/awk /bin/awk
# ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib
# ln -s /usr/lib/i386-linux-gnu/libc_nonshared.a /usr/lib
# ln -s /lib/i386-linux-gnu/libgcc_s.so.1 /lib
# ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 /usr/lib

Go and fetch the software from OTN (11.2.0.1) or if you have access to Metalink, just grab patch 10404530 which will take you straight to 11.2.0.3. Unzip these into /home/oracle where it will create a database/ folder. In a Root Terminal, su - oracle and:

$ for f in *.zip ; do unzip $f; done
$ cd database/
$ export DISPLAY=:0.0
$ export ORACLE_BASE=/opt/oracle
$ export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3
$ export PATH=$PATH:$ORACLE_HOME/bin
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/i386-linux-gnu:/bin/lib:/lib/i386-linux-gnu/:/usr/lib
$ ./runInstaller 

Proceed through the installer, selecting the appropriate options for the installation you want (or just accept the defaults if you are not sure). I am using

  • ORACLE_BASE=/opt/oracle
  • ORACLE_HOME=/opt/oracle/product/11.2.0.3
  • Datafiles in /oradata, inventory in /opt/oraInventory
  • Install software only, single instance, Enterprise Edition.

Skip all the prereq checks – they are there even tho’ the GUI installer doesn’t recognize them as such, the underlying scripts and the linker will. The installation will fail when relinking “agent nhms” due to a change in the behavior of the linker. The clue is in the log message:

/usr/bin/ld: note: 'B_DestroyKeyObject' is defined in DSO 
/opt/oracle/product/11.2.0.3/lib/libnnz11.so so try adding it to the linker command line

We can fix that in the Makefile $ORACLE_HOME/sysman/lib/env_emagent.mk by replacing:

NNMEFET_STACKLIBS_LINK=$(LDPATHFLAG)$(ORACLE_HOME)/$(LIBDIR)  $(LDPATHFLAG)$(PRODLIBHOME) $(LLIBNMEMSO) $(LLIBCORE) -Wl,-rpath,$(AGENTRPATH):$(JAVA_RTLINK_PATH) $(LIB_JVM_LINK) -Wl,--allow-shlib-undefined 

With

NNMEFET_STACKLIBS_LINK=$(LDPATHFLAG)$(ORACLE_HOME)/$(LIBDIR)  $(LDPATHFLAG)$(PRODLIBHOME) $(LLIBNMEMSO) $(LLIBCORE) -lnnz11 -Wl,-rpath,$(AGENTRPATH):$(JAVA_RTLINK_PATH) $(LIB_JVM_LINK) -Wl,--allow-shlib-undefined

And clicking retry. Now I can create a database with DBCA. There is one customization I make to the startup parameters to avoid a crash in the Oracle JVM (still known as Aurora internally!) while creating the data dictionary, set java_jit_enabled from TRUE to FALSE in the Advanced Parameters:

java_jit_enabled

Congratulations, you now have a working Oracle installation on a halfway sane Linux distro! Of course this is all moot since 12c is out now; the same steps should apply, I will update when I have had a chance to try it.

Finally I install some software that I like, again in a Root Terminal (you can skip this step if you don’t plan to do any OCaml development!):

# apt-get install hardening-wrapper hardening-includes git ocaml-batteries-included ocaml-mode rlwrap gnome-screenshot strace valgrind
Advertisements

About Gaius

Jus' a good ol' boy, never meanin' no harm
This entry was posted in Linux, Oracle and tagged . Bookmark the permalink.

15 Responses to HOWTO: Install Oracle 11gR2 on Debian Wheezy

  1. Alfred says:

    For 64 bit platform, replace /usr/lib with /usr/lib64 and /lib with /lib64
    # ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib
    # ln -s /usr/lib/i386-linux-gnu/libc_nonshared.a /usr/lib
    # ln -s /lib/i386-linux-gnu/libgcc_s.so.1 /lib
    # ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 /usr/lib

  2. Natalia says:

    when set sga_max_size=1G
    SQL> startup
    ORA-27102: out of memory
    Linux Error: 28: No space left on device

    df -h
    tmpfs                                                    2,7G            0  2,7G            0% /run/shm

    Why?

  3. Robin Unterpirker says:

    Hey! Thanks for your tutorial, but i get an error. An Makefile Error. The name of the file “ins_emagent.mk”. Thanks

  4. Howard Chu says:

    In case anyone ever needs this – some similar tweaks are also needed to install OID (I used 11g1). I needed to patch two makefiles to get past the install/link, and also had to patch Oracle_IDM1/ccr/bin/strip_path.awk because it was stripping one character too much from the paths, causing OCM config to fail.

    The first Makefile to patch is Oracle_IDM1/lib/env_asha.mk. The error for it is:
    [2013-10-29T08:48:22.615-07:00] [OUI] [NOTIFICATION] [] [OUI] [tid: 27] [ecid: 0000K84tgVNFS845zVWByW1IRxTQ00000H,0] /home/oracle/Middleware/Oracle_IDM1/lib/libhasocket.so: undefined reference to `memcpy@GLIBC_2.14′

    My fix was to symlink /usr/lib/x86_64-linux-gnu/libc.so to /usr/lib/libc.so and add /usr/lib/libc.so explicitly to the end of lines 996, 1043, and 1086 – anywhere -lrt was present for the x86_64 target.

    e.g.
    ifeq ($(PLATFORM), x86_64)
    HASOCKET_LD_LIBS=-Wl,-init,shasocket_init,-fini,shasocket_fini -ldl \
    -lpthread -lrt -L$(LIBHOME) -L$(COMPDIR)/lib -lirc /usr/lib/libc.so
    HASOCKET_LDFLAGS=$(GFLAG) -shared
    endif

    The 2nd Makefile to patch is Oracle_IDM1/sysman/lib/ins_emagent.mk and is similar to the OracleDB fix – add “-lnnz11” to line 184:
    $(SYSMANBIN)emdctl:
    $(MK_EMAGENT_NMECTL) -lnnz11

    The CCR patch requires unzipping a few files. At this stage, you’ll have Oracle_IDM1/ccr_generic/sysman/install/ccr-Production-GENERIC.zip. Inside there is linux/ccr.zip. Inside that is the awk script to fix:
    cd Oracle_IDM1/ccr_generic/sysman/install
    unzip ccr-Production-GENERIC.zip linux/ccr.zip
    cd linux
    unzip ccr.zip ccr/bin/strip_path.awk
    vi ccr/bin/strip_path.awk

    then resave the archives:
    zip ccr.zip ccr/bin/strip_path.awk
    cd ..
    zip ccr-Production-GENERIC.zip linux/ccr.zip

    Then when you resume the install, everything should succeed.

  5. >>> We can fix that in the Makefile $ORACLE_HOME/sysman/lib/env_emagent.mk by replacing

    There are no this string. ORACLE ver 11.2.0.3

  6. eduleboss says:

    Thanks @Gaius for your tutorial. This is the only one readable I found. :) But I got stuck on a step : xhost + command outputs me “xhost: unable to open display “” “.

    • Gaius says:

      I guess it depends how you have X-windows set up – check the value of $DISPLAY. If you are SSHing in, make sure to pass the -X option and it will set it for you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s