Oracle Database
Template:I18n links start Template:I18n entry Template:I18n links end
Introduction
This document will help you intall the Oracle Database 11gR1 on Arch Linux. By using the install method 2 you will be able to finalize the long installation process with only few steps.
Install method 1
Pre Installation
Installing Desktop Environment
pacman -Syu
pacman -S python pacman -U ftp://ftp.berlios.de/pub/aurbuild/aurbuild-1.8.4-1-any.pkg.tar.gz
Install and test Xorg.
pacman -S xorg pacman -S hwd
Since Xorg 7.4, xorg.conf isn't necessary anymore. This command is optional.
hwd -x cp /etc/X11/xorg.conf.vesa /etc/X11/xorg.conf
Check with startx (ctrl-alt-backspace to exit - should get mouse movement x cursor on lame screen).
startx
Install desktop environment, gnome, kde or xfce. In this case xfce4 will be installed:
pacman -S xfce4 pacman -S pcmanfm
Run xfce:
startxfce4 xfce4-session-logout
Required packages for Oracle database
Arch i686:
base-devel java-runtime(openjdk6 or jre jdk) ksh rpm gawk gdb libaio libelf sysstat unixodbc libstdc++5 unzip sudo
Arch x86_64:
base-devel java-runtime(openjdk6 or jre jdk) ksh rpm gawk gdb libaio libelf sysstat libstdc++5 unzip sudo
Install packages:
pacman -S unzip pacman -S sudo pacman -S java-runtime pacman -S base-devel
Install ksh (problem with aurbuild -s ksh).
mkdir -p ABS/ksh cd ABS/ksh chmod 777 -R /software wget --http-user "I accept www.opensource.org/licenses/cpl" --http-password "." http://www.research.att.com/~gsf/download/tgz/INIT.2008-11-04.tgz wget --http-user "I accept www.opensource.org/licenses/cpl" --http-password "." http://www.research.att.com/~gsf/download/tgz/ast-ksh.2008-11-04.tgz wget http://aur.archlinux.org/packages/ksh/ksh/PKGBUILD wget http://aur.archlinux.org/packages/ksh/ksh/ksh.install
Alter PKGBUILD to use local files by commenting out url property.
makepkg -c --asroot makepkg -i --asroot cd ..
pacman -S icu aurbuild -s beecrypt aurbuild -s rpm pacman -S gawk pacman -S gdb aurbuild -s libaio pacman -S libelf pacman -S sysstat pacman -S libstdc++5
Oracle database 32-bit requires unixodbc.
pacman -S unixodbc
Optional lib32 packages on x86_64:
pacman -S lib32-libstdc++5 pacman -S lib32-glibc pacman -S lib32-gcc-libs
Oracle database require 32-bit libaio and unixodbc on x86_64 but is not necessary under Arch linux.
Some prerequisite symbolic links for Oracle Universal Installer.
ln -s /usr/bin/rpm /bin/rpm ln -s /usr/bin/ksh /bin/ksh ln -s /bin/awk /usr/bin/awk ln -s /bin/tr /usr/bin/tr ln -s /usr/bin/basename /bin/basename
Arch x86_64:
ln -s /usr/lib /usr/lib64
Configuration
Create users and group for Oracle database:
groupadd oinstall groupadd dba useradd -m -g oinstall -G dba oracle
Set password for the user oracle:
passwd oracle
Optional: Add oracle to the sshd_config file.
pacman -S openssh
Add this line to /etc/ssh/sshd_config
AllowUsers oracle
Add oracle to /etc/sudoers. This will give oracle super user privilege.
oracle ALL=(ALL) ALL
Add these lines to /etc/sysctl.conf.
# oracle kernel settings fs.file-max = 6553600 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65535 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144
Add these lines to /etc/security/limits.conf.
# oracle settings oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
Create some directories for Oracle database. You can chose the directory path. Here is an example.
mkdir -p /u01/app/oracle mkdir -p /u01/app/oracle/inventory mkdir -p /u01/app/oracle/recovery mkdir -p /u01/app/oracle/product/11.1.0/db
Set permissions for the directories.
chown -R oracle:dba /u01 chmod 777 /tmp
Create or update oracle bashrc /home/oracle/.bashrc. Here is an example of the oracle user settings.
umask 022 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db export ORACLE_SID=xdb export ORACLE_INVENTORY=/u01/app/oracle/inventory export ORACLE_BASE ORACLE_SID ORACLE_HOME export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export EDITOR=nano export VISUAL=nano
Graphical Installation
Installing Oracle database softwares
Download the Oracle database from here: http://www.oracle.com/technology/software/products/database/index.html
Unzip the Oracle database.
Arch i686:
unzip linux_11gR1_database_1013.zip -d /media
Arch x86_64:
unzip linux.x64_11gR1_database_1013.zip -d /media
Optional: Arch x86_64:
cd /media/database/install mv unzip unzipx ln -s /usr/bin/unzip
Change the permissions for the extracted Oracle database.
chmod -R 777 /media/database chown -R oracle:oinstall /media/database
Enter the directory where you extracted the Oracle database.
In oder to run oracle installation script you need to export the X display as a normal user:
DISPLAY=:0.0; export DISPLAY; xhost +
Login as the user oracle and export the X display:
su oracle DISPLAY=:0.0; export DISPLAY
Enter the database directory and run the Oracle Universal Installer as the user oracle.
cd /media/database ./runInstaller -ignoreSysPrereqs
During the Graphical installation:
1 Click on "Next".
2 Chose "Enterprise Edition" Installation Type and click on "Next"
3 Oracle Base should be: /u01/oracle. Don't change it, unless you know what you're doing.
3.1 Change the default "Name" to orarch or something else.
3.2 The predefined path in /etc/rc.d/oracledb is "db", ie: /u01/oracle/product/db. 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.
3.3 After changing the defaults, click on "Next".
4 Since Oracle database requires certain distro requirement, you'll have to manually check them and then click on "Next".
5 Chose "Software Install Only" and click on "Next".
6 There is only one DBA group for oracle database. Click on "Next".
7 Install "Summary" shows what's going to be installed. Click on "Install".
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".
8.1 At the end of the installation you'll have to open another terminal, and execute /u01/oracle/product/db/root.sh as root. Don't klick on "OK" yet.
8.2 When running root.sh, you'll be offered to use /usr/local/bin as the full pathname. Press the "Enter" key here.
8.3 Now you can click on "OK"
9 Installation is finnished, click on "Exit" and "Yes", you really want to exit.
Creating Database
You have only installed the Oracle database softwares. Now you need to create a database. Login as the user oracle:
su oracle
Export the ORACLE_HOME binary directory:
export ORACLE_HOME=/u01/oracle/product/db export PATH=$PATH:$ORACLE_HOME/bin
Run database installation script:
dbca
During the graphical installation:
1 Click on "Next". 2 Check "Create a Database" and click on "Next". 3 Check "General Purpose or Transaction Processing" and click on "Next". 4 Chose a database name and SID. Example: Global Database Name: archlinux, SID: archlinux. And then click on "Next". 5 Uncheck "Configure Enterprise Manager", leave it empty and click on "Next". 6 Check "Use the Same Administrative Password for All Accounts", set password and click on "Next". 7 Check "File System" and click on "Next". 8 Check "Use Database File Locations from Template" and click on "Next". 9 Uncheck "Specify Flash Recovery Area" and click on "Next". 10 No need for "Sample Schemas", click on "Next". 11 If you don't know what you're doing, check "Typical" and click on "Next" 12 Check "Keep the enhanced 11g default security settings" and click on "Next". 13 Uncheck "Enable automatic maintenance tasks" if you wish to do it by yourself and click on "Next". 14 View your filesystem layout and click on "Next". 15 "Create Database" is checked by default. Click on "Finish" to create database. 16 Summary of following operations to be performed, click on "OK". 17 When database creation is complete, click on "Exit".
Post Installation
Create an oracledb daemon and place it in /etc/rc.d. Here is an example of the racledb file:
#!/bin/bash # # /etc/rc.d/oracledb # # Run-level Startup script for the Oracle Listener and Instances # It relies on the information on /etc/oratab export ORACLE_BASE=/u01/oracle export ORACLE_HOME=/u01/oracle/product/db export ORACLE_OWNR=oracle export PATH=$PATH:$ORACLE_HOME/bin if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" touch /var/lock/oracle echo "OK" ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" rm -f /var/lock/oracle echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0
Make it executable:
chmod +x /etc/rc/oracledb
To start the daemon during boot, add oracledb in /etc/rc.conf.
DAEMONS=(oracledb syslog-ng ...)
For more information on post installation, please check out the second post installation section.
Install method 2
Installation
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
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
Step 3. Install the package that makepkg has created by using pacman.
Arch i686:
pacman -U oracle-11gR1-1-i686.pkg.tar.gz
Arch x86_64:
pacman -U oracle-11gR1-1-x86_64.pkg.tar.gz
Pacman will now execute Oracle's own installation script(./runInstaller -silent -ignoreSysPrereqs).
The installation will take som time, please be patient. Do not exit terminal during database installation, especially when the installation script is executing configuration assistants:
.... Starting to execute configuration assistants Configuration assistant "Oracle Net Configuration Assistant" succeeded ...
The installation script ends something like this:
The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root script to run /home/oracle/oraInventory/orainstRoot.sh /home/oracle/app/oracle/product/11.1.0/orarch/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts The installation of Oracle Database 11g was successful. Please check '/home/oracle/oraInventory/logs/silentInstall2009-03-03_07-24-10PM.log' for more details.
Step 4. Run these scripts as root:
[ahc@archlinux ~]$ su Password:
cd /home/oracle/oraInventory ./orainstRoot.sh
cd /home/oracle/app/oracle/product/11.1.0/orarch ./root.sh
Step 5. The default user for the Oracle database is "oracle". Since the password is not set for the user oracle, you need to run passwd as root:
passwd oracle
Step 6. Change the administration password for SYS and SYSTEM. Login as the user oracle.
su oracle
sqlplus "/as sysdba"
SQL> show user USER is "SYS"
passw system Changing password for system New password: Retype new password: Password changed
SQL> quit
sqlplus "/as system"
SQL> passw sys Changing password for sys New password: Retype new password: Password changed
SQL> quit
Post Installation
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 export PATH=$PATH:$ORACLE_HOME/bin
Running oraenv should confirm the exported configuration:
oraenv
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:
archlinux:/home/oracle/app/oracle/product/11.1.0/orarch:N
archlinux:/home/oracle/app/oracle/product/11.1.0/orarch:Y
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 /home/oracle/app/oracle/product/11.1.0/orarch
Test starting the daemon as root:
/etc/rc.d/oracledb start
Starting Oracle: LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 27-FEB-2009 23:14:45 ... The command completed successfully Processing Database instance "archlinux": log file /home/oracle/app/oracle/product/11.1.0/orarch/startup.log OK
Now you'll login to your oracle database each time you reboot:
su oracle export ORACLE_SID=archlinux oraenv 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 group changes will take effect after you logout and login again. The user oracle has the permissions to access the oracle home directory, ie /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.
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