Install Oracle 11g Express (XE) on CentOS

This post will cover basic installation and configuration of Oracle 11g Express Edition (XE) on CentOS.

We will also take a quick look at configuring Application Express (APEX) for 11g XE.

Basic installation is straight forward.

If you just want to get up and running, you can just do steps 1 to 4 below (and 10 and 11 for Apex). The remaining steps (5 to 9) cover basic backup, recovery, and performance configuration.

The full system requirements are here

Your CentOS box should have swap equal to 2xRAM.

On every CentOS installation I have done for XE, I just needed to update/install the packages for libaio, bc, and flex.

 

Step 1: Download and Install Oracle 11g XE rpm

 

You can download the Oracle XE rpm, oracle-xe-11.2.0-1.0.x86_64.rpm.zip, from the OTN
here

Unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip:

 

This will create the directory Disk1. Change to the Disk1 directory:

 

Install the rpm using rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

When installation completes, run ‘/etc/init.d/oracle-xe configure’ to configure and start the database.

Unless you wish to change the ports, except the defaults and set SYS/SYSTEM password.

The installation created the directory /u01 under which Oracle XE is installed.

Step 3: Set the Environment

 

To set the required Oracle environment variables, use the oracle_env.sh the script included under cd /u01/app/oracle/product/11.2.0/xe/bin

To set the environment for your current session run ‘. ./oracle_env.sh’:

To set the environment permanently for users, add the following to the .bashrc or .bash_profile of the users you want to access the environment:

You should now be able to access SQL*Plus

Step 4: Allow Remote Access to Oracle 11g XE GUI

 

To allow remote access to Oracle 11g XE GUI (as well as Application Express GUI) issue the following from SQL*Plus

You should now be able to access the Oracle 11g XE Home Page GUI at:

http://localhost:8080/apex/f?p=4950:1

Replace localhost above with your IP or domain as required.

Log in as SYSTEM using the password you selected in Step 2 above.

Step 5: Move the Flash Recovery Area (Fast Recovery Area)

 

To protect against disk failure, you should move the Flash Recovery Area to a separate disk.

This is actually now called the Fast Recovery Area, but the existing documentation still refers to it as the Flash Recovery Area

If a separate disk is not in your budget you should, at the very least, move the Flash Recovery Area to a partition other than the Oracle installation directory.

By default, the Fast Recovery Area will be located under /u01/app/oracle/fast_recovery_area

So, to move it elsewhere, first create the new directory

Change the owner to oracle and the group to dba

Now, change the DB_RECOVERY_FILE_DEST to the location you selected above.

To move the files use the movelog.sql script:

Now, set an appropriate size for the Fast Recovery Area. Use df -h to insure that there is ample space.

Verify the new location and size.

Step 6: Add Redo Log Members to Groups

 

You should have at least two Redo Log Groups and each group should have at least two members.

Additionally, the members should be spread across disks (or at least directories)

For whatever reason, only one member is created per group on install.

You can view the redo log files using SQL SELECT * FROM V$LOGFILE;

Since the default location for the two members is the Flash Recovery Area, the two existing members have been moved to our new FRA.

You should now add an additional member for each group under /u01/app/oracle/oradata/XE

 

Step 7: Set Sessions and Processes Parameters

 

The default values for parameters and sessions is quite low on the default installation.

You can increase these parameters.

After each change, you will need to restart the database.

Increase sessions and then bounce database.

Verify change to sessions parameter:

Increase processes and restart database

Verify change to processes parameter:

 

Step 8: Enable Archivelog Mode

 

To enable online or “hot” backups, Archivelog Mode must be enabled.

Additionally, if you do not enable Archivelog Mode and take only offline or “cold” backups, should you need to restore the database you will only be able to restore to the last backup

To enable Archivelog Mode, shutdown the database and then startup mount:

Enable Archivelog Mode

Open the database and verify that Archivelog Mode is enabled

 

Step 9: Create Online Backup Script

 

To create automated backups, you can modify the backup.sh included under /u01/app/oracle/product/11.2.0/xe/config/scripts

Create a directory for your backup script

Change the owner to oracle and the group to dba

Copy the backup.sh script from /u01/app/oracle/product/11.2.0/xe/config/scripts to the directory you created above.

Open the backup.sh script in a text editor or vi. The last section will look like this:

Change it to:

The line we added above, mail -s ‘Oracle Backup Completed’ ‘david@davidghedini.com’ /u01/app/oracle/oxe_backup_current.log, will send us an email notification that the backup has completed as well as cat the backup log to the body of the email.

Note that we have also commented out the last two lines of the script (the prompt).

Create a cron job to run the script as user oracle.

You should run it at least once a day. With Archivelog Mode enabled, it is important that backups be taken regularly to prevent the Flash Recovery Area from filling.

 

Step 10: Oracle 11g XE and Application Express (APEX)

 

Oracle 11g Express Edition comes with Application Express 4.0.2 already installed.

If you elect to upgrade to the latest version (4.1 as of this writing), you can do so but will loose access to the XE GUI. Not a huge loss, but something to keep in mind.

Although Apex is already installed, you will need to set the Internal Admin password.

To do so, run the apxchpwd.sql located under /u01/app/oracle/product/11.2.0/xe/apex:

Note: pick something simple like Password123! as you will be prompted to change it on first log in anyways.

You can access the Application Express GUI at:

http://localhost:8080/apex/f?p=4550:1

Replace localhost above with your IP or domain as required.

Workspace: Internal
User Name: admin
Password: (whatever you selected above).

Alternatively, you can access via

http://localhost:8080/apex/f?p=4550:10 or http://localhost:8080/apex/apex_admin

Again, replace localhost above with your IP or domain as required.

 

Step 11: Oracle 11g XE: Configure EPG or Apex Listener

 

Unless you have a license for Oracle HTTP Server (OHS), your options are the embedded PLSQL Gateway (EPG) or Apex Listener.

The Application Express that comes installed with Oracle 11g XE is configured using the EPG.

While the EPG is simpler than Apex Listener, it can be painfully slow as of Apex 3.2.

Apex Listener, while quite fast, adds an extra layer of complexity.

You will need to install an application server to run Apex Listener.

I have run Apex Listener on both Tomcat (unsupported) as well as Oracle GlassFish 3.x (supported) and was not impressed with either.

A lot of people who know far more than I do about APEX (read: 99.9999% of the population) like the Apex Listener.

Apex Listener and it’s installation guide can be found here.

The Apex Listener installation guide is well done and simple to follow.

If you need to install Oracle GlassFish or GlassFish CE (basic installation is the same), you can use my GlassFish 3.1 instructions here.

If you want to be an outlaw and use Tomcat, you can use my Tomcat 6 installation guide here. or my Tomcat 7 installation guide here..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

sixteen − 16 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.