操作系统准备工作
1.OS版本限制
2.磁盘空间限制
3.软件包依赖
4.主机名和解析地址
5.用户和资源限制(PAM)
6.系统资源限制(内核参数)
oracle10G的版本只支持到RHEL4,生产中建议安装官方认可的操作系统版本
如果是RHEL5需要修改一下系统中的版本识别文件
因为oracle安装包中的代码有检测操作系统的脚本
root@dba mnt]#cat /etc/redhat-release
CENTOS Server release 5.5 (Tikanga)
[root@dba mnt]# vim /etc/redhat-release
[root@dba mnt]# cat/etc/redhat-release
CENTOS Server release 4.5 (Tikanga)
空间需求
内存至少512M 交换分区至少1G
oracle软件安装位置1.3G
数据库安装位置至少1G
/tmp要有足够400M的剩余
如果这些目录都是隶属于根文件系统 那根需要有3G空闲才能安装 (1.3+1+0.4)
上述都属于最小要求 这是远远不够后期运行添加数据使用的.
并且随着后期运行oracle自身产生的文件会逐渐增大 请保留足够的空间需求
检查方法
[root@dba ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda2 ext3 15G 2.3G 12G 17% /
/dev/sda1 ext3 99M 12M 83M 12%/boot
tmpfs tmpfs 506M 0 506M 0%/dev/shm
[root@dba ~]#
[root@dba ~]# grep -E 'MemTotal|SwapTotal'/proc/meminfo
MemTotal: 1035108 kB
SwapTotal: 1076344 kB
检查系统包
不同的操作系统以及架构,所需要安装的系统包也不相同,这里仅以使用的 64bit
Oracle Enterprise Linux5 为例,需要下列系统包:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24(32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-2.2.11 (32 bit)
unixODBC-devel-2.2.11
unixODBC-devel-2.2.11 (32 bit)
主机名和解析地址
[root@dba ~]# hostname
dba.up.com
[root@dba ~]#
[root@dba ~]# ifconfig eth0 | head -n 2
eth0 Link encap:Ethernet HWaddr00:0C:29:9F:DF:4A
inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0
[root@dba ~]#
[root@dba ~]# grep -v '^#' /etc/hosts
127.0.0.1 localhost.localdomainlocalhost
10.10.10.10 dba.up.comdba
[root@dba ~]#
操作系统资源限制
添加到
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
加载参数 sysctl -p
kernel.shmall
Total amount of shared memory available (bytes orpages)
kernel.shmmax
Maximum size of shared memory segment(bytes)
建议大于等于SGA
kernel.shmmni
Maximum number of shared memory segmentssystem-wide
kernel.shmall*kernel.shmmni = 能够分配的内存大小
kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
SEMMSL Maximum number of semaphores per set
每个信号对象集的最大信号对象数;
SEMMNS Maximum number of semaphoressystem-wide
系统范围内最大信号对象数;
SEMOPM
每个信号对象支持的最大操作数;
SEMMNI Maximum number of semaphoreidentifiers
系统范围内最大信号对象集数。
其中 SEMMNS的值等于 SEMMSL*SEMMNI
fs.file-max
系统中所允许的文件句柄最大数目。
net.ipv4.ip_local_port_range
应用程序可使用的IPv4端口范围。
net.core.rmem_default
套接字接收缓冲区大小的缺省值
net.core.rmem_max
套接字接收缓冲区大小的最大值
net.core.wmem_default
套接字发送缓冲区大小的缺省值
net.core.wmem_max
套接字发送缓冲区大小的最大值
用户资源限制
建立oracle用户和组
建议指定GID和UID方式(尤其集群环境)
[root@dba ~]# groupadd -g 1000 oinstall
[root@dba ~]# groupadd -g 1001 dba
[root@dba ~]# useradd -u 1000 -g oinstall -G dbaoracle
[root@dba ~]# passwd oracle
建立oracle软件安装文件目录
[root@dba ~]# mkdir -p /u01/oracle
[root@dba ~]# chown -R oracle:oinstall /u01/
[root@dba ~]#
设置oracle环境变量
vi ~oracle/.bash_profile
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_SID=ora10g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
加载配置
oracle用户注销重新登录 或 source .bash_profile
ORACLE_BASE oracle产品基目录
ORACLE_HOME 数据库产品目录
通常情况下HOME目录是BASE的子目录ORACLE_HOME=$ORACLE_BASE/product/10.2.0
ORACLE_SID 操作系统和oracle实例关联的纽带
PATH 将安装后的oracle命令追加到执行搜索路径
LD_LIBRARY_PATH 动态库的位置
shell限制
[root@dba ~]# grep -v '^#' /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@dba ~]#
[root@dba ~]# grep 'limit' /etc/pam.d/system-auth
session required pam_limits.so
[root@dba ~]#
运行安装命令
若想支持中文界面 以后的EM或DBCA界面显示中文
安装界面乱码则 export LANG=C
安装
rpm -ivhttfonts-zh_CN-2.14-6.noarch.rpm
注销root使用oracle用户登录X-window执行安装命令 runInstaller如果安装包再光盘介质上 挂载后要绝对路径执行
若是su - oracle 切换用户 需要在切换前root执行 # xhost+ 否则oracle用户不能连接root的桌面
[root@dba ~]# /u01/oracle/oraInventory/orainstRoot.sh
更改权限/u01/oracle/oraInventory 到 770.
更改组名/u01/oracle/oraInventory 到 oinstall.
脚本的执行已完成
[root@dba ~]# /u01/oracle/product/10.2.0/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/oracle/product/10.2.0
Enter the full pathname of the local bin directory:[/usr/local/bin]:
Copying dbhome to/usr/local/bin ...
Copying oraenv to/usr/local/bin ...
Copying coraenv to/usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@dba ~]#
[root@dba ~]# ps -ef | grep ora_
oracle 1213 1 2 04:44? 00:00:00 ora_j000_ora10g
root 1228 3315 0 04:45pts/3 00:00:00 grep ora_
oracle 6635 1 0 04:00? 00:00:00 ora_pmon_ora10g
oracle 6637 1 0 04:00? 00:00:00 ora_psp0_ora10g
oracle 6639 1 0 04:00? 00:00:00 ora_mman_ora10g
oracle 6641 1 0 04:00? 00:00:00 ora_dbw0_ora10g
oracle 6643 1 0 04:00? 00:00:01 ora_lgwr_ora10g
oracle 6645 1 0 04:00? 00:00:02 ora_ckpt_ora10g
oracle 6647 1 0 04:00? 00:00:01 ora_smon_ora10g
oracle 6649 1 0 04:00? 00:00:00 ora_reco_ora10g
oracle 6651 1 0 04:00? 00:00:00 ora_cjq0_ora10g
oracle 6653 1 0 04:00? 00:00:01 ora_mmon_ora10g
oracle 6655 1 0 04:00? 00:00:00 ora_mmnl_ora10g
oracle 6657 1 0 04:00? 00:00:00 ora_d000_ora10g
oracle 6659 1 0 04:00? 00:00:00 ora_s000_ora10g
oracle 6666 1 0 04:01? 00:00:00 ora_qmnc_ora10g
oracle 6726 1 0 04:01? 00:00:00 ora_q000_ora10g
oracle 6730 1 0 04:01? 00:00:00 ora_q002_ora10g
[root@dba ~]#
连接oracle的方法:
[oracle@dba ~]$ sql /nolog
SQL*Plus: Release 10.2.0.1.0 - Production onFri Feb 25 05:24:37 2011
Copyright (c) 1982, 2005,Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> show user
USER is "SYS"
备注:
1、oracle安装时可能出现很多的错误,绝大多数是因为准备工作没做好,尤其是软件包没装完整
2、图解中忽略的部分大多数是默认的或很简单的傻瓜安装不需要过多说明