您的位置:首页 > 数据库 > Oracle

Suse Linux Enterprise 11安装Oracle11g(二)

2012-09-28 18:14 441 查看
前面已经检查了软硬件环境的要求,接下来继续,希望可以一次搞定oracle11g的安装。

3.创建必须的用户和组

安装oracle11g需要创建以下用户和组

The Oracle Inventory group (typically, 
oinstall
)

The OSDBA group (typically, 
dba
)

The Oracle software owner (typically, 
oracle
)

The OSOPER group (optional. Typically, 
oper
)

通过下面的命令来创建相关的组和用户

#groupadd oinstall

#groupadd dba

#useradd -m -g oinstall -G dba oracle--创建oracle用户,并将oracle用户添加到oinstall组和dba(附加)组

此处,官方文档是不加-m参数,如此则不会自动生成home目录及相关的文件。

如果oracle用户已经存在,但不属于相应的组,可以使用如下命令来修改其属性

#usermod -g oinstall -G dba oracle

接下来查看一下oracle用户是否正确配置。

#id oracle

uid=1001(oracle) gid=1000(oinstall) groups=1001(dba),1000(oinstall)

接下来设置oracle用户的密码

#passwd oracle

4.配置内核参数

ParameterMinimum ValueFile
semmsl

semmns


semopm


semmni


250
32000
100

128

/proc/sys/kernel/sem
shmall
2097152
/proc/sys/kernel/shmall
shmmax
Either 4 GB - 1 byte, or half the size of physical memory (in bytes), whichever is lower.
Default: 536870912
/proc/sys/kernel/shmmax
shmmni
4096
/proc/sys/kernel/shmmni
file
-
max
512 * PROCESSES
/proc/sys/fs/file-max
ip_local_port_range
Minimum: 9000
Maximum: 65500
/proc/sys/net/ipv4/ip_local_port_range
rmem_default
262144
/proc/sys/net/core/rmem_default
rmem_max
4194304
/proc/sys/net/core/rmem_max
wmem_default
262144
/proc/sys/net/core/wmem_default
wmem_max
1048576
/proc/sys/net/core/wmem_max
aio-max-nr
Maximum: 1048576
Note: This value limits concurrent outstanding requests and should be set to avoid I/O subsystem failures.
/proc/sys/fs/aio-max-nr
上表列出了安装oracle建议的内核参数最小值,如果你当前系统的值比它大,则不用修改。
可以通过下面的命令来查看系统当前值

ParameterCommand
semmsl
semmns
semopm
, and 
semmni
# /sbin/sysctl -a | grep sem

This command displays the value of the semaphore parameters in the order listed.

shmall
shmmax
, and 
shmmni
# /sbin/sysctl -a | grep shm
file-max
# /sbin/sysctl -a | grep file-max
ip_local_port_range
# /sbin/sysctl -a | grep ip_local_port_range
rmem_default
# /sbin/sysctl -a | grep rmem_default
rmem_max
# /sbin/sysctl -a | grep rmem_max
wmem_default
# /sbin/sysctl -a | grep wmem_default
wmem_max
# /sbin/sysctl -a | grep wmem_max
如果有不符合要求的项,可以修改/etc/sysctl.conf文件。

#gedit /etc/sysctl.conf

把需要修改的参数包含进去,如果当前值大于建议的最小值,则指定为当前值。

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586


注:kernel.shmmax最小值为0.5G,不过oracle建议设置为2G以达到最佳性能。

下面通过命令来查看当前系统的内核配置。
# /sbin/sysctl -a | grep sem

kernel.sem = 250 256000321024
# /sbin/sysctl -a | grep shm

kernel.shmmax = 18446744073709551615

kernel.shmall = 1152921504606846720

kernel.shmmni = 4096

vm.hugetlb_shm_group = 0
# /sbin/sysctl -a | grep file-max

fs.file-max = 99095
# /sbin/sysctl -a | grep ip_local_port_range

net.ipv4.ip_local_port_range = 32768 61000
# /sbin/sysctl -a | grep rmem_default

net.core.rmem_default = 126976
# /sbin/sysctl -a | grep rmem_max

