1、安装环境:
Linux
企业版5.4,内存不小于1G,硬盘大于8G,在本环境中linux的地址192.168.1.80。oracle版本:10g
安装步骤:
2
、修改hosts文件:
[root@Eleven ~]# hostname
Eleven.localdomain
[root@Eleven ~]# vim /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 Eleven.localdomain localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.80 Eleven.localdomain
3
、以root登录,挂载linux iso文件:
[root@Eleven ~]# mkdir /mnt/cdrom
[root@Eleven ~]# mount /dev/cdrom /mnt/cdrom/
4
、检查所需的软件包是否安装,如果还没安装,则需安装:
sudo-1.6.9p17-5.el5.i386.rpm
binutils-2.17.50.0.6-12.el5.i386.rpm
compat-db-4.2.52-5.1.i386.rpm
compat-libstdc++-296-2.96-138.i386.rpm
control-center-2.16.0-16.el5.i386.rpm
gcc-4.1.2-46.el5.i386.rpm
gcc-c++-4.1.2-46.el5.i386.rpm
glibc-2.5-42.i386.rpm
glibc-common-2.5-42.i386.rpm
libstdc++-4.1.2-46.el5.i386.rpm
libstdc++-devel-4.1.2-46.el5.i386.rpm
make-3.81-3.el5.i386.rpm
pdksh-5.2.14-36.el5.i386.rpm
sysstat-7.0.2-3.el5.i386.rpm
setarch-2.0-1.1.i386.rpm
libXp-1.0.0-8.1.el5.i386.rpm
(此软件包如不安装下面一步将无法进行)
以上软件包都在系统光盘的Server的仓库里,因在此使用的是linux5.4光盘,不同的光盘镜像这些软件包的版本可能不相同。
5
、创建所需的用户和组:
[root@Eleven Server]# groupadd dba
[root@Eleven Server]# groupadd oinstall
[root@Eleven Server]# groupadd oper
[root@Eleven Server]# useradd -g oinstall -G dba,oper oracle
给用户oracle设置密码,这里将密码设为oracle:
[root@Eleven Server]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
6
、
[root@Eleven Server]# vim /etc/sysctl.conf
加入下面的内容:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
7
、
[root@Eleven Server]# vim /etc/security/limits.conf
添加下面的内容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
8
、
[root@Eleven Server]# vim /etc/pam.d/login
添加下面的内容:
session required /lib/security/pam_limits.so
session required pam_limits.so
9
、
[root@Eleven Server]# vim /etc/profile
添加下面的内容:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
10
、创建相应的文件并修改其权限值:
[root@Eleven Server]# mkdir -p /u01/app/oracle
[root@Eleven Server]# chown -R oracle:oinstall /u01/app/oracle
[root@Eleven Server]# chmod -R 775 /u01/app/oracle/
[root@Eleven Server]# mkdir /u01/flash_recovery_area
[root@Eleven Server]# chown oracle:oinstall /u01/flash_recovery_area/
[root@Eleven Server]# chmod 775 /u01/flash_recovery_area/
11
、切换至oracle用户:
[root@Eleven Server]# su - oracle
[oracle@Eleven ~]$ vim .bash_profile
添加下面的内容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0
export ORACLE_SID=eleven # ORACLE_SID
是自己命名的,建议用小写,且不超过8个字
12
、
[oracle@Eleven ~]$ . .bash_profile
[oracle@Eleven ~]$ env | grep ORA
ORACLE_SID=eleven
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0
13
、测试图形界面(此步骤需到VM中的图形界面中去操作):
切换至oracle用户下:
执行xclock
如出现如下错误:
则需在管理员下执行xhost local:oracle
然后再在oracle用户下执行:xclock:
14、将oracle的安装光盘挂载到linux系统中:
[oracle@Eleven ~]$ exit
[root@Eleven Server]# cd
[root@Eleven ~]# umount /mnt/cdrom/
[root@Eleven ~]# mount /dev/cdrom /mnt/cdrom/
[root@Eleven ~]# su - oracle
[oracle@Eleven ~]$ ll /mnt/cdrom/
total 2
dr-xr-xr-x 1 root root 2048 Jul 2 2005 database
15
、安装
[oracle@Eleven ~]$ cd /
[oracle@Eleven /]$ /mnt/cdrom/database/runInstalle
下面看到安装的进度界面:
16、创建监听器
先配置.bash_profile
[oracle@Eleven /]$ cd
[oracle@Eleven ~]$ vim .bash_profile
添加下面的内容:
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@Eleven ~]$ . .bash_profile
[oracle@Eleven ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2012 03:34:40
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[oracle@Eleven ~]$ netca
下面直接单击next即可,
下面还是直接选择next即可,直到结束。
再次查看状态:
[oracle@Eleven ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-MAR-2012 03:49:20
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=Eleven.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 16-MAR-2012 03:42:25
Uptime 0 days 0 hr. 6 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Eleven.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
17
、建库
[oracle@Eleven ~]$ dbca
出现图形界面直接选择next
显示安装库的进度:
安装好后测试:
[oracle@Eleven ~]$ sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 16 04:11:13 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: sys as sysdba
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7566 JONES MANAGER 7839 02-APR-81 2975
20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400
30
7698 BLAKE MANAGER 7839 01-MAY-81 2850
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7782 CLARK MANAGER 7839 09-JUN-81 2450
10
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7839 KING PRESIDENT 17-NOV-81 5000
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0
30
7876 ADAMS CLERK 7788 23-MAY-87 1100
20
7900 JAMES CLERK 7698 03-DEC-81 950
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7902 FORD ANALYST 7566 03-DEC-81 3000
20
7934 MILLER CLERK 7782 23-JAN-82 1300
10
14 rows selected.
可知oracle已成功安装在linux上了;
也可以通过浏览器访问管理:
在浏览器中输入:http://192.168.1.80:1158/em
输入用户名sys和密码,连接身份选择SYSDBA
(注意在显示此界面之前需先授权,方法单价浏览器的右下角的授权按钮)
至此oracle已成功安装在linux上了;
补充:
Oracle 10g
的g是"Grid"缩写,支持网格计算,即,多台结点服务器利用高速网络组成一个虚拟的高性能服务器,负载在整个网格中均衡(Load Balance),按需增删结点,避免单点故障(Single Point of Faliure)。