Wednesday, July 16, 2014

oracle-11g server/client in cetos 6.5

SERVER

1. download
oracle-xe-11.2.0-1.0.x86_64.rpm

2. install
BASH> sudo rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

3. initial configure the database

BASH> sudo /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g 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: INIT_PASSWORD
Confirm the password: INIT_PASSWORD
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...
DoneConfiguring database...
DoneStarting Oracle Database 11g Express Edition instance...
DoneInstallation completed successfully.

CLIENT
(although sqlplus comes together with SERVER installation, e.g. /u01/app/oracle/product/11.2.0/xe/sqlplus)

1. download
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

2. install
BASH> sudo rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
...
BASH> sudo rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
sqlplus executable is to be found here: /usr/lib/oracle/11.2/client64/bin/

3. set environment variables
ORACLE_HOME should be set to /usr/lib/oracle/11.2/client64/ --- one level above the bin directory where sqlplus executable is found etc...
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export ORACLE_HOME_LISTNER=/usr/lib/oracle/11.2/client64/bin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
export SQLPATH=/usr/lib/oracle/11.2/client64/lib
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/bin

4. verify if sqlplus works
BASH> $ORACLE_HOME/bin/sqlplus -V

SQL*Plus: Release 11.2.0.4.0 Production

5. try connect to server
BASH> $ORACLE_HOME/bin/sqlplus -L system/INIT_PASSWORD@//localhost:1521/

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 16 15:20:54 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved

Connected to:

Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> quit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

TIP
install rlwrap to get a more user-friendly SQL> shell, e.g.
BASH> rlwrap $ORACLE_HOME/bin/sqlplus -L system/INIT_PASSWORD@//localhost:1521/










No comments:

Post a Comment