Oracle 11gr2 XE on Linux64

阅读更多
XE is free to download and use for development. Currently, it only provides Linux64 version (x86_64) or Win32.

Firstly, you need a Oracle account to download the RPM package from Oracle official website, of course. In this tutorial, I have oracle-xe-11.2.0-1.0.x86_64.rpm downloaded. And I used RHEL 5.0, which is officially supported by this version of Oracle. Corresponding CentOS5 should work well too.

Another very important package is rlwrap-0.37-1.el5.i386.rpm, if you want to use SqlPlus in Linux shell, check "Try SqlPlus" section.


1. Installation: Official Doc
# a. download
# b. install
sudo rpm -ivh downloads/oracle-xe-11.2.0-1.0.x86_64.rpm


2. Configuration

# add oracle variables to your personal profile (i.e. ~/.bashrc)
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe


# a. start the configure process
# for the last question "Whether you want the database to starts
# automatically when the computer starts (next reboot)?"
# please choose YES because this will create and configure the default
# database instance for you automatically and you can disable db auto-start later
# by sudo /etc/init.d/oracle-xe disable
sudo /etc/init.d/oracle-xe configure

# b. reboot (suggested)
sudo reboot

# c. check Oracle status, and it should print messages like:
#
# LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 19-MAR-2013 16:18:37
# 
# Copyright (c) 1991, 2011, Oracle.  All rights reserved.
# 
# Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
# STATUS of the LISTENER
# ------------------------
# Alias                     LISTENER
# Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
# Start Date                19-MAR-2013 15:54:18
# Uptime                    0 days 0 hr. 24 min. 19 sec
# Trace Level               off
# Security                  ON: Local OS Authentication
# SNMP                      OFF
# Default Service           XE
# Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
# Listener Log File         /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/XIS3TM04/listener/alert/log.xml
# Listening Endpoints Summary...
#   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
#   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XIS3TM04.spss.com)(PORT=1521)))
#   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XIS3TM04.spss.com)(PORT=8080))(Presentation=HTTP)(Session=RAW))
# Services Summary...
# Service "PLSExtProc" has 1 instance(s).
#   Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
# Service "XE" has 1 instance(s).
#   Instance "XE", status READY, has 1 handler(s) for this service...
# Service "XEXDB" has 1 instance(s).
#   Instance "XE", status READY, has 1 handler(s) for this service...
# The command completed successfully

# if not, check the deinstalltion section

sudo /etc/init.d/orace-xe status

# d. if not, try to restart the oracle by yourself
sudo /etc/init.d/oracle-xe stop
sudo /etc/init.d/oracle-xe start


3. Try SqlPlus

# to use command history feature in sqlplus, you need rlwrap:
# http://stackoverflow.com/questions/3456024/sqlplus-history-under-linux
sudo rpm -ivh rlwrap-0.37-1.el5.i386.rpm

# add oracle executable to your personal profile (i.e. ~/.bashrc)
export PATH=$ORACLE_HOME/bin:$PATH

# add following lines to your .bashrc to ease the sqlplus login
alias sqll="sqlplus SYSTEM/ @XE"
alias sqlwrap="rlwrap sqlplus SYSTEM/@XE"
# or
alias sqll="sqlplus SYS/ @XE AS SYSDBA"
alias sqlwrap="rlwrap sqlplus SYS/ @XE AS SYSDBA"


# create a login.sql in your working directory, this script will be
# executed automatically when you start sqlplus

# source your profile and simply type 'sqlwrap' in bash to login SqlPlus
. .bashrc
sqlwrap

# to exectue sql script file without login
echo exit | sqlplus user/pass@connect @scriptname




4. Deinstallatin & Diagnostic: Official Doc

# b. in addition of steps above, if you are re-installing
#    also clean the dir '/var/temp/.oracle'
# c. check if user 'oracle' is functional
# log in and check environment variable like above
su - oracle



你可能感兴趣的:(oracle,linux)