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

CentOS 5.5命令行安装Oracle 10g

2011-04-10 23:18 567 查看
From: http://blog.csdn.net/sunxp/archive/2011/01/04/6115348.aspx 基本都是用oracle身份执行命令

1.

验证
Oracle

所需要的系统依赖程序包是否完整。

rpm -qa binutils compat-db control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make libaio libXp

2.

验证系统要求

Oracle

所需最小
RAM


512MB

,而所需最小交换空间为
1GB

。对于
RAM

小于或等于
2GB

的系统,交换空间应为
RAM

数量的两倍;对于
RAM

大于
2GB

的系统,交换空间应为
RAM

数量的一到两倍。
Oracle 10g

软件还需要
2.5GB

的可用磁盘空间,而数据库则另需
1.2GB

的可用磁盘空间。
/tmp

目录至少需要
400MB

的可用空间。

3.

创建
Oracle

用户组和用户

创建用户组
oinstall


dba



创建用户
oracle

,同属于
oinstall


dba

用户组,并且建立了
oracle


home

目录。

修改
oracle

用户的登录密码。

$su - root

#groupadd dba //

数据库系统管理理组

#groupadd oinstall //Oracle

文件所有者的组

#useradd -g oinstall -G dba -m -s /bin/bash oracle

#passwd oracle

#chown -R oracle.oinstall /home/oracle

4.

配置内核参数

#vi /etc/sysctl.conf

编辑文件
/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#

应用程序可使用的
IPv4

端口范围。

net.core.rmem_default = 1048576 #

套接字接收缓冲区大小的缺省值

net.core.rmem_max = 1048576 #

套接字接收缓冲区大小的最大值

net.core.wmem_default = 262144 #

套接字发送缓冲区大小的缺省值

net.core.wmem_max = 262144 #

套接字发送缓冲区大小的最大值

5.

解压缩安装文件

unzip 10201_database_linux32.zip

6.

修改
gennttab

解压缩
filegroup6.jar



cd database/stage/Components/oracle.network.rsf/10.2.0.1.0/1/DataFiles/

unzip filegroup6.jar bin/gennttab

修改解压出来的
gennttab

文件。

vi bin/gennttab



改为:



即把
`s/ ///`

中的后面的”
/

”改为”
n

”,同时要注意把
n

后的空格删除,否则在安装监听器时会报错。


gennttab

添加到
filegroup6.jar

中。

zip -vu filegroup6.jar bin/gennttab

7. Oracle

建议对每个
Linux

帐户可以使用的进程数和打开的文件数设置限制。

要进行这些更改,以
root

用户的身份执行下列命令:

vi /etc/security/limits.conf

添加如下内容:

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

8.

设置环境变量


oracle

用户登录。

vi
~/.bash_profile

添加如下内容:

export TMP=/tmp

export TMPDIR=/tmp

export ORACLE_BASE=/home/oracle

export ORACLE_SID=ora10g

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1

export PATH=$PATH:$ORACLE_HOME/bin

9.

修改
enterprise.rsp

文件,在
oracle

安装目录下可以找到
/database/response/enterprise.rsp

ORACLE_HOME="/home/oracle/product/10.2.0.1/db_1"

ORACLE_HOME_NAME="Oracle10g"

s_nameForDBAGrp="dba"

s_nameForOPERGrp="dba"

n_configurationOption=3

说明:

ORACLE_HOME Oracle

服务器的主目录位置,必须是绝对路径。

ORACLE_HOME_NAME Oracle

服务器的名称,必须以字母开头。

s_nameForDBAGrp

用于
Oracle

系统管理的
linux

用户组名,该组的用户拥有管理
Oracle

服务器的权限。

s_nameForOPERGrp

用于
Oracle

数据库常规操作的
linux

用户组名,该组的用户拥有常规操作
Oracle

数据库的权限。

n_configurationOption

安装类型(
1

为在安装后创建数据库,
2

为安装后创建一个自动存储管理实例,
3

为只安装服务器软件)。

10.

修改操作系统发行版本

由于
oracle

还没有推出支持
CentOS

的安装包,所以需要修改发行版本,以便通过
oracle

的安装检查,发行版本文件的位置为
/etc/redhat-release


CentOS release 5 (Final)

修改成

Red Hat Enterprise Linux AS release 3 (Taroon)

安装完成后再改回来。

11.

关闭
SELINUX

工作模式

SELINUX

属性配置文件位置为
/etc/selinux/config

#

设置
SELINUX


disabled

SELINUX=disabled

12.

开始安装

./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/database/response/enterprise.rsp

说明
:

ignoreSysPrereqs


Oracle

忽略系统检查,因为
Oracle

官方声明只支持
Linux

服务器产品,所以要在非服务器产品的
Linux

上安装就必须指定此参数。

silent

让安装程序以静默模式运行。

responseFile

指定一个应答文件。

注意
:

如果
ORACLE_HOME


ORACLE_BASE

目录设在相同的位置
,

或者
ORACLE_HOME

所在目录不为空的话
,

会有如下错误
:

SEVERE:OUI-10029:You
have specified a non-empty directory to install this product. It is
recommended to specify either an empty or a non-existent directory. You
may, however, choose to ignore this message if the directory contains
Operating System generated files or subdirectories like lost+found.

如果仍然要以当前配置安装的话
,

请在安装时添加
-force

参数进行强制安装。

13.oracle

