Difference between revisions of "Oracle Database"

From ArchWiki
Jump to navigation Jump to search
(=Setting Permissions for Normal Users)
Line 177: Line 177:
  sqlplus '/as sysdba'
  sqlplus '/as sysdba'
===Setting Permissions for Normal Users==
===Setting Permissions for Normal Users===

Revision as of 11:24, 28 February 2009


This document will help you intall the Oracle Database 11gR1 on Arch Linux. By using the Arch Linux package in AUR, you will be able to finalize the long installation process with only few steps.


Step 1. Download the Arch Linux package from AUR: http://aur.archlinux.org/packages.php?ID=23730 Download the Oracle database 11gR1: http://www.oracle.com/technology/software/products/database/index.html

Note: Oracle database 11gR1 for 64-bit Linux doesn't complete the installation properly on Arch Linux.

Step 2. Extract the Arch Linux package into a directory. Copy the Oracle database 11gR1 into that directory as well. and install Oracle by using makepkg:

makepkg -s

In order to create the user oracle and the group dba, makepkg will ask for your root password. After that you'll need to set the password for the user oracle.

Step 3. Install the package that makepkg has created by using pacman:

 pacman -U oracle-11g-i686.pkg.tar.gz

Now pacman will execute Oracle's own installation script(./runInstaller -ignoreSysPrereqs)

Step 4.

4.1 Click on "Next". 
4.2 Chose "Enterprise Edition" Installation Type and click on "Next"
4.3 Oracle Base should be: /home/oracle/app/oracle. Don't change it, 
unless you know what you're doing. 
4.3.1 Change the default "Name" to orarch or something else. 
4.3.2 The predefined path in /etc/rc.d/oracledb is "orarch", ie: 
/home/oracle/app/oracle/product/11.1.0/orarch. If you want to use a 
different path you'll have to change /etc/rc.d/oracledb, so that 
the startup script can locate ORACLE_HOME directory.
4.3.3 After changing the defaults, click on "Next". 
4.4 Since Oracle database requires certain distro requirement, 
you'll have to manually check them and then click on "Next".
4.5 Chose "Software Install Only" and click on "Next".
4.6 There is only on DBA group for oracle database. Click on "Next".
4.7 Install "Summary" shows what's going to be installed. Click on "Install".
4.8 The installation will take some time, especially the "Linking" part. Be
patient! If you get an error message ignore it by clicking on "Continue".
4.8.1 At the end of the installation you'll have to open another terminal,
and execute /home/oracle/app/oracle/product/11.1.0/orarch/root.sh as root.
Don't klick on "OK" yet.
4.8.2 When running root.sh, you need to use /usr/local/bin as the full pathname.
Press the "Enter" key here.
4.8.3 Now you can click on "OK"
4.9 Installation is finnished, click on "Exit" and "Yes", you really want to exit.

Creating Database

Step 5. Now that you have only installed the Oracle Software, you need to create a database. Login as the user oracle:

su oracle

Export the ORACLE_HOME binary directory:

export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/orarch

Run database installation script:


Step 6.

6.1 Click on "Next".
6.2 Check "Create a Database" and click on "Next".
6.3 Check "General Purpose or Transaction Processing" and click on "Next".
6.4 Chose a database name and SID. Example: Global Database Name: archlinux, 
SID: archlinux. And then click on "Next".
6.5 Uncheck "Configure Enterprise Manager", leave it empty and click on "Next".
6.6 Check "Use the Same Administrative Password for All Accounts",
set password and click on "Next". 
6.7 Check "File System" and click on "Next".
6.8 Check "Use Database File Locations from Template" and click on "Next".
6.9 Uncheck "Specify Flash Recovery Area" and click on "Next".
6.10 No need for "Sample Schemas", click on "Next".
6.11 If you don't know what you're doing, check "Typical" and click on "Next"
6.12 Check "Keep the enhanced 11g default security settings" and click on "Next".
6.13 Uncheck "Enable automatic maintenance tasks" if you wish to do it by
yourself and click on "Next".
6.14 View your filesystem layout and click on "Next".
6.15 "Create Database" is checked by default. Click on "Finish" to create database.
6.16 Summary of following operations to be performed, click on "OK".
6.17 When database creation is complete, click on "Exit".

Testing Database

Login as the user oracle and run export ORACLE_SID="yourSID" etc., ie:

export ORACLE_SID=archlinux
export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/orarch

Running oraenv should confirm the exported configuration:

ORACLE_SID = [archlinux] ? 
The Oracle base for ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/orarch 
is /home/oracle/app/oracle

Check if the database is shutting down or starting:

sqlplus '/as sysdba'
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;

ORACLE instance started.

Total System Global Area  385003520 bytes
Fixed Size		    1300100 bytes
Variable Size		  234883452 bytes
Database Buffers	  142606336 bytes
Redo Buffers		    6213632 bytes
Database mounted.
Database opened.

Type "quit" when you want to leave SQL prompt:

SQL> quit 

Starting oracle during the boot

If you want to start with your oracle SID, replace ":N" with ":Y" in /etc/oratab:


To start the oracle database daemon during boot, add "oracledb" in your /etc/rc.conf:

DAEMONS=(oracledb syslog-ng dbus !network netfs crond ntpd alsa hal wicd fam)

Note: If the daemon doesn't start, please check that the ORACLE_HOME path matches your current oracle directory in /etc/rc.d/oracledb:

export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/orarch
[oracle@archlinux orarch]$ pwd

Test starting the daemon as root:

/etc/rc.d/oracledb start
Starting Oracle: 
LSNRCTL for Linux: Version - Production on 27-FEB-2009 23:14:45
The command completed successfully

Now you'll login to your oracle database each time you reboot:

su oracle
export ORACLE_SID=archlinux
sqlplus '/as sysdba'

Setting Permissions for Normal Users

Since there is only one user(oracle) that has access to the oracle database, you need to add your normal user to the group "dba". In this case "joe" is the normal user:

gpasswd -a joe dba

The user oracle has the permissions to access the oracle home directory(/home/oracle):

drwx------ 6 oracle dba 4096 2009-02-27 23:27 oracle

You need to grant the group "dba" permission to execute the binary files in the oracle home directory:

chmod -R g+x /home/oracle

Now you'll be able to run the oracle database as the normal user.


Known issue: Oracle database 11gR1 doesn't complete installation(linkage problem) on x86-64, due to gcc and make.

More Resources

Most of the steps are based on this oracle installation guide for ubuntu users. This guide includes step by step graphical examples: http://www.pythian.com/blogs/1355/installing-oracle-11gr1-on-ubuntu-810-intrepid-ibex