oracle-安装(11GR2)-和随机启动

来源:互联网 发布:js encodeuri 两次 编辑:程序博客网 时间:2024/06/05 10:01

本文档提供CentOS 6.6操作系统下Oracle 11.2.0.4的安装说明,以便于相关人员顺利安装Oracle 11.2.0.4数据

一 安装准备

1、已安装完成的CentOS 6.6操作系统;

2、Oracle 11.2.0.4 For Linux 64位安装程序

3、服务器可以正常连接到互联网

4、准备安装所需系统环境

(1)、安装相关的开发及工具包

 yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel zip unzip lrzsz 

(2)、检查/etc/hosts文件中是否有

<IP地址><主机名>

这一配置项。如果有,则需确认主机名是否和/etc/sysconfig/network中的hostname一致(需要确保两者一致);如果没有,则手工添加。

(3)、修改内核参数

[root@host ~]# vi /etc/sysctl.conf

 

# 注释掉下面三行

#net.bridge.bridge-nf-call-ip6tables = 0

#net.bridge.bridge-nf-call-iptables = 0

#net.bridge.bridge-nf-call-arptables = 0

 

#修改下面两行

kernel.shmall = 10523004

kernel.shmmax =2147483648#shmmax为物理内存的一半,以字节为单位 

在文件最后添加下面内容

net.ipv4.ip_local_port_range = 9000 65500

mal style='text-indent:28.0pt;mso-char-indent-count:2.0;line-height:20.0pt;mso-line-height-rule:exactly'>fs.file-max =6815744

kernel.shmmni =4096

kernel.sem = 25032000 100 128

net.core.rmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048576

fs.aio-max-nr =1048576

使修改生效: 

[root@host ~]# sysctl -p

4)、修改系统配置文件

[root@host ~]#vi /etc/pam.d/login

在文件最后添加下面内容   session    required    pam_limits.so

[root@host ~]# vi  /etc/security/limits.conf

#在文件最后添加下面内容

oracle   soft  nproc   2047

oracle   hard  nproc   16384

oracle   soft  nofile   1024

oracle   hard  nofile   65536

(5)、添加用户及组

[root@host ~]#groupadd dba

[root@host ~]#useradd-g dba oracle

(6)、修改系统环境变量

[root@host ~]# vi  /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

(7)、创建目录

[root@host ~]#mkdir /opt/oracle

[root@host ~]#mkdir /opt/oraInventory

[root@host ~]#mkdir /opt/oracle/dbhome

[root@host ~]#chmod 775 /opt/oracle

[root@host ~]#chmod 775/opt/oraInventory

[root@host ~]#chown-R oracle:dba /opt/oracle /opt/oraInventory

(8)、修改oracle用户环境变量:

[root@host ~]#su - oracle

[oracle@host ~]$vi ~/.bash_profile

#在文件最后添加下面内容

     export ORACLE_BASE=/opt/oracle 

     export ORACLE_HOME=/opt/oracle/dbhome

     export NLS_LANG="AMERICAN_AMERICA.UTF8"   

     export ORACLE_SID=orcl 

     export PATH=$PATH:$ORACLE_HOME/bin

(9)、上传安装文件

在终端电脑上安装SSH工具NetSarangXmanagerEnterprise 4,通过SSH远程登录服务器,使用SFTP工具将Oracle安装文件上传到服务器的/home/oracle目录下,并修改文件所有者属性

[root@host ~]#chownoracle:dba/home/oracle/p13390677_112040_Linux- x86-64_*

(10)、解压缩zip文件,准备安装

[root@host ~]#su - oracle

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_1of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_2of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_3of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_4of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_5of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_6of7.zip  

[oracle@host ~]$ unzip p13390677_112040_Linux-x86-64_7of7.zip


11)、安装pdksh包

将pdksh-5.2.14-30.x86_64.rpm包上传到服务器,并以root用户执行命令

[root@host ~]#rpm -ivhpdksh-5.2.14-30.x86_64.rpm

二 安装过程

1、解压缩完成后,会生成client、database、deinstall、examples、gateways、grid六个目录

[root@host ~]#rpm -ivh pdksh-5.2.14-30.x86_64.rpm

2、切换到root用户,执行命令:

[oracle@host ~]$ exit

[root@host ~]# xhost +