系统初始化


root

管理员运行
$ORACLE_HOME/root.sh

进行
Oracle

的系统初始化工作,通常一路按回车用默认值即可。

14.

安装网络监听器

编辑
oracle

安装目录下的
netca.rsp

应答文件,地址为:
/database/response/netca.rsp

,主要查看以下参数配置:

INSTALL_TYPE=""custom""

安装的类型

LISTENER_NUMBER=1

监听器数量

LISTENER_NAMES={"LISTENER"}

监听器的名称列表

LISTENER_PROTOCOLS={"TCP;1521"}

监听器使用的通讯协议列表

LISTENER_START=""LISTENER""

监听器启动的名称

运行安装命令:

$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/database/response/netca.rsp

注意:在此处可能会有错误
oracle

需要的软件包不全。请根据
1

中列出的软件包,确保所有的软件包都已经正确安装(
2


6

中对
gennttab

文件的修改不正确,本人就是没有去掉
n

后的空格导致了该错误。

15.

修改
dbstart

vi $ORACLE_HOME/bin/dbstart

ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

改为:

ORACLE_HOME_LISTNER=$ORACLE_HOME

确保数据库启动时,网络监听器同时启动。

16.

安装数据库实例

编辑
Oracle

安装源文件夹
response

目录下的
dbca.rsp

应答文件:

vi /home/oracle/database/response/dbca.rsp

根据自己的需要修改下列参数:

GDBNAME
=


orcl10g



#

数据库全局名称

SID =


ora



#

数据库的
SID

SYSPASSWORD =


sys



# SYS

用户的初始密码

SYSTEMPASSWORD =


sys


#SYSTEM

用户的初始密码

CHARACTERSET =


ZHS16GBK


#

数据库字符集(中文为
ZHS16GBK



NATIONALCHARACTERSET =


ZHS16GBK


#

数据库国家字符集

运行安装命令:

$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/database/response/dbca.rsp -cloneTemplate

数据库创建成功后需要修改一些信息:

vi /etc/oratab

ora10g:/opt/oracle/product/10.2.0.1/db_1:N

改为:

ora10g:/opt/oracle/product/10.2.0.1/db_1:Y

保证数据库实例能自动启动。

17.

启动数据库实例

$ORACLE_HOME/bin/dbstart

18.

测试

sqlplus "/as sysdba"

19.

配置
EM

资料库,数据库和监听都必须已经启动并正常工作

配置
dbcontrol

[oracle@oracle10 ~]$ emca -config dbcontrol db

STARTED EMCA at Oct 27, 2007 9:33:48 AM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:

Database SID: orcl

Database Control is already configured for the database orcl

You have chosen to configure Database Control for managing the database orcl

This will remove the existing configuration and the default settings and perform a fresh configuration

Do you wish to continue? [yes(Y)/no(N)]: Y

Listener port number: 1521

Password for SYS user:

Password for DBSNMP user:

Password for SYSMAN user:

Email address for notifications (optional):

Outgoing Mail (SMTP) server for notifications (optional):

-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /opt/oracle/product/10.2.0/Database

Database hostname ................ oracle10

Listener port number ................ 1521

Database SID ................ orcl

Email address for notifications ...............

Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------

Do you wish to continue? [yes(Y)/no(N)]: Y

Oct 27, 2007 9:35:12 AM oracle.sysman.emcp.EMConfig perform

INFO:
This operation is being logged at
/opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_09-33-46-AM.log.

Oct 27, 2007 9:35:33 AM oracle.sysman.emcp.util.DBControlUtil stopOMS

INFO: Stopping Database Control (this may take a while) ...

Oct 27, 2007 9:36:39 AM oracle.sysman.emcp.ParamsManager getLocalListener

WARNING: Error retrieving listener for oracle10

Oct 27, 2007 9:36:54 AM oracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting Database Control (this may take a while) ...

Oct 27, 2007 9:39:51 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Control started successfully

Oct 27, 2007 9:39:53 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO:
>>>>>>>>>>> The Database Control URL
is http://oracle10:5500/em <<<<<<<<<<<

Enterprise Manager configuration completed successfully

FINISHED EMCA at Oct 27, 2007 9:39:53 AM

[oracle@oracle10 ~]$

删除数据库的
Database Control

配置

[oracle@oracle10 ~]$ emca -deconfig dbcontrol db

STARTED EMCA at Oct 27, 2007 10:44:24 AM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:

Database SID: orcl

Do you wish to continue? [yes(Y)/no(N)]: Y

Oct 27, 2007 10:44:47 AM oracle.sysman.emcp.EMConfig perform

INFO:
This operation is being logged at
/opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_10-44-22-AM.log.

Oct 27, 2007 10:44:52 AM oracle.sysman.emcp.util.DBControlUtil stopOMS

INFO: Stopping Database Control (this may take a while) ...

Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig stopDBMSJobs

WARNING: Error initializing SQL connection. SQL operations cannot be performed

Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig invoke

WARNING: Unable to remove DBMS jobs.

Enterprise Manager configuration completed successfully

FINISHED EMCA at Oct 27, 2007 10:51:01 AM

[oracle@oracle10 ~]$

20.uninstall oracle if you want:

./runInstaller
-silent -deinstall -removeallfiles -removeAllPatches
"REMOVE_HOMES={$ORACLE_HOME}" -responseFile
~oracle/database/response/enterprise.rsp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: