Oracle XE on ubuntu (debian) – first impressions

Oracle recently shipped the production version of Oracle XE, the free version of Oracle’s 10g release 2 database. This is an investigation from a DBA’s point of view. Is it comparable to a ‘normal’ 10g database, or is it something completely different?

Oracle Technet Link for more information and free download: Oracle XE Home

For linux, oracle ships the default gzipped cpio for the normal database, but a rpm (in the beta version), and a rpm and a deb (!!) file for the XE production version. I use ubuntu on my testing machine, so I am very pleased I can use a deb file (because ubuntu uses the debian package manager), and do not have to use ‘alien’ to convert the rpm to deb.

Each package manager checks the environment to see if it meets the requirements. the oracle XE package checks the amount of swapspace quite drastic. I have 512M, and a swapspace of 1G, but it needed 1008 M. I have gotten around this by adding some filesystem swap:


root@bedrock:~# dd if=/dev/zero of=/extraswap bs=1k count=1024000
root@bedrock:~# mkswap /extraswap
root@bedrock:~# swapon /extraswap
root@bedrock:~# swapon -s
Filename Type Size Used Priority
/dev/mapper/vg00-swap partition 1048568 138096 -1
/extraswap file 1023992 0 -4

Well, with this in mind, the install should work:


root@bedrock:~# dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb
(Reading database ... 70694 files and directories currently installed.)
Unpacking oracle-xe (from oracle-xe_10.2.0.1-1.0_i386.deb) ...
Setting up oracle-xe (10.2.0.1-1.0) ...
Executing Post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

root@bedrock:~#

This is easy! The software is installed, we only need to configure the database now, in order to use it!


root@bedrock:~# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g 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 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]:

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 10g Express Edition to be started on boot (y/n) [y]:n

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"

My first question is: what do we have installed now?

Well, it appears we have a running database, together with listener. Just that! The application (formerly known as ‘HTMLDB’, now it is called ‘application express’) runs entirely in the database:


oracle@bedrock:~$ ps -ef | grep oracle
oracle 20226 20225 0 13:13 pts/6 00:00:00 -su
oracle 22384 1 0 14:51 ? 00:00:00 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr LISTENER -inherit
oracle 22515 1 0 14:53 ? 00:00:00 xe_pmon_XE
oracle 22517 1 0 14:53 ? 00:00:00 xe_psp0_XE
oracle 22519 1 0 14:53 ? 00:00:00 xe_mman_XE
oracle 22521 1 0 14:53 ? 00:00:00 xe_dbw0_XE
oracle 22523 1 0 14:53 ? 00:00:00 xe_lgwr_XE
oracle 22525 1 0 14:53 ? 00:00:00 xe_ckpt_XE
oracle 22527 1 0 14:53 ? 00:00:00 xe_smon_XE
oracle 22529 1 0 14:53 ? 00:00:00 xe_reco_XE
oracle 22531 1 0 14:53 ? 00:00:00 xe_cjq0_XE
oracle 22533 1 0 14:53 ? 00:00:00 xe_mmon_XE
oracle 22535 1 0 14:53 ? 00:00:00 xe_mmnl_XE
oracle 22537 1 0 14:53 ? 00:00:00 xe_d000_XE
oracle 22539 1 3 14:53 ? 00:00:05 xe_s000_XE
oracle 22541 1 1 14:53 ? 00:00:02 xe_s001_XE
oracle 22543 1 0 14:53 ? 00:00:01 xe_s002_XE
oracle 22545 1 0 14:53 ? 00:00:00 xe_s003_XE
oracle 22550 1 0 14:53 ? 00:00:00 xe_qmnc_XE
oracle 22579 1 0 14:54 ? 00:00:00 xe_q000_XE
oracle 22581 1 0 14:54 ? 00:00:00 xe_q001_XE
oracle 22622 20226 0 14:56 pts/6 00:00:00 ps -ef
oracle 22623 20226 0 14:56 pts/6 00:00:00 grep oracle

Where is the software installed?

If we examine the startup scripts, or list the contents of the oracle XE package, we see the software gets installed in /usr/lib/oracle, just as many other debian packages. That’s the debian default. I can live with that.

What’s the oracle home?

The ORACLE_HOME is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server. That’s hidden quite far away from the root.

And how about the database of oracle XE?

The oracle XE database is called ‘XE’. That’s the db_name and the instance_name. The database is startup with a spfile, which is located in $ORACLE_HOME/dbs. The controlfile is located in the directory with the datafiles, which is: /usr/lib/oracle/xe/oradata/XE. The online redologfiles are located in: /usr/lib/oracle/xe/app/flash_recovery_area/XE/onlinelog and are called o1_mf_20onfoz2_.log and o1_mf_20onfnc0_.log.

