Translation(s): English - ?Português

Work in progress

Oracle

# Oracle XE Debian repository
deb http://oss.oracle.com/debian unstable main non-free

Preparations

Creating users and groups

# addgroup --system oinstall
# addgroup --system dba
# adduser --system --ingroup oinstall --shell /bin/bash oracle
# adduser oracle dba

Oracle requirements (sysctl and security limits)

sysctl

fs.file-max = 65536
fs.aio-max-nr = 1048576
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
# (Oracle recommends total machine Ram -1 byte)
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
net.ipv4.ip_local_port_range = 1024 65000
vm.hugetlb_shm_group = 111
vm.nr_hugepages = 64

# sysctl -p /etc/sysctl.d/local-oracle.conf

security limits

oracle          soft    nproc           2047
oracle          hard    nproc           16384
oracle          soft    nofile          1024
oracle          hard    nofile          65536
oracle          soft    memlock         1677721
oracle          hard    memlock         1677721

Nasty hacks

# ln -s /usr/bin/awk /bin/awk
# ln -s /usr/bin/basename /bin/basename
# ln -s /usr/bin/rpm /bin/rpm
# ln -s /usr/lib/x86_64-linux-gnu /usr/lib64

Directory Structure

Create a directory structure required to install Oracle DataBase.

# mkdir -p /opt/oracle/product/12.1.0.2
# mkdir -p /opt/oraInventory
# chown -R oracle:dba /opt/oracle/
# chown -R oracle:dba /opt/oraInventory

Oracle on Debian (amd64)

Initial steps

We need to install some packages

Unzip the Oracle files

Unzip the Oracle files in the user's $HOME directory.

oracle@oracle:~$ unzip linuxamd64_12XXX_database_1of2.zip 
oracle@oracle:~$ unzip linuxamd64_12XXX_database_2of2.zip

Environment variables

For example:

oracle@oracle:~# export ORACLE_HOSTNAME=localhost
oracle@oracle:~# export ORACLE_OWNER=oracle
oracle@oracle:~# export ORACLE_BASE=/opt/oracle
oracle@oracle:~# export ORACLE_HOME=/opt/oracle/product/12.1.0.2/dbhome_1
oracle@oracle:~# export ORACLE_UNQNAME=orcl
oracle@oracle:~# export ORACLE_SID=orcl
oracle@oracle:~# export PATH=$PATH:$ORACLE_HOME/bin
oracle@oracle:~# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/bin/lib:/lib/x86_64-linux-gnu/:/usr/lib64

Installation

$ ssh -XC $SOMEUSER@orclserver.example.org

$ ssh -XC $SOMEUSER@orclserver.example.org

$ xauth list
orclserver/unix:10  MIT-MAGIC-COOKIE-1  abcdef0123456789abcdef0123456789

$ su - oracle
$ xauth add orclserver/unix:10  MIT-MAGIC-COOKIE-1  abcdef0123456789abcdef0123456789

$ /path/to/oracle/database/runInstaller -IgnoreSysPreReqs

Common problems

gcc-multilib: linking pthread problems

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/.../libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread

INFO: collect2: ld returned 1 exit status

INFO: make: *** [ctxhx] Error 1

INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'install' of makefile '/opt/oracle/product/10.2.0/db_1/ctx/lib/ins_ctx.mk'.

First steps

Start Oracle

oracle@debian-sid:~$ . /usr/local/bin/oraenv
oracle@debian-sid:~$ dbstart $ORACLE_HOME

Start Oracle on Systemd

Create daemon  "/etc/systemd/system/oracle.service" , that will set up database services.

[Unit]
Description=Oracle 12c DataBase
Requires=rpc-statd.service network.target nfs.service nfs-mountd.service local-fs.target remote-fs.target
After=syslog.target network.target

[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
LimitNPROC=16384
LimitSTACK=10485760
Type=forking
Environment="ORACLE_HOME=/opt/oracle/product/12.1.0.2/dbhome_1"
ExecStart=/bin/su oracle -c '/opt/oracle/product/12.1.0.2/dbhome_1/bin/dbstart $ORACLE_HOME'

[Install]
WantedBy=multi-user.target

Updates changes made to service files of system, enables Oracle service and starts it up. Note that limits are compulsory since systemd ignore limits.conf defined earlier, moreover note that limitSTACK use a different measure unit compared to ulimit, so it should be converted from the value in limits.conf.

root@oracle:~# systemctl daemon-reload
root@oracle:~# systemctl enable oracle
root@oracle:~# systemctl start oracle

Add Users

Let say you need a couple of users scott and foo with passwords tiger and bar in order to run the DBD::Oracle Perl module tests. You can add those users running the following steps:

oracle@debian-sid:~$ sqlplus SYS AS SYSDBA
SQL> CREATE USER c##scott IDENTIFIED BY tiger;
User created.
SQL> GRANT ALL PRIVILEGES TO c##scott;
Grant succeeded.
SQL> CREATE USER c##foo IDENTIFIED BY bar;
User created.
SQL> GRANT ALL PRIVILEGES TO c##foo;
Grant succeeded.

References

There is a great reference document that helped clearing up some doubts with regards to what should I add or not in terms of configuration, it is an official Oracle documentation called Oracle® Database Quick Installation Guide, it briefly documents the aspects of installation in Linux x86-64 (amd64):


CategoryProprietarySoftware