centos5.8静默安装oracle10G

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:942

说明:公司业务最近使用oracle10G,第一次使用oracle,过程如下:

官网:[url]http://www.oracle.com/pls/db102/homepage

1> 安装所需依赖:

rpm -qa make gcc gcc-c++ glibc glibc-common glibc-devel binutils compat-db compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel control-center libstdc++ libstdc++-devel libaio libXp libaio-devel libgcc sysstat unixODBC unixODBC-devel libXp openmotif

2> 验证系统要求:

最小内存521MB,交换分区最小1GB,数据库大约需要5GB的可用磁盘,/tmp目录最少需要500MB可用空间。

如没有swap,需要曾加swap分区:
dd if=/dev/zero of=swapfile bs=1024 count=10485760
/sbin/mkswap swapfile
/sbin/swapon swapfile
vim /etc/fstab add
/opt/swapfile swap swap defaults 0 0
swapon -s

3> 创建账户:

groupadd oinstall && groupadd dba && useradd -g oinstall -G dba -s /bin/bash -m oracle -d /opt/oracle
passwd oracle
ls -al /opt

4> 修改内核参数,与文件打开数进程数:

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# 应用程序可使用的 IPv4 端口范围。
net.core.rmem_default = 1048576 # 套接字接收缓冲区大小的缺省值
net.core.rmem_max = 1048576 # 套接字接收缓冲区大小的最大值
net.core.wmem_default = 262144 # 套接字发送缓冲区大小的缺省值
net.core.wmem_max = 262144 # 套接字发送缓冲区大小的最大值

sysctl -p

vim /etc/security/limits.conf

* soft nofile 1048576
* hard nofile 1048576
* soft nproc 1048576
* hard nproc 1048576

5> 解压程序,修改相关文件:

# cp /tmp/10201_database_linux_x86_64.cpio.gz /opt/oracle/
# chown oracle:oinstall /opt/oracle/10201_database_linux_x86_64.cpio.gz
# ls -al /opt/oracle/
# su - oracle
$ gunzip 10201_database_linux_x86_64.cpio.gz
$ cpio -idmv <10201_database_linux_x86_64.cpio $ cd database/stage/Components/oracle.network.rsf/10.2.0.1.0/1/DataFiles $ unzip filegroup6.jar bin/gennttab Archive: filegroup6.jar inflating: bin/gennttab $ vim bin/gennttab #edit 79 eval NTUSE$T="true" 80 81 LIB=`$ECHO ${TtoLIB} | $SED 's/ /\n/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'` 82 INI=`$ECHO ${TtoINI} | $SED 's/ /\n/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'` 83 BAS=`$ECHO ${TtoBAS} | $SED 's/ /\/g' | $GREP "^${T}:" | $AWK -F: '{print $2}'` 84 85 if [ -z "${LIB}" ] ; then $ zip -vu filegroup6.jar bin/gennttab updating: bin/gennttab (in=5163) (out=1806) (deflated 65%) total bytes=8209, compressed=2947 -> 64% savings

$ vim database/response/enterprise.rsp #edit

62 ORACLE_HOME="/opt/oracle/product/10.2.0.1/db_1"
70 ORACLE_HOME_NAME="Oracle10g"
384 s_nameForDBAGrp="dba"
392 s_nameForOPERGrp="dba"
422 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 为只安装服务器软件)。

6> 设置环境变量:

$ vim ~/.bash_profile #edit

export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1
export PATH=$PATH:$ORACLE_HOME/bin

7> 修改操作系统发行版本:

说明:由于 oracle 还没有推出支持 CentOS 的安装包,所以需要修改发行版本,以便通过 oracle 的安装检查,安装完成后再改回来。
检查操作系统版本: 必须是redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2

# vim /etc/redhat-release #edit

CentOS release 5.8 (Final) 删除

Red Hat Enterprise Linux AS release 3 (Taroon) 添加

8> 关闭其他防火墙与selinux:

# /etc/init.d/iptables stop
# chkconfig --level 2345 iptables off
# setenforce 0
# sed -i "s/enforcing/disabled/g" /etc/selinux/config
# sed -i "s/strict/targeted/g" /etc/selinux/config

