Sunday, June 29, 2008

Install Oracle DB Express Edition (XE)

WARNING: this post is for geeks ^_^

Recently I have the chance to install Oracle DB XE 10gR2 version to try out what it is like. I used to be very skeptical on Oracle DB installation because just to create a database already took me like 10 hours or so, I just don't have the courage to think about how long it'll take me to install the Oracle DB server.

To my surprise, this XE version is very fast and easy. This is how I do it to install XE server in Linux Suse 32-bit machine. Oops, just before I list down the steps, this is something you might want to know about XE:
  • Express Edition is limited to a single instance on any server.
  • Express Edition DB instance works with a single database only.
  • Express Edition may be installed on a multiple CPU server, but may only be executed on one processor in any server.
  • The maximum database size in Oracle Database XE is 5 gigabytes (GB). This includes between 0.5 and 0.9 GB for the data dictionary, internal schemas, and temporary space, which leaves just over 4.0 GB for user data.
  • Express Edition may use up to 1 GB RAM of available memory.
XE server installation steps are as follow:
1) Download the installer from Oracle site (I downloaded the rpm version):
http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html

2) Create user 'oracle' if the system has yet to have it
3) Create group 'dba', 'oper', and 'oinstall'
4) Make 'oracle' user has primary group of 'oinstall' and secondary group of 'dba' and 'oper'
You should be able to do this with the following command:
$ useradd -goinstall -Gdba,oper -pxxxx -m oracle
-g flag is to set primary group
-G flag is to set secondary group
-p flag is to set password
-m flag is to create home directory for the new user

5) su to oracle user and run the rpm executable:
$ rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm

6) Run the following command
$ /etc/init.d/oracle-xe configure

7) Enter the following configuration information:
  • A valid HTTP port for XE GUI (default is 8080) - web based
  • A valid port for Oracle database listener (default is 1521)
  • A password for SYS and SYSTEM administrative users accounts
  • Whether you want the database to start automatically when the system boots (I choose 'Y' = Yes)
You can always reconfigure the above settings by running the following command:
$ /etc/init.d/oracle-xe configure

To start database manually, run this command:
$ /etc/init.d/oracle-xe start

To stop database manually, run this command:
$ /etc/init.d/oracle-xe stop

8) Go to /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin folder and run
$ ./oracle_env.sh

9) Edit .bashrc file in oracle's home directory to include the following:
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

10) This is depends if you want to do this. I do the step no 9) in '/etc/profile' file instead. So, whoever that logs in will have the environment variables setup automatically.

Now, depends if you're installing the XE in local machine which you have KDE or any other GUI desktop, you'll be able to access the administration page with this link:
http://127.0.0.1:1521/apex

If you're installing it on a remote server, you need to go into the sqlplus to change a remote HTTP access setting before you can access the web page.

This is how to do it:
1) Start SQL *Plus in the remote server and log in as SYSTEM

2) After login, enter the following command:
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

After that, you should be able to access the web page, log in as SYSTEM and you should be able to start playing with XE features with a database named 'XE' created for you automatically.

This is how easy it is to setup. For the rest of the installation guide and information, you can get it from here.

Have fun!

No comments: