Preparation
- For the Ubuntu ISO, see http://releases.ubuntu.com/releases/8.10/MD5SUMS
- Here is the md5sum I calculated on the Oracle package:
a2ec9975a91e1228c8292ed9799dc302 ubuntu-8.10-server-i386.iso
On the first boot, let’s check if we have everything we need, such as connectivity and
sudo
acccess.bott@desktop:~$ ssh pythian@192.168.x.y (...) pythian@192.168.x.y's password: Linux ibex 2.6.27-7-server #1 SMP Fri Oct 24 07:37:55 UTC 2008 i686 (...) pythian@ibex:~$ sudo -l [sudo] password for pythian: User pythian may run the following commands on this host: (ALL) ALL pythian@ibex:~$ logout Connection to 192.168.x.y closed.
bott@desktop:~/Desktop$ ssh pythian@192.168.x.y pythian@192.168.x.y's password: (...) pythian@ibex:~$ sudo su - root@ibex:~# apt-get update Hit http://security.ubuntu.com intrepid-security Release.gpg Ign http://security.ubuntu.com intrepid-security/main Translation-en_US (...) Get:7 http://security.ubuntu.com intrepid-security/multiverse Packages [14B] Get:8 http://security.ubuntu.com intrepid-security/multiverse Sources [14B] Fetched 6551B in 0s (7776B/s) Reading package lists... Done root@ibex:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: (...) 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 24.7MB of archives. After this operation, 24.6kB of additional disk space will be used. Do you want to continue [Y/n]? y (...) Running postinst hook script /sbin/update-grub. Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /boot/vmlinuz-2.6.27-7-server Found kernel: /boot/memtest86+.bin Updating /boot/grub/menu.lst ... done (...) Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#Since we had a kernel upgrade, reboot before continuing:
root@ibex:~#reboot (...) The system is going down for reboot NOW! root@ibex:~# Connection to 192.168.x.y closed by remote host. Connection to 192.168.x.y closed. bott@desktop:~/Desktop$After rebooting to change the kernel, let’s install all the required packages to continue:
bott@desktop:~/Desktop$ ssh pythian@192.168.x.y pythian@192.168.x.y's password: (...) pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# apt-get install gcc make binutils gawk x11-utils rpm alien ksh lsb-rpm Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: (... long list ...) Suggested packages: (... another long list ...) The following NEW packages will be installed: (... even longer list ...) 0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded. Need to get 29.3MB of archives. After this operation, 93.0MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://us.archive.ubuntu.com intrepid/main gawk 1:3.1.6.dfsg-0ubuntu1 [500kB] Get:2 http://us.archive.ubuntu.com intrepid/main libdrm2 2.3.1-0build1 [260kB] (...) Setting up build-essential (11.4) ... Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#Now we have all the packages we need, so let’s make sure we have all the requirements to run the Oracle Universal Installer as it was not designed to run on Ubuntu, but rather on Redhat-like systems). First, make sure Bash is your default replacement for
sh
:root@ibex:~# cd /bin root@ibex:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-11-02 21:33 /bin/sh -> dash root@ibex:/bin# ln -sf /bin/bash /bin/sh root@ibex:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-11-02 22:34 /bin/sh -> bash root@ibex:/bin#Let’s create some users:
root@ibex:/bin# cd root@ibex:~# pwd /root root@ibex:~# addgroup oinstall Adding group `oinstall' (GID 1001) ... Done. root@ibex:~# addgroup dba Adding group `dba' (GID 1002) ... Done. root@ibex:~# addgroup nobody Adding group `nobody' (GID 1003) ... Done. root@ibex:~# usermod -g nobody nobody root@ibex:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle root@ibex:~# mkdir /home/oracle root@ibex:~# chown -R oracle:dba /home/oracle root@ibex:~# ln -s /usr/bin/awk /bin/awk root@ibex:~# ln -s /usr/bin/rpm /bin/rpm root@ibex:~# ln -s /usr/bin/basename /bin/basename root@ibex:~# mkdir /etc/rc.d root@ibex:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done root@ibex:~# mkdir -p /u01/app/oracle root@ibex:~# chown -R oracle:dba /u01 root@ibex:~#Copy the unpacked Oracle 11gR1 to the box we’re working on:
bott@desktop:~/Desktop$ scp -r database pythian@192.168.x.y: pythian@192.168.x.y's password: (...)And put our installation files in place:
pythian@ibex:~$ sudo su - root@ibex:~# mv /home/pythian/database /media/database root@ibex:~# chown -R oracle:oinstall /media/database root@ibex:~#Let’s change some system-wide configuration files, starting with
/etc/sysctl.conf
:root@ibex:~# cd /etc root@ibex:/etc# cp sysctl.conf sysctl.conf.originalEdit it, adding the following lines to the bottom of the file:
fs.file-max = 65535 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65535 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144Then, let’s modify
/etc/security/limits.conf
:root@ibex:/etc# cd /etc/security/ root@ibex:/etc/security# cp limits.conf limits.conf.originalAdd the following lines to the bottom of the file:
oracle soft nproc 2047 oracle hard nproc 16383 oracle soft nofile 1023 oracle hard nofile 65535The last one, for now, is
/etc/pam.d/login
:root@ibex:/etc/security# cd /etc/pam.d root@ibex:/etc/pam.d# cp login login.originalEdit
login
, adding to it:session required /lib/security/pam_limits.so session required pam_limits.so
sysctl -p
as root
and logging in again as your user) but I do recommend it, just to make sure we are on the same page. Doing so guarantees that we’ve cleaned up our memory and loaded at boot time all the changes we just did.Oracle installation
oracle
and to fire up the Oracle Universal Installer. Don’t forget to allow incoming connections on your X server with xhost +192.168.x.y
. The IP address 192.168.w.z
is the IP address of your X server.pythian@ibex:~$ whoami pythian pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# su - oracle oracle@ibex:~$ export DISPLAY=192.168.w.z:0.0 oracle@ibex:~$ cd /media/database oracle@ibex:/media/database$ ./runInstaller -ignoreSysPrereqs Starting Oracle Universal Installer... Checking Temp space: must be greater than 80 MB. Actual 12037 MB Passed Checking swap space: must be greater than 150 MB. Actual 729 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-11-04_12-02-58AM. Please wait ...oracle@ibex:/media/database$ Oracle Universal Installer, Version 11.1.0.6.0 Production Copyright (C) 1999, 2007, Oracle. All rights reserved.The installer may throw errors at some point:
Locking assertion failure. Backtrace: #0 /usr/lib/libxcb-xlib.so.0 [0xa35067c7] #1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xa3506891] #2 /usr/lib/libX11.so.6(_XReply+0x254) [0xa354e494] (...)
I’ve selected group
dba
:And asked the installer to proceed with the whole Enterprise Edition:
Note that we changed the name and location of our
ORACLE_HOME
to oraibex
and /u01/app/oracle/product/11.1.0/oraibex
:Some of the product-specific prerequisite checks will fail, but we check each checkbox so the last column reads “User Verified” on all unchecked rows:
We will install software only now, nothing else:
And change the privileged OS groups to
dba
:It will show us a summary, but the
Next
is greyed out, so we hit Install
And it will begin installing:
And we get a cup of tea:
And another cup of tea:
Until it asks us to execute a couple of scripts as
root
:In case you’ve never done this before and want to know what it looks like, here’s the output I got:
bott@desktop:~$ ssh pythian@192.168.x.y pythian@192.168.x.y's password: (...) pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory to 770. Changing groupname of /u01/app/oraInventory to dba. The execution of the script is complete root@ibex:~# /u01/app/oracle/product/11.1.0/oraibex/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.1.0/oraibex Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. root@ibex:~#At the end of the installation, the Oracle Universal Installer is kind enough to ask us for confirmation before leaving (you can click on “Installed Products” and review what was installed before leaving the installer:
Now, take note of two things, our
ORACLE_BASE
and our ORACLE_HOME
as we’ll use them later:ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibexWe now have only the database software, but no database created yet. Let’s get moving and install the few extra packages needed to complete our installation. Please note that on several attempts, I’ve installed all the packages in the earlier step, but all those attempts failed; that’s why we’re installing it just before we actually need it (
dbca
will fail without those and the database won’t be created):root@ibex:~# apt-get install libaio1 lesstif2 libmotif3 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libxp6 The following NEW packages will be installed: lesstif2 libaio1 libmotif3 libxp6 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 1941kB of archives. After this operation, 4772kB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://us.archive.ubuntu.com intrepid/main libxp6 1:1.0.0.xsf1-2 [16.7kB] Get:2 http://us.archive.ubuntu.com intrepid/multiverse libmotif3 2.2.3-2 [1283kB] (...) Setting up libaio1 (0.3.107-1ubuntu1) ... Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#Create our startup/init script:
root@ibex:~# cat /etc/init.d/oracledb #!/bin/bash # # /etc/init.d/oracledb # # Run-level Startup script for the Oracle Listener and Instances # It relies on the information on /etc/oratab export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex export ORACLE_OWNR=oracle export PATH=$PATH:$ORACLE_HOME/bin if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" touch /var/lock/oracle echo "OK" ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" rm -f /var/lock/oracle echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0We will make it executable and tell the OS we want it started at boot time:
root@ibex:~# chmod a+x /etc/init.d/oracledb root@ibex:~# update-rc.d oracledb defaults 99 update-rc.d: warning: /etc/init.d/oracledb missing LSB style header Adding system startup for /etc/init.d/oracledb ... /etc/rc0.d/K99oracledb -> ../init.d/oracledb /etc/rc1.d/K99oracledb -> ../init.d/oracledb /etc/rc6.d/K99oracledb -> ../init.d/oracledb /etc/rc2.d/S99oracledb -> ../init.d/oracledb /etc/rc3.d/S99oracledb -> ../init.d/oracledb /etc/rc4.d/S99oracledb -> ../init.d/oracledb /etc/rc5.d/S99oracledb -> ../init.d/oracledb root@ibex:~#Note: Do NOT reboot now.
Creating a database
Let’s install our first database with DBCA (DataBase Configuration Assistant).root@ibex:~# su - oracle oracle@ibex:~$ export DISPLAY=192.168.w.z:0.0 oracle@ibex:~$ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex oracle@ibex:~$ export PATH=$PATH:/u01/app/oracle/product/11.1.0/oraibex/bin oracle@ibex:~$ dbca (...some time will pass before you see anything -- be patient...) Locking assertion failure. Backtrace: #0 /usr/lib/libxcb-xlib.so.0 [0x9fc957c7] #1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0x9fc95891] (...)Now, wait for a few moments, as
dbca
can take up to a couple of minutes to show this initial screen:That’s right, we want to create a database:
A general Purpose or TransactionProcessing database, next:
And our SID will be
intrepid
:But we don’t want to configure Enterprise Manager just now:
We want to use the same password for both
SYS
and SYSTEM
accounts:Nothing fancy, just plain filesystem for storage:
Let’s use the suggested template:
But no recovery area or archiving:
We don’t want the sample schemas or to execute any custom scripts at this time:
You can tune this if you want, but I’d suggest leaving it as-is unless you know what you’re doing:
As well as sticking with the suggestion of keeping the enhanced default security settings:
I don’t want any automatic unattended tasks running:
Check your filesystem layout, then hit
Next
:Yes, we want it to go ahead and create the database. Hit
Finish
this time.It will show what it’s about to do. Check it out, then hit
OK
when ready.And it will get to work, creating your first database:
Go get another cup of tea:
And another:
And keep watching the screen until you see something like this:
At this point, you’ll have an empty database created.
Testing
Time to check it out. First test: we shut it down and restart it.oracle@ibex:~$ export ORACLE_SID=intrepid oracle@ibex:~$ . oraenv ORACLE_SID = [intrepid] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex is /u01/app/oracle oracle@ibex:~$ sqlplus '/as sysdba' SQL*Plus: Release 11.1.0.6.0 - Production on Thu Nov 6 14:35:24 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 238530560 bytes Fixed Size 1299116 bytes Variable Size 125832532 bytes Database Buffers 109051904 bytes Redo Buffers 2347008 bytes SQL> alter database mount; Database altered. SQL> alter database open; Database altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options oracle@ibex:~$Next, we make it start on boot:
root@ibex:~# cat /etc/oratab # # This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # intrepid:/u01/app/oracle/product/11.1.0/oraibex:N root@ibex:~#See that
N
on the line starting with intrepid
? Change it to Y
:intrepid:/u01/app/oracle/product/11.1.0/oraibex:YHere’s what happens when you run /etc/init.d/oracledb:
root@ibex:~# /etc/init.d/oracledb start Starting Oracle: LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 12-NOV-2008 15:39:25 Copyright (c) 1991, 2007, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.1.0/oraibex/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.1.0.6.0 - Production Log messages written to /u01/app/oracle/diag/tnslsnr/ibex/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ibex.baia)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production Start Date 12-NOV-2008 15:39:28 Uptime 0 days 0 hr. 0 min. 3 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Log File /u01/app/oracle/diag/tnslsnr/ibex/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ibex.baia)(PORT=1521))) The listener supports no services The command completed successfully Processing Database instance "intrepid": log file /u01/app/oracle/product/11.1.0/oraibex/startup.log OK root@ibex:~#So after every reboot, you’ll be able to login to your database:
root@ibex:~# su - oracle oracle@ibex:~$ export ORACLE_SID=intrepid oracle@ibex:~$ . oraenv ORACLE_SID = [intrepid] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex is /u01/app/oracle oracle@ibex:~$ sqlplus '/as sysdba' SQL*Plus: Release 11.1.0.6.0 - Production on Wed Nov 12 15:41:38 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select sysdate from dual; SYSDATE --------- 12-NOV-08 SQL>