9> 安装oracle数据库:

# su - oracle
$ cd database/
$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /opt/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 参数进行强制安装。

10> oracle系统初始化:

以 root 管理员运行 $ORACLE_HOME/root.sh 进行 Oracle 的系统初始化工作,一路按回车用默认值即可。

# cd /opt/oracle/product/10.2.0.1/db_1
# bash root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/10.2.0.1/db_1

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@hadoop132 db_1]#

11> 安装网络监听器

# su - oracle
$ vim database/response/netca.rsp #edit

72 INSTALL_TYPE=""custom""
76 LISTENER_NUMBER=1
82 LISTENER_NAMES={"LISTENER"}
88 LISTENER_PROTOCOLS={"TCP;1521"}
91 LISTENER_START=""LISTENER""

说明:

INSTALL_TYPE=""custom"" 安装的类型
LISTENER_NUMBER=1 监听器数量
LISTENER_NAMES={"LISTENER"} 监听器的名称列表
LISTENER_PROTOCOLS={"TCP;1521"} 监听器使用的通讯协议列表
LISTENER_START=""LISTENER"" 监听器启动的名称

$ cd product/10.2.0.1/db_1/bin
$ /opt/oracle/product/10.2.0.1/db_1/bin/netca /silent /responseFile /opt/oracle/database/response/netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /opt/oracle/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.

The information provided for this listener is currently in use by another listener on this computer.
The information provided for this listener is currently in use by other software on this computer.
Listener start failed. Listener may already be running.
Default local naming configuration complete.
Created net service name: EXTPROC_CONNECTION_DATA
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0

12> 修改dbstart

$ vim product/10.2.0.1/db_1/bin/dbstart #edit

78 ORACLE_HOME_LISTNER=$ORACLE_HOME

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

13> 安装数据库实例

$ vim database/response/dbca.rsp #edit(根据自己的需要修改下列参数)

78 GDBNAME = "orcl10g"
88 SID = "ora"
129 SYSPASSWORD = "sys"
139 SYSTEMPASSWORD = "sys"
355 CHARACTERSET = "US7ASCII"
365 NATIONALCHARACTERSET= "UTF8"

注解:

GDBNAME = "orcl10g" # 数据库全局名称
SID = "ora" # 数据库的SID
SYSPASSWORD = "sys" # SYS 用户的初始密码
SYSTEMPASSWORD = "sys" #SYSTEM 用户的初始密码
CHARACTERSET = "US7ASCII" # 数据库字符集,这里默认英文(中文为ZHS16GBK)
NATIONALCHARACTERSET= "UTF8" # 数据库国家字符集,默认。

运行安装命令:

$ /opt/oracle/product/10.2.0.1/db_1/bin/dbca -responseFile /opt/oracle/database/response/dbca.rsp -cloneTemplate
DISPLAY not set.
Set DISPLAY environment variable, then re-run.

如下添加:

$ vim ~/.bash_profile

DISPLAY=192.168.10.115(你本机IP)
export DISPLAY

数据库创建成功后需要修改一些信息,保证数据库实例能自动启动:

$ vim /etc/oratab

23 orcl:/opt/oracle/product/10.2.0.1/db_1:Y

14> 启动数据库实列:

$ /opt/oracle/product/10.2.0.1/db_1/bin/dbstart
Processing Database instance "orcl": log file /opt/oracle/product/10.2.0.1/db_1/startup.log

测试:“
$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 1 11:57:02 2014

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

Connected to an idle instance.

SQL>
SQL> quit
Disconnected

15> 配置EM资料库,数据库和监听都必须已经启动并正常工作,配置 dbcontrol

$ emca -config dbcontrol db #依据提示说诉配置

删除数据库的 Database Control配置:

$ emca -deconfig dbcontrol db #同上

16> 卸载Oracle数据库:

./runInstaller -silent -deinstall -removeallfiles -removeAllPatches "REMOVE_HOMES={$ORACLE_HOME}" -responseFile ~oracle/database/response/enterprise.rsp

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】