UNIX / Notes on Oracle (draft)

Home | UNIX | Practical

Notes on Oracle (draft)


Installation
Make sure thoses packages are installed,
gcc
libXtst
openmotif

Tweek the system,
vi /etc/sysctl.conf
For example,
fs.file-max = 65536
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

Also,
vi /etc/security/limits.conf
For example,
@dba  soft  nproc  2047
@dba  hard  nproc  16384
@dba  soft  nofile  2048
@dba  hard  nofile  65536

PAM
session  required  pam_limits.so

Edit oracle's profile,
vi ~oracle/.bash_profile
For example,
ORACLE_BASE=/home/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/rdbms111; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NFS_LANG
TMP=$ORACLE_BASE/tmp; export TMP
ORACLE_SID=V111; export ORACLE_SID
EDITOR=vi; export EDITOR
umask 022
Note. to setup ORACLE_HOME, locate the product/10* folder or something alike.

As for oracle-xe's the variables you may source this file inside oracle's.profile
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

Launch the installer,
/path/to/runInstaller
Note. in case the system version doesn't match (in example while installing 10g on RHEL5) try this,
/path/to/runInstaller -ignoreSysPrereqs

Eventually make the init scripts yourself. As for Oracle-XE, it's installed here,
ls -l /etc/init.d/oracle-xe


System administration
A few commands,
lsnrctl start
lsnrctl status
ps aux | grep ora  # see if a database is mounted/started

As for oracle-xe, to disable Oracle XML DB HTTP Server,
sqlplus '/ as sysdba'
EXEC DBMS_XDB.SETHTTPPORT(0);
Or to configure it differently,
exec DBMS_XDB.setListenerEndPoint('1','0.0.0.0','8080','1');
EXEC DBMS_XDB.SETHTTPPORT(8090);


Oracle SQL*Plus
Do all the database maintenance as user,
su - oracle
oraenv ...
[...]

Beside ORACLE_HOME and all that defined in ~oracle/.bash_profile set the ORACLE_SID variable to the database you need to maintain, start or shutdown.
Note. to setup ORACLE_SID, enter the datadir and list its content (e.g. oradata/).
Then,
sqlplys '/ as sysdba'
or
sqlplus sys/lala@$ORACLE_SID as sysdba

Note this alternative (same),
sqlplus /nolog
connect sys / as sysdba

To create the pfile,
CREATE pfile='inittest.ora' FROM spfile='/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/spfileXE.ora';

Some useful SQL commands,
startup
startup mount
startup mount pfile=init.ora
alter database archivelog;
alter database open;

archivelog list;
archivelog all;

alter database close;
shutdown
shutdown immediate
shutdown abord

Refs.
otn.oracle.com/tech/sql_plus/
otn.oracle.com/documentation/


APEX (Oracle Application Express) web interface
To connect to the interface,
XX.XX.XX.XX:8080/apex

Create a table using the interface,
Object Browser > Create > X columns

Then logout, login again and go to,
Object Browser
Check table is there.

Refs.
www.oracle.com/technology/products/database/application_express/html/doc.html
www.oracle.com/pls/xe102/homepage


Random notes
Oracle Application Express is installed in the FLOWS_030100 schema.
The structure of the link to the Application Express administration services is as follows:
host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
host:port/apex/apex_admin (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
The structure of the link to the Application Express development interface is as follows:
host:port/pls/apex (Oracle HTTP Server with mod_plsql)
host:port/apex (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)


References
Oracle 10g on Gentoo : www.linux-services.org/oracle/
DBA blog : bderzhavets.blogspot.com/
Oracle by example, www.oracle.com/technology/obe/start/db.html
www.oracle.com/technology/docs/tech/sql_plus/index.html
didier.deleglise.free.fr/introra/intro_ora.htm
Simple SQL guide, w3schools.com/sql/sql_select.asp
FAQ, www.orafaq.com/wiki/SQL*Plus_FAQ
oracle.developpez.com/guide/
fadace.developpez.com/oracle/10g/short/
www.developpez.net/forums/showthread.php?t=28716
SQL formatter, www.sqlinform.com/
Book www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm
forums.oracle.com/forums/thread.jspa?threadID=370443&tstart=0
Hans Forbrich, forums.oracle.com/forums/profile.jspa?userID=388343
Security, www.red-database-security.com/wp/hacking_and_hardening_oracle_XE.pdf
HTTP listen, patryk.kuzmicz.name/2007/11/oracle-10g-xe-apex-zmiana-nasuchu.html
download.oracle.com/docs/cd/E10513_01/doc/install.310/e10496/post_inst.htm#CIHGAGGB
www.rci-informatique.fr/oracle11g/
didier.deleglise.free.fr/dba/sauvegardes/sauve_main.htm
Tools, www.ordba.net/Tutorials/



Sat Nov 8 12:19:47 CET 2008
       © 2008 Pierre-Philipp Braun