net.core.rmem_max = 131071
# /sbin/sysctl -a | grep wmem_default

net.core.wmem_default = 126976
# /sbin/sysctl -a | grep wmem_max

net.core.wmem_max = 131071

于是最终我的sysctl.conf配置如下:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 1152921504606846720

kernel.shmmax = 18446744073709551615

kernel.shmmni = 4096

kernel.sem = 250 256000 100 1024

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048586


接下来授于oinstall用户组创建共享内存段的权限(仅在Suse系统中需要),我的oinstall组GID为1000,可用id oracle 命令查看。
#echo 1000 > /proc/sys/vm/hugetlb_shm_group

然后在 
/etc/sysctl.conf中加入




vm.hugetlb_shm_group=1000

SUSE中可以输入下面的命令以确保系统重启后,新的配置信息会被系统读取生效。

#/sbin/chkconfig boot.sysctl on		--重启后自动读取配置
#sysctl -p	--使sysctl.conf配置立即生效


若想获得最佳性能体验,还需要为oracle用户做如下配置

#gedit /etc/security/limits.conf

在文件中加以下行

oracle           soft    nproc   2047

oracle           hard    nproc   16384

oracle           soft    nofile  1024

oracle           hard    nofile  65536


#gedit /etc/pam.d/login

文件中添加以下行

session    required     pam_limits.so

3)./etc/profile

#gedit /etc/profile.local

文件中添加如下行(Bourne, Bash或者Korn shell),如果不是Suse系统则在/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


5.创建oracle安装目录

# mkdir -p /u01/app/

# chown -R oracle:oinstall /u01/app/

# chmod -R 775 /u01/app/




6.配置oracle用户环境变量

在系统当前登录用户下输入以下命令(新打开一个终端默认就是当前用户)

#su - oracle

#vi .profile

umask 022

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export ORACLE_SID=orcl

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

export NLS_LANG="SIMPLFILED CHINESE_CHINA.ZHS16GBK"

export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"


#. ./.profile--执行.profile,使配置立即失效.注意第一个点和第二点之间有个空格

#xclock--如果弹出一个时钟表示图形界面正常,可以正常安装。

7.挂载安装文件

在Vmware中选择【虚拟机】->【设置】->【选项】->【共享文件夹】,勾选【总是启用】,然后选择需要共享的oracle安装文件夹。

#cd /mnt/hgfs/oracle

#./runInstaller

结果报错提示[ins-06101]ip address of localhost could not be determined。这是因为hostname与/etc/hosts中配置不一致导致。

#hostname

cody

#gedit /etc/hosts

添加如下行

192.168.116.129 cody

图形安装界面出来,接下来按照提示操作就可以了。

安装完成后在主机Win7使用plsql developer9 尝试连接oracle,结果失败。原因需要关闭防火墙。

#sudo /sbin/rcSuSEfirewall2 stop--关闭防火墙

不过这只能临时关闭,下次重启就失效了,永久关闭可执行下面代码 

#chkconfig --list|grep fire
#chkconfig --level 5 SuSEfirewall2_setup off


#chkconfig --level 5 SuSEfirewall2_init off


[b]关闭防火墙,plsql developer9可以顺利连接oracle11g,不过每连一次速度慢的吓人。
[/b]

[b]分析可能是由于dhcp的原因。[/b]

故取消vmware DHCP动态IP地址分配。

同时/etc/sysconfig/network/ifcfg-eth0文件,改成静态IP

BOOTPROTO='static'

BROADCAST=''

ETHTOOL_OPTIONS=''

IPADDR='192.168.116.129'

MTU=''

NAME='79c970 [PCnet32 LANCE]'

NETMASK='255.255.255.0'

NETWORK=''

REMOTE_IPADDR=''

STARTMODE='auto'

USERCONTROL='no'


#/etc/init.d/network restart

重启网卡马上就正常了。

启动Oracle服务

#lsnrctl start

#sqlplus /nolog

SQL>connect system/psw as sysdba

SQL>startup




虚拟机克隆后,会生成eth1网卡,对应的配置文件是eth0,可以修改/etc/udev/rules.d/70-persistent-net.rules文件,回到eth0网卡。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: