Sunday, 22 May 2011

Oracle XE on Ubuntu

Oracle provides a debian repository at http://oss.oracle.com/debian, containing only Oracle 10g Express Edition (XE) packages.
To see these packages, add this line to /etc/apt/sources.list file:
deb http://oss.oracle.com/debian unstable main non-free
Next, you will need to add the GPG key.
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
As root, type:
apt-get update
To install the XE database server, apt-get 'oracle-xe-universal' or 'oracle-xe' (Western European support only).
apt-get install oracle-xe-universal oracle-xe-client
Don't forget to add the hostname to the /etc/hosts file

As root, type:
/etc/init.d/oracle-xe configure
Change the listner conf:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora

Create user:
Change into the oracle user and setup the environment:
su oracle
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
Connect to the database:
sqlplus sys as sysdba
And actually create the user:
CREATE USER <NEW_USER> IDENTIFIED BY <NEW_USER_PASS> DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users;
Change the user's permissions:
GRANT CREATE session, CREATE table, CREATE view, CREATE procedure, CREATE synonym, CREATE SEQUENCE, CREATE TRIGGER, CREATE TYPE, CREATE MATERIALIZED VIEW, CREATE DATABASE LINK,Debug Any Procedure,Debug Connect Session TO <NEW_USER>;
Adjust the user's quota:
ALTER USER <NEW_USER> QUOTA UNLIMITED ON USERS;
Start Oracle server in UNIX

Type the following command, enter:
$ su - oracle
Now use lsnrctl command to start service (usually located at /home/oracle/oracle/product/10.2.0/db_1/bin directory):
$ lsnrctl start
Next start database:
$ dbstart
Stop Oracle service in UNIX

To stop Oracle servuice type following two commands:
$ lsnrctl stop
$ dbshut

HTTP Interface

Now for creating users / schema / ... you have a nice http interface to do it :http://localhost:8080/apex/

If you want to access this remotely, you may need to use a SSH port forwarding:
ssh -L 8080:localhost:8080 user@IP_of_your_server
It is also possible to use the administration console remotely, even if it's not recommended for security reasons (better using SSH port forwarding as previously said):
sqlplus sys as sysdba
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

Possibly Related Posts

No comments:

Post a Comment