Besides the fact that only one database can be run with XE (starting up a second instance results in: ORA-44410: XE edition single instance violation error), I still would love to see all files related to an oracle instance be kept in a single place. This eases administration, makes transportability easy, and makes backup and restore very much easier. Now the files are quite scattered among the oracle tree.

It is a bad idea to have the spfile (or init.ora file) (which is critical for starting up a database, it *must* be present) in the oracle software tree. I strongly advise to have a symlink in the dbs directory, instead of the real file.

The online redologfiles are reasonable sized for small installations without any batch ever. For normal database use (yes, I know, this is express, and NOT a normal database) I would start at a size of 200M. Also the number of redolog groups is quite small (2). Online redologfiles are *critical* to database transaction performance, and therefore need to be easily accessible for a DBA and need to have a reasonable names. The current names (o1_mf_20onfoz2_.log and o1_mf_20onfnc0_.log) are weird, and the place is odd to (somewhere in the flash_recovery_area). I would suggest placing the online redologfiles somewhere close to the datafiles, but on a separate filesystem. The online redologfile names are randomly choosen during the install.

How is the default database sized?


oracle@bedrock:~$ export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
oracle@bedrock:~$ export PATH=$PATH:$ORACLE_HOME/bin
oracle@bedrock:~$ export ORACLE_SID=XE
oracle@bedrock:~$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 5 15:20:54 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL>show parameter sga_max_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_max_size big integer 140M
SQL> show parameter pga_aggregate_target

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 41216K

Well, it is small, but the memory usage can be altered to 1G memory, according to the documentation.

Can we break it?

In essence, XE is a normal 10gr2 database, just limited. So all means to break it is also applicable to non-XE oracle databases! I very easily could get an unstartable database. Look at the following activity:


oracle@bedrock:~$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 5 15:24:51 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> alter system set cluster_database=true scope=spfile;

System altered.

SQL> shut
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-00439: feature not enabled: Real Application Clusters

This completely deadlocks the normal way to alter the spfile. Even a startup nomount can not be issued, because the database can not get to the nomount stage. The workaround is quite simple, though:


oracle@bedrock:~$ cd $ORACLE_HOME/dbs
oracle@bedrock:~/app/oracle/product/10.2.0/server/dbs$ strings spfileXE.ora | grep -v cluster_database > initXE.ora
oracle@bedrock:~/app/oracle/product/10.2.0/server/dbs$ rm spfileXE.ora
oracle@bedrock:~/app/oracle/product/10.2.0/server/dbs$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 5 16:31:44 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 146800640 bytes
Fixed Size 1257668 bytes
Variable Size 67112764 bytes
Database Buffers 75497472 bytes
Redo Buffers 2932736 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile;

File created.

SQL>

