Oracle 10g Express Edition on Ubuntu 10.04 LTS (Lucid)
Oracle 10g is a robust, enterprise-grade relational database management system (RDBMS). As the first commercially available SQL-based DBMS, Oracle is an excellent choice for applications that demand large, distributed databases. This guide will assist you in setting up Oracle 10g XE (Express Edition) on your Ubuntu 10.04 LTS (Lucid) Utho.
Assuming you have followed our Setting Up and Securing a Compute Instance guide, all configurations will be conducted in a terminal session. Ensure you are logged into your Utho as root via SSH.
Please note: Depending on your Utho’s memory, Oracle may require a swap partition of up to 1,024 MB. Although we typically recommend against swap partitions larger than 256 MB, it is advisable in this case to resize your existing swap to 1,025 MB before proceeding with the Oracle installation (the extra MB accommodates differences in megabyte calculations).
To adjust your swap size, log into the Utho Manager, shut down your Utho, and navigate to the “Disks” section. Resize the swap disk to 1,025 MB. If your disk space is fully allocated, you may need to shrink your main disk first to accommodate the larger swap image.
Configure Networking and Set the Hostname
Oracle requires specific hostname configurations to determine which interfaces it will listen on. You will use a private IP on your Utho and adjust the hostname accordingly, facilitating connections to your Oracle database from other Uthos within the same data center.
To begin, ensure your Utho is assigned a private IP address. Access the Networking tab in the Utho Cloud Manager to add a private IP if necessary. After adding, reboot your Utho to apply changes before proceeding.
Next, edit your network interfaces file to specify both public and private IPs. Modify the values below to match your Utho’s network setup, paying particular attention to the subnet mask for the private IP.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 69.164.198.62
netmask 255.255.255.0
gateway 69.164.198.1
auto eth0:0
iface eth0:0 inet static
address 192.168.146.68
netmask 255.255.128.0
Make sure your /etc/hosts
file contains valid entries. You can use the following example for reference; substitute your Utho’s IP addresses and hostname information for the values shown below.
127.0.0.2 localhost.localdomain localhost
69.164.198.62 saturn.example.com saturn
192.168.146.68 oracle
Issue the following commands to set the system hostname:
echo "oracle" > /etc/hostname
hostname -F /etc/hostname
Although you’d normally set the system hostname to the short version of its fully qualified domain name, in this case it should be set to “oracle” to avoid issues with database connections. To complete network configuration, issue the following command:
ifdown -a && ifup -a
You can use the ip addr show
command to verify your network interfaces. If everything looks correct, you may proceed to Oracle installation.
Install Required Software
Add the Oracle GPG Key and Update Repositories
Installing the Oracle XE GPG key ensures that you will get verified Oracle software packages from apt
. Issue the following command to import the key:
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add -
Add the following repository to your /etc/apt/sources.list
file:
deb http://oss.oracle.com/debian unstable main non-free
Since you added a new repository, issue the following commands to update your package lists and install any outstanding updates:
apt-get update
apt-get upgrade
Install Oracle XE
Install Oracle XE by running the following command:
apt-get install oracle-xe
After the installation has finished, you must configuration Oracle by issuing the following command:
/etc/init.d/oracle-xe configure
You will be asked to specify a system user password and the ports you would like Oracle to listen on. You may leave the port options at their default values. As of this writing, Oracle’s SYSTEM and SYS passwords are not properly set during configuration. To correct this, issue the following commands, replacing “changeme” with your desired password.
su - oracle
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH
sqlplus / as sysdba
ALTER USER SYSTEM IDENTIFIED BY changeme;
ALTER USER SYS IDENTIFIED BY changeme;
quit
exit
Reboot your Utho to make sure everything comes back up correctly. Once you’ve logged back in via SSH, you can verify that the Oracle listener process is functioning correctly by issuing the following command:
netstat -an | grep 1521
You should see output resembling the following:
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN
tcp 0 0 192.168.146.68:38803 192.168.146.68:1521 ESTABLISHED
tcp 0 0 192.168.146.68:1521 192.168.146.68:38803 ESTABLISHED
Connect to the Oracle XE Home Page
Oracle is managed via a web interface, which is installed with the oracle-xe package. By default, it listens on the local address 127.0.0.2
at port 8080. Since you most likely do not have a window manager or web browser installed on your Utho, you must connect to your Oracle home page remotely.
You can achieve this by using our Oracle SSH tunnel script. Once your tunnel is established, access the admin page at http://127.0.0.2:8080/apex. Log in using the username “SYSTEM” and the password you set during Oracle configuration. This will bring you to a page similar to the following:
Manage Oracle from the Command Line
The Oracle XE installation comes bundled with a command line tool called sqlplus
, which is roughly equivalent to the MySQL client. We highly recommend using your Oracle XE Home Page over an SSH tunnel to administer your Oracle instance, however you may find sqlplus
useful.
First, you’ll need to locate the tnsnames.ora
file. Issue the following command:
find / -name tnsnames.ora
You may find more than one location for this file; ignore the version located in a “samples” directory if it’s listed. Edit tnsnames.ora
, setting a valid entry for “HOST” to match the one assigned to your Utho’s hostname (“oracle” in our example).
XE =
(DESCRIPTIONx =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
Next, edit the listener.ora
file from the same directory:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
)
)
If you had to modify either file, restart Oracle by issuing the following command:
/etc/init.d/oracle-xe restart
Next, locate the sqlplus.sh
shell script with the following command:
find / -name sqlplus.sh
Once you have located sqlplus.sh
, you can use it to start the sqlplus tool. In this example, sqlplus.sh
is located in /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/
.
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/sqlplus.sh
Once sqlplus has started, you’ll need to connect to your Oracle XE instance. Issue the following sqlplus
command:
CONNECT SYSTEM/yourpassword@oracle
Once logged in successfully, you can perform various Oracle tasks and query your databases. Oracle commands and syntax differ significantly from MySQL. If you are new to Oracle or transitioning from MySQL, we recommend reading the Oracle getting started guide to understand Oracle commands and its structure. Use the exit command to return to a normal shell prompt.