access control disabled, clients can connect from any host

命令执行后客户端会自动打开一个图形界面的窗口,然后窗口会自动最小化

3、切换到oracle用户,开始安装数据库:

[root@host ~]# su- oracle

[oracle@host ~]$ cd database 

[oracle@host database]$ ./runInstaller 

4、执行命令后会弹出如图所示的Oracle安装界面,不输入Email地址,并取消选中“I wish to receive security updates via My Oracle Suppor.”,点Next

 

5、弹出警告窗口,点Yes

6、选择“Skip software updates”,点Next

7、选择“Create and configure a database”,点Next

8、选择“Server Class”,点Next

9、选择“Single instance database installation”,点Next

10、选择“Advanced Install”,点Next

11、将滚动条拉到最下边,选中“SimplifiedChinese”,然后点“ ”按钮,将简体中文添加到右侧窗口

12、选择“Enterprise Edition(4.7GB)”,点击Next

13、无需修改,只需确保和图示中一致即可,

15、选择“General Purpose/ Transaction Processing”,点击Next

16、修改“Global database name”,确保其和“OracleService Identifier (SID)”一样都是orcl,点击Next

17、设置Oracle可用内存容量,将内存值设为物理内存的一半,然后点击“Character sets”选项卡

18、设置字符集,选中“Choose from the following list of character sets”,并从下拉列表中选择“Simplified Chinese ZHS16GBK”,点击Next

22、选择“Use the same password for allaccounts”并设置密码,点击Next

30、点击“OK”按钮后会弹出新的窗口,要求以root用户身份执行两个脚本

31、通过SSH工具登录到服务器,以root用户身份执行:

[root@host~]#/opt/oraInventory/orainstRoot.sh

[root@host~]# /opt/oracle/dbhome/root.sh

31、两个脚本执行完成后,返回安装界面,点击“OK”按钮,至此,数据库安装完成

三 安装后操作

1、修改iptables配置文件,打开1521端口

[root@host ~]# vi /etc/sysconfig/iptables

在INPUT链中增加一条规则:

-A INPUT -m state--state NEW -m tcp -p tcp --dport1521 -j ACCEPTle;mso-wrap-style:square'> ”按钮,将简体中文添加到右侧窗口

2、修改root用户环境变量

[root@host ~]# vi~/.bash_profile

export ORACLE_BASE=/opt/oracle

export ORACLE_HOME=/opt/oracle/dbhome

使修改生效

[root@host ~]# source~/.bash_profile

3、开机自动启动Oracle

(1)将dbora-oneoff文件上传到/root目录,将dbora文件上传到/etc/init.d目录,将两个文件都增加可执行属性:

[root@host~]#chmod +x /root/dbora-oneoff

[root@host~]#chmod +x /etc/init.d/dbora

(2)执行一遍dbora-oneoff,然后将其删除

[root@host~]#rm/root/dbora-oneoff  start

[root@host~]#rm /root/dbora-oneoff


 /root/dbora-oneoff 
#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
# Please locate the script under the dirctory "/etc/init.d" as root privilege!
chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
/sbin/chkconfig --add dbora
sed -i s/'N'/'Y'/g /etc/oratab
sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbstart
sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbshut
ORA_HOME=("/home/oracle/dbhome")
ORA_OWNER=("oracle")
declare -a ORA_HOME
declare -a ORA_OWNER
t=${#ORA_HOME[@]}
#t=1
for ((count=0;count<$t;count++))
do
case "$1" in
'start')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl start"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbstart
;;
'stop')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl stop"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbshut
;;
esac
done


/etc/init.d/dbora
#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
# Please locate the script under the dirctory "/etc/init.d" as root privilege!
#chgrp dba /etc/init.d/dbora
#chmod 750 /etc/init.d/dbora
#/sbin/chkconfig --add dbora
#sed -i s/'N'/'Y'/g /etc/oratab
#sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbstart
#sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbshut
ORA_HOME=("/home/oracle/dbhome")
ORA_OWNER=("oracle")
declare -a ORA_HOME
declare -a ORA_OWNER
t=${#ORA_HOME[@]}
#t=1
for ((count=0;count<$t;count++))
do
case "$1" in
'start')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl start"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbstart
;;
'stop')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl stop"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbshut
;;
esac
done








 



 

                                                                            

0 0