I wanted to import a datapump dumpfile to my laptop, and I wondered if I can install Oracle XE to ubuntu guest. I thought it would be easy because I installed Oracle 10g XE to ubuntu for several times, but I saw that Oracle doesn’t provide debian packages for Oracle 11g XE. So I needed to convert the RPM to debian package (and fix incompatibility problems). Therefor, I installed “alien” package and other required tools using apt-get:
gokhan@gokhan-VirtualBox:~/Desktop$ sudo su - root@gokhan-VirtualBox:~# apt-get install alien
Then I downloaded the zipped RPM (oracle-xe-11.2.0-1.0.x86_64.rpm.zip), unzipped it:
root@gokhan-VirtualBox:~# unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip root@gokhan-VirtualBox:~# cd Disk1 root@gokhan-VirtualBox:~/Disk1# ls -l total 309892 -rw-rw-r-- 1 root root 317320273 Ağu 28 2011 oracle-xe-11.2.0-1.0.x86_64.rpm drwxr-xr-x 2 root root 4096 Ağu 28 2011 response drwxrwxr-x 2 root root 4096 Ağu 28 2011 upgrade
I converted the RPM to debian package (it took about 6 minutes on my VM) and then installed the package (which I created in previous step):
root@gokhan-VirtualBox:~/Disk1# alien --scripts oracle-xe-11.2.0-1.0.x86_64.rpm oracle-xe_11.2.0-2_amd64.deb generated root@gokhan-VirtualBox:~/Disk1# dpkg -i oracle-xe_11.2.0-2_amd64.deb Selecting previously unselected package oracle-xe. (Reading database ... 236797 files and directories currently installed.) Preparing to unpack oracle-xe_11.2.0-2_amd64.deb ... Unpacking oracle-xe (11.2.0-2) ... Setting up oracle-xe (11.2.0-2) ... Executing post-install steps... /var/lib/dpkg/info/oracle-xe.postinst: line 114: /sbin/chkconfig: No such file or directory You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database. Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1.1) ... Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
As you can see, the installation script tried to use “/sbin/chkconfig” but it couldn’t find it. On the other hand, there was not any big problems occurred, so I decided to continue with configuration:
root@gokhan-VirtualBox:~# /etc/init.d/oracle-xe configure Oracle Database 11g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 11g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <Enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]: Specify a port that will be used for the database listener [1521]: /etc/init.d/oracle-xe: line 405: /bin/awk: No such file or directory Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password: Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]: Starting Oracle Net Listener...touch: cannot touch '/var/lock/subsys/listener': No such file or directory Done Configuring database... Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details
Although I just entered default values, the configuration script failed. On line 15, I see that it tries to use /bin/awk – ubuntu’s awk is located at /usr/bin/awk. On line 24, it tries to create a listener “lock” file in “/var/lock/subsys/” and when I check the directories, I see that there’s no subsys folder under the “/var/lock”. So I create symbolic link for awk and create that “subsys” folder:
root@gokhan-VirtualBox:~# ln -s /usr/bin/awk /bin/awk root@gokhan-VirtualBox:~# mkdir /var/lock/subsys
Then I examine the logs in “/u01/app/oracle/product/11.2.0/xe/config/log”, I see that database couldn’t be created, and the reason seems “ORA-00841: MEMORY_TARGET not supported on this system”. It typically occurs when “/dev/shm” was not sized correctly on Linux. On Ubuntu, the /dev/shm is just a symbolic link which points to /run/shm. So I removed the link, recreated the directory and mount 1 GB RAM to it:
root@gokhan-VirtualBox:~# rm /dev/shm root@gokhan-VirtualBox:~# mkdir /dev/shm root@gokhan-VirtualBox:~# mount -t tmpfs shmfs -o size=1024m /dev/shm
After setting the /dev/shm, I tried again to configure the Oracle XE and it worked! Then I switched to oracle user, and connected to Oracle XE database:
oracle@gokhan-VirtualBox:~$ export PATH=product/11.2.0/xe/bin:$PATH oracle@gokhan-VirtualBox:~$ . oraenv ORACLE_SID = [oracle] ? XE ORACLE_BASE environment variable is not being set since this information is not available for the current user ID oracle. You can set ORACLE_BASE manually if it is required. oracle@gokhan-VirtualBox:~$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Fri Apr 8 10:47:12 2016 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production SQL>
I wanted to share how I fixed the problems when I encounter installing Oracle XE on Ubuntu, so I just created an empty Ubuntu guess, and re-apply all commands to make sure that I don’t miss anything. Guess what! Somehow it didn’t worked. I can surely swear that I exactly did the same things then I remembered that I installed extra packages for different purposes and some of them must be used by Oracle XE.
I checked the library usage of oracle executable and see that “libaio.so.1” is missing. So I also installed “libaio1” package:
apt-get install libaio1
It solved the problem but I needed to start from scratch (purged the package and then re-install, re-configure) and everything seems OK for now. If you reboot your VM, you’ll see that /dev/shm will be reverted to symbolic link and the subsys folder is gone. It might be possible to modify Ubuntu’s configuration scripts to prevent this behaviour. On the other hand I recommend you to create a simple bash script to mount /dev/shm and startup oracle-xe, instead of modifying Ubuntu’s configuration files. For example:
root@gokhan-VirtualBox:~# cat startxe.sh rm /dev/shm mkdir /dev/shm mkdir /var/lock/subsys mount -t tmpfs shmfs -o size=1024m /dev/shm /etc/init.d/oracle-xe start