《Oracle 11g在Windows Server 2008 R2的安装详解》
本篇博文参考《Oracle 10g官方文档》等资料,故选《RHEL4》操作系统。生产环境中强烈建议以《Oracle 10g官方文档》为蓝图!
一、预备:
1、硬件:注:括号()中是官方提供数据!
1-检查物理内存 (RAM至少1G)
[root@RHEL4 ~]# grep MemTotal /proc/meminfo
MemTotal: 1541764 kB //RAM是1.5G
[root@RHEL4 ~]#
2-检查Swap大小 (1G<RAM<2G,则Swap=RAM X 1.5)
[root@RHEL4 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 3140696 kB //此处是1.5X2=3G
[root@RHEL4 ~]#
3-检查可用RAM和swap空间
[root@RHEL4 ~]# free
total used free shared buffers cached
Mem: 1541764 898536 643228 0 49480 542584
-/+ buffers/cache: 306472 1235292
Swap: 3140696 0 3140696
[root@RHEL4 ~]#
4-检查CPU
[root@RHEL4 ~]# grep "model name" /proc/cpuinfo
model name : Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
[root@RHEL4 ~]#
2、软件:
1-操作系统版本
Red Hat Enterprise Linux AS 4.8 X64bit
2-内核版本号
[root@RHEL4 ~]# uname -r
2.6.9-82.EL
[root@RHEL4 ~]#
3-RHEL4所需要安装的软件包
(1)binutils-2.15.92.0.2-10.EL4 (2)compat-db-4.1.25-9 (3)control-center-2.8.0-12 (4)gcc-3.4.3-9.EL4 (5)gcc-c++-3.4.3-9.EL4 (6)glibc-2.3.4-2 (7)glibc-common-2.3.4-2 (8)gnome-libs-1.4.1.2.90-44.1 (9)libstdc++-3.4.3-9.EL4 (10)libstdc++-devel-3.4.3-9.EL4 (11)make-3.80-5 (12)pdksh-5.2.14-30 (13)sysstat-5.0.5-1 (14)xscreensaver-4.18-5.rhel4.2
备注:
//查询是否已安装了上面14个软件包
rpm –qa | grep 软件包名
//安装软件包
方法1:
rpm –ivh 软件包名
方法2:
yum install 软件包名
3. 在/etc/hosts后面添加1行:
127.0.0.1localhost.localdomain localhost
192.168.1.224 RHEL4
4. 创建用户和组
[root@RHEL4 ~]# groupadd oinstall
[root@RHEL4 ~]# groupadd dba
[root@RHEL4 ~]# useradd -g oinstall -G dba oracle
[root@RHEL4 ~]#
5. 修改参数:
1-在/etc/sysctl.conf的最后添加:
vi /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 = 262144 net.core.rmem_max = 262144 net.core.wmem_default = 262144 net.core.wmem_max = 262144
2-然后,使用sysctl -p 命令,即时生效
[root@RHEL4 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
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 = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@RHEL4 ~]#
3-在/etc/security/limits.conf最后面添加:
[root@RHEL4 ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
4-在/etc/pam.d/login最后面添加:
[root@RHEL4 ~]# vi /etc/pam.d/login
session required pam_limits.so
在/etc/profile最后面添加:
[root@RHEL4 ~]# 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
6. 创建Oracle 10g R2的安装目录
1-创建oracle安装目录且赋于权限
[root@RHEL4 ~]# mkdir /u01/app/oracle -p
[root@RHEL4 ~]# chown -R oracle:oinstall /u01
[root@RHEL4 ~]# chmod -R 755 /u01
[root@RHEL4 ~]#
2-设置Oracle的环境变量
在.bash_profile最后面添加:
[root@RHEL4 ~]# su – oracle //切换到oracle用户帐户
[oracle@RHEL4 ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=jiagulun
export NLS_LANG=american_america.zhs16gbk
[root@RHEL4 ~]#exit //退出oracle用户帐户
[root@RHEL4 ~]# su – oracle //重新切换到oracle用户帐户
[oracle@RHEL4 ~]$ ls
二、Oracle数据库的安装
1-上传Oracle数据库软件,再解压它
//先创建一个目录/oraapp/
[root@RHEL4 ~]# mkdir /oraapp/
[root@RHEL4 ~]# mount /dev/hdc /media/
mount: block device /dev/hdc is write-protected, mounting read-only
[root@RHEL4 ~]# cd /media/
[root@RHEL4 media]# ll
total 740658
-r-xr-xr-x 1 root root 758433170 Aug 10 23:46 10201_database_linux_x86_64.cpio.gz
[root@RHEL4 media]# cp 10201_database_linux_x86_64.cpio.gz /oraapp/
[root@RHEL4 media]# cd /oraapp/
[root@RHEL4 oraapp]# ll
total 741388
-r-xr-xr-x 1 root root 758433170 Aug 11 14:29 10201_database_linux_x86_64.cpio.gz
[root@RHEL4 oraapp]# gunzip 10201_database_linux_x86_64.cpio.gz //解压之
2-gunzip将XXX.cpio.gz解后是XXX.cpio文件了,然后再用命令解压即可:
[root@RHEL4 oraapp]# ll
total 783588
-r-xr-xr-x 1 root root 801603584 Aug 11 14:29 10201_database_linux_x86_64.cpio
[root@RHEL4 oraapp]# cpio -idmv < 10201_database_linux_x86_64.cpio //解压之
[root@RHEL4 oraapp]# ls
10201_database_linux_x86_64.cpio database
[root@RHEL4 oraapp]# cd database/
[root@RHEL4 database]# ls
doc install response runInstaller stage welcome.html
[root@RHEL4 database]# w
16:03:35 up 9 min, 3 users, load average: 0.21, 0.48, 0.31
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root :0 - 16:00 ?xdm? 31.12s 0.51s /usr/bin/gnome-session
root 192.168. 192.168.1.3 16:01 0.00s 0.00s 0.37s /usr/bin/gnome-session
root pts/1 192.168.1.3:1.0 16:02 0.00s 0.04s 0.02s w
[root@RHEL4 database]# xhost +
access control disabled, clients can connect from any host
[root@RHEL4 database]# export DISPLAY=192.168.1.3:1.0
[root@RHEL4 database]# su – oracle //切换到oracle用户
[oracle@RHEL4 ~]$ cd /oraapp/
[oracle@RHEL4 oraapp]$ ls
10201_database_linux_x86_64.cpio database //此为解压后的文件
3-正式安装Oracle 10g R2数据库
[oracle@RHEL4 oraapp]$ cd database/
[oracle@RHEL4 database]$ ./runInstaller
//稍候……就出现如下图所示界面:
//默认之,因为我们前面设置了环境变量,所以会自动出来了
//选企业版,如下图所示
或者选 定制 !如下图所示:
//默认之,如下图所示:
//选 iSQL*Plus 10.2.0.1.0 ,如下图所示:
//检查最后结果应该是:成功!如下图所示:
//默认之,如下图所示:
//仅安装Oracle数据库软件,如下图所示:
//下面我们只需要点击 安装,如下图所示:
//到如下图所示时,不要点 OK !切记! 我们重新打开一个窗口:
//执行第1个脚本,如下图所示:
右击 桌面空白处---> 打开终端 ,如下图所示:
[root@RHEL4 ~]# su - oracle
[oracle@RHEL4 ~]$ pwd
/home/oracle
[oracle@RHEL4 ~]$ su
Password:
[root@RHEL4 oracle]# pwd
/home/oracle
[root@RHEL4 oracle]# cd /u01/app/oracle
[root@RHEL4 oracle]# cd oraInventory/
[root@RHEL4 oraInventory]# ls
Contents oraInst.loc
ContentsXML orainstRoot.sh
install.platform oui
logs sessionContext.ser
oraInstaller.properties
[root@RHEL4 oraInventory]# ./orainstRoot.sh //执行脚本
Changing permissions of /u01/app/oracle/oraInvent ory to 770.
Changing groupname of /u01/app/oracle/oraInventor y to oinstall.
The execution of the script is complete
[root@RHEL4 oraInventory]#
//执行第2个脚本,如下图所示:
//下面我们就可以点击 OK 按钮了,如下图所示:
//点击 退出 后,oracle数据库安装已完成了!如下图所示:
PS:
上图中的5560端口,查询方法:
三、建库:
1-设置环境变量
//在.bash_profile最后面添加:
[oracle@RHEL4 ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=jiagulun
export NLS_LANG=american_america.zhs16gbk
export PATH=$PATH:$ORACLE_HOME/bin:. //此为添加的1行
[oracle@RHEL4 ~]$ exit //退出
logout
[root@RHEL4 ~]# su – oracle //再用oracle用户帐户登录!
2-运行数据库配置助手(dbca),如下图所示:
[oracle@RHEL4 ~]$ dbca
//选择 创建数据库 ,如下图所示:
//选择 一般用途(General Purpose)
//给数据库起个名称:jiagulun
//推荐使用EM,无论是实验环境,还是生产环境中!
//所有用户都使用同一个口令:oracle
//选择 文件系统(File System),生产环境 选 ASM 或 裸设备
//选第2项:所有数据库文件使用公共位置
//默认,指定快速恢复区
//选择 示例方案 ,实际生产中不会选 示例方案!
//选第2项(有国外机构的选它),国内企业一般选第3项!强烈建议:在此就选好,否则以后调整会出现问题。
//默认:控制文件、数据文件、重做日志组
//开始 创建数据库 ,如下图所示:
//检查下正确与否,正确,则点击 OK !
//请等待……,如下图所示:
//直到出现……如下图所示:
至此,Oracle 10g R2数据库安装和建库全部完成!
四、下面我们去访问Oracle 10g R2数据库
1-在IE中输入http://192.168.1.224:1158/em
注释:
为何会出现:Enterprise Manager无法连接到数据库实例。下面列出了组件的状态。???
1)用户通过IE浏览器 连接 EM,而EM通过 监听(Listener)找到 Oracle数据库;
2)前3个(Database、Listener和EM)在同一台服务器上,EM在安装Oracle数据库时,就安装了;
由上面报错可分析出来,可能是监听出问题了!(事实上我们还没有配置监听^_^)
2-配置监听
//运行命令netca来配置监听
[oracle@RHEL4 ~]$ netca
//选第1项 配置监听
//选第1项: 添加
//起个监听名称:LISTENER
//默认之,下一步
//默认之,下一步
//下一步,如下图所示:
//出现如下图所示,则说明监听配置完成了!
3-本地Net服务名配置
1)本地Net服务名配置
[oracle@RHEL4 ~]$ netca
//选第3项:本地Net服务名配置
//默认之,添加
//起个服务名为:jiagulun
//默认之,下一步
//主机名:192.168.1.224
//不测试,如下图所示:
//网络服务名为:jiagulun
//我们不配置另一个Net服务名,如下图所示:
//出现如下图所示,则说明Net服务配置完成
至此,本地Net服务名配置完成!
2)于是去看看检验之,如下面所示:
[oracle@RHEL4 ~]$ lsnrctl status //查看监听状态
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:31:01
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 21:56:58
Uptime 0 days 0 hr. 34 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(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...
Service "jiagulun" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulunXDB" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulun_XPT" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL4 ~]$
3)停止、启动监听及查看监听状态
[oracle@RHEL4 ~]$ lsnrctl stop //关闭监听程序
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:39:05
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
The command completed successfully
[oracle@RHEL4 ~]$
[oracle@RHEL4 ~]$lsnrctl start //启动监听
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:42:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 22:42:21
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(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
[oracle@RHEL4 ~]$
[oracle@RHEL4 ~]$ lsnrctl status //再查看监听状态
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:44:54
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 22:42:21
Uptime 0 days 0 hr. 2 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(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...
Service "jiagulun" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulunXDB" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulun_XPT" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL4 ~]$
由上面查听监听状态,可知监听服务已经在工作了!
4-我们再在IE中输入http://192.168.1.224:1158/em
//接受/同意
//下面是我把语言改为中文时的界面,如下图所示:
好啦!《Red Hat Enterprise Linux AS 4.8中安装Oracle 10g R2详解》到此结束了!
本文转自
beyondhedefang 51CTO博客,原文链接:http://blog.51cto.com/beyondhdf/1271662 ,如需转载请自行联系原作者