About these ads
24 comments
  1. Nice and clear review.
    I will try installing and running it too, just out of curiosity :)

  2. Yikes. Please don’t go around telling people to ‘strings’ their spfile! That is not how you recover from the act of stuffing your spfile. The correct approach is to export the spfile to a plain vanilla init.ora (which requires no instance), edit the init.ora, and then export back to being an spfile. That is:

    SQL> create pfile from spfile;
    SQL> host;
    # vi $ORACLE_HOME/dbs/initSID.ora
    # exit
    SQL> create spfile from pfile;
    SQL> startup

    ORACLE_HOME/dbs is the entirely *correct* location for these configuration files, and I’d advise people not to get into the habit of symlinking to elsewhere as you suggest, because that approach won’t work on (whisper it quietly) Windows -and you ought, wherever possible, to do things in as cross-platform a way as possible.

    If you must store your spfile somewhere non-standard, leave behind an initSID.ora in the ORACLE_HOME/dbs directory that contains one line: SPFILE=/somewhere/else/spfileSID.ora

    I am dubious about XE, I must say, but it is good to have an rpm/deb install of an Oracle product on Linux at last, and it’s also good to know that non-Red Hatish platforms are finally catered for.

  3. Administrator said:

    Howard, I understand your reluctance about using strings. In reality there is no real difference between using ‘strings’ and ‘create pfile from spfile’, except that you are using sqlplus instead of a linux/unix executable.

    About cross-platform using oracle: I see too much difference between the windows platform and the unix/linux platform. Oracle on windows requires a total different approach in administration (drives instead of mountpoints, no symlinks, services, difficult scripting, absence of a full-blown shell, rdesktop/terminal server, database directory instead of dbs directory, debugging problems on windows is problematic because of the absence of tools like strace and gdb/adb/dbx/etc, painful te detect usage patterns of processes, oracle organized in threads instead of process which makes usage even hard to detect, etc)

    This is the reason we keep a strict seperation between oracle on unix/linux and oracle on windows.

  4. Yuri van Buren said:

    Nice testing.

    One comment on the redolog files: o1_mf_20onfoz2_.log
    These are Oracle managed files.

    From 10.x oracle stores these in the flash_recovery_area.
    Indeed we like to have more sensible names.

    Can you add redologs and drop the two with the OMF names?

    Have you tested the maxsize of USERS data ( Oracle says a customer may use XE up to 4Gb of User data, is this checked?).

    Oracle says XE runs only on one CPU? Is this checked?

  5. Great article. I am just sad I dont know how to reply properly, though, since I want to show my appreciation like many other.

  6. skynyrd said:

    Congratulations for the article.

    Im strugling with Oracle XE on SUSE LInux. Let me tell you why.

    I first installed oracle XE on my machine with a SUSE 10 OS and everything went smoothly. The database is working like a charm.

    Then I did exactly the same instalation on my friends machine (in the same network) and it didnt work!

    Conecting to the web interface I got:
    connection refused

    and in SQLPLUS I got:
    ORA-01034: ORACLE not avaliable
    ORA-27101: shared memory realm does not exist
    Linux error: 2: No such file or directory

    After almost going crazy, we figured out that, if we disconected the machine from the network, and rebooted the machine, it started working!

    Well, I asumed oracle did that for making sure that there is only one instance in the network.

    But here is something strange: If I disconected my machine from the network and connected my friends, it was supose to work. Becouse I’ll be running only one instance, right?

    Well, it doesnt.
    Cant understand why.

    What happens is that, while the machine is out of the network, the oracle xe works fine. I can connect to the web interface. SQLPLUS without any problem.

    Once I plug the network back to the machine… ORACLE falls!

    In SQLPLUS I can connect, but the instance is turned to idle.

    I try to run

    startup pfile=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/init.ora

    and it says SHARED POOS SIZE is to small.

    I set it to a larger size and I got a ORA-00600 error…

    Maybe you could help me to understand.

    Regards

  7. Administrator said:

    The ORA-27101 means the listener configuration is not correct, or the database is not functioning. (it actually means you are pointed to a shared memory location where no database exists)

    You seem to be using a pfile. Default, the XE database got a spfile. Can you try to use the one which came with the installation?

  8. skynyrd said:

    problem solved:

    I just changed my IP setting to manual insted of using a DHCP server

    Thanks anyway!

  9. Administrator said:

    Your database should start, regardless of the IP setting. The listener is the networking component.

  10. Rodrigo said:

    Hi, i’ve a question, where is the web administrator tool, because i was installed the oracle-xe-universal in a debian machine but i don’t know where is that tool, i try to http://localhost:8080/apex but this page not found in my server :S please help me :P

  11. Rodrigo said:

    sorry, but the port is 5500; we need another configuration? by example in apache?, the display error is: conection refused…. not connect whit site in localhost. thank for u help

  12. Marcelo said:

    i have installed oracle on debian (unstable), the steps will be completed succesfully, but, when insert the url of web administration ( in this case http://localhost:5500/apex/ ) don’t run the aplication on the browser, don’t know the error because php and apache it’s run nice, but are not conected whit de web interface.
    thanks for you help

  13. bigie said:

    hy I have some question… :)
    how to change apex folder on oracle xe 10?
    thank’s d3

  14. Muhammad Imran said:

    I really enjoyed your article!
    thanks for writing such a nice article.

    All the Best,

    Muhammad Imran

  15. Roy Donasco said:

    I also encountered problem loading http://localhost:8080/apex, what i did is:

    # sudo -i
    # su – oracle
    # export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
    # export PATH=$PATH:$ORACLE_HOME/bin
    # export ORACLE_SID=XE
    # sqlplus / as sysdba
    # exec dbms_xdb.sethttpport(8081)

    Then I restarted oracle, still nothing happened.

    I tried the same approach but this time, i changed it back to port 8080, and it worked. Strange eh?

    Regards,
    Roy Donasco

  16. Martin said:

    Hi

    I’m new to Oracle XE – 10g Release 2 (10.2)
    Can you guide me on how to attach/connect/access external older version database file name.db to new XE ?

    Thanks

  17. Jorgen Trommler said:

    Roy Donasco ‘ s post helped me about apex it works thanks for all posting

    • Roy Donasco said:

      I’m glad i was able to help. 😃

  18. Erick Dennis said:

    Hello,

    I installed Oracle XE, on a Ubuntu 8.04 Server, and encountered problem loading http://localhost:8080/apex (“not found page”) after install. At the end it was because I need to install “bc” package. So I installed bc, and reinstall the oracle package, and that’s it!.

    https://help.ubuntu.com/community/Oracle10g

    Hope this could help somebody.

  19. Uli said:

    Hi,

    I also have the problem:


    SQLPLUS I got:
    ORA-01034: ORACLE not avaliable
    ORA-27101: shared memory realm does not exist
    Linux error: 2: No such file or directory

    What is the solution, it didn t become clear to me.

    Cheers,

    Uli

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,191 other followers

%d bloggers like this: