当前位置:Linux教程 - RedHat - oracle - redhat as2.1装817

oracle - redhat as2.1装817

redhat as2.1装817
2004-04-23 15:18 pm
来自:Linux文档
现载:Www.8s8s.coM
地址:无名

前两天在linux adserve2.1下安装完oracle8.1.7,呵弱智兄让偶post一下心得
本来坛子里有不少高手已经写出来了8.1.7的安装过程,可是写得都不是很具体,呵小弟根据一些高手的文章总结了一下呵呵献丑了
如有不对就指正

Oracle8.1.7 for Redhat的安装
 1. 硬件环境:DELL品牌(Intel815集成主板、512M内存、100G硬盘)
2. 磁盘分区:5G 主分区(ext3)(使用我的安装方法只用了3个G的空间),500M Swap分区(最少需要300M)
准备工作:
第一步:安装Redhat
使用customer安装,选择组件,可根据自己的需要进行安装。安装选项参考这里。
第二步:确认你已安装了以下兼容包:(使用rpm命令查询,使用方法请点这里)
1、替换glibc
Oracle8.1.7使用的是glibc2.1.3,而RedHat7以上的版本是用的glibc2.2.2,不兼容,所以要替换glibc才能成功安装。
可以把:
compat-egcs-6.2-1.1.2.16.i386.rpm
compat-egcs-6.2-1.1.2.16.i386.rpm
compat-egcs-6.2-1.1.2.16.i386.rpm
compat-egcs-6.2-1.1.2.16.i386.rpm
compat-egcs-6.2-1.1.2.16.i386.rpm
compat-libs-6.2-3.i386.rpm
也安装上。
因为这几个软件包之间有依赖关系,如果安装顺序不对,会报错的,无法安装。一般来说应
该先安装第一张上的两个,再安装第二张上面的四个。
如果这样做也报错,安装不上,可以先把这6个软件包拷贝到一个目录下,然后再一起安装,这样就不用怕它们之间的依赖关系,一定可以安装成功了。例如:
rpm -Uvh *.rpm

第三步:收集所需的文件和补丁(在/目录下创建backup目录,存放以下文件)
1、 binutils-2.10.91.0.2-3.i386.rpm #这是redhat7自带的一个文件。
2、 jdk118_v3.tar.gz #这是有关java的原文件。
3、 glibc-2.1.3-stubs.tar.gz #以下两个是Oracle的两个补丁包。
4、 env_ctx.mk
5、 linux817ee.tar.gz #Oracle8.1.7 for linux的安装文件。

第四步:对以上文件分别进行处理:(当前目录是/backup)
A、 安装binutils-2.10.91.0.2-3.i386.rpm,哈哈,又是这个讨厌的东西,不过这次用的是Redhat 7.1盘里的,一定要装,不要忘了,因为他和后来的ld有关,不安装会出现ld: unrecognized emulation mode: elf_i386_glibc21.的错误。
rpm -Uvh --force --nodeps binutils-2.10.91.0.2-3.i386.rpm
B、 安装Jdk1.1.8_v3到/usr/local:(如果不安装,在安装过程中15%处将显示错误信息)
1、bunzip2 jdk118_v3.tar.bz2
2、tar -xvf jdk118_v3.tar (使用cd /usr/local 切换当前目录为/usr/local)
3、ln -s /backup/jdk118_v3 java(-s 表示软链接 )
C、 解压linux817ee.tar.gz (使用 cd /backup 切换当前目录为/backup)
tar zxvf linux817.tar.gz (解压后的文件将存放在/backup/Disk1里面)

第五步、准备安装环境。(使用cd /root使当前目录为/root)
一:创建组和用户
1、groupadd dba (创建dba组)
2、groupadd oinstall (创建oinstall组)#也可以不加
3、useradd oracle -g oinstall -G dba (创建用户oracle并且赋予主组为oinstall,辅助组为dba)
4、passwd oracle (给用户oracle 赋值密码)

二:创建安装目录(cd /home/oracle 切换当前目录为/home/oracle)
1、 mkdir -p product/8.1.7 (在当前目录下创建product目录,本例是以为安装目录,
可以更改)
2、chown –R oracle.dba product (给data目录赋予作者oracle及组dba。)
3、chmod 755 data (给product目录赋予权限。)

三:设置环境变量:
1、 编程.bash_profile或/etc/profile文件
可以将要设的环境变量放在oracle用户主目录下的.bash_profile中,也可以放在/etc/profile中,对所有的用户可见,我建议放在/etc/profile中,因为凡是在本机运行的程序读写本机的Oracle数据库,一般都需要设Oracle的环境变量,否则无法连接数据库。我可以举一个例子:如果你的WEB Server,例如Apache,需要读写数据库,提供网页的动态内容,假设用PHP或者JSP,又或者Perl等等来写ServerAPI或者CGI,因为Apache是以root启动一个进程,这个进程再fork若干子进程以nobody用户运行,响应80端口的http请求,所以如果在root读不到Oracle环境变量,Web程序根本无法读写数据库。只要root读到oracle环境变量,fork子进程的时候,复制了父进程的数据空间,也继承了父进程的环境变量,所以可以读到oracle变量,就可以读写oracle数据库了。

Vi .bash_profile

export ORACLE_BASE=/home/oracle 指定oracle安装目录

export ORACLE_HOME=$ORACLE_BASE/product/8.1.7 指定oracle安装目录

export ORACLE_SID=orcl 指定oracle数据库的SID

export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data 指定字符集目录

export NLS_LANG=american_america.ZHS16GBK 指定字符集为英语和汉语编码

export LD_LIBRARY_PATH=$ORACLE_HOME/lib 是Oracle的C库函数和头文件的位置,对于OCI8,PROC和JDBC的OCI连接是必须的。

export CLASSPATH=.:$ORACLE_HOME/jdbc/lib/classes111.zip 是Java程序读写数据库需要的JDBC的class,前面加个点号是先搜当前目录的意思。

export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/dbs:/etc 指定shell

export LD_ASSUME_KERNEL=2.2.5

export LDEMULATION=elf_i386_glibc21

export GCC_EXEC_PREFIX=/usr/i386-glibc21-linux/lib/gcc-lib/

umask 022

最后三段是为了降级gcc用的加上就是了
到这里还须更改glibc,以降低gcc的版本

. /usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh
#. /home/oracle/.bash_profile
再看看gcc是否已替换
gcc -v
替换之前是:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
替换之后是:
Reading specs from /usr/i386-glibc21-linux/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc driver version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) executing gcc version egcs-2.91.66

2、修改内核参数
Oracle数据库运行的时候,用共享内存来实现Oracle的SGA,所以要调整一下Linux的内核参数来适应Oracle的SGA的要求,这个方面到底要调整到多少才适合,可以参考Oracle官方的安装文档(第30页)。一般而言,主要就是共享内存段最大尺寸要调整,Linux内核默认共享内存段最大尺寸是32M,如果Oracle SGA开的大于32M,SGA就会分段,占据几个不连续的共享内存段,造成Oracle的性能下降。
命令ipcs -al可以查看共享内存参数,命令ipcs查看共享内存使用情况。
修改内核参数可以修改内核源码再重新编译内核,这个方法有点麻烦,关于共享内存的参数在/usr/src/linux-2.4.7-10/include/linux/下的shm.h和sem.h文件中。
Oracle8.1.7的安装文档中,对于此部分为:
/usr/src/linux-2.4.7-10/include/linux/shm.h
Shard Memery SHMMAX 0.5*物理内存
SHMMIN 1
SHMMNI 100
SHMSEG 10
/usr/src/linux-2.4.7-10/include/linux/sem.h
Semaphores SEMMNI 100
SEMMSL 10+最大进程数 注:进程数在$oracle_home/dbs/initsid.ora 中
SEMMNS 最大进程数*2+其他进程数之和+实例数*10
SEMOPM 100
SEMVMX 32767

另一个简单的办法是直接修改内核参数,即修改/proc下的文件,立即生效。
可以修改/proc/sys/kernel下的shmmax和sem
shmmax是以字节记的共享内存段的最大尺寸,
shmmni是共享内存段的最大数量
shmmax是共享内存总共最大容量(shmmax*shmmni)
sem是信号量参数,msgmax,msgmnb,msgmni是消息队列的参数。
可以改动如下:
echo 134217728 > /proc/sys/kernel/shmmax (SGA最大为128M)
echo -e "250 32000 100 128" > /proc/sys/kernel/sem
或者 vi /etc/services
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=128
set shmsys:shminfo_shmseg=16

set semsys:seminfo_semmni=128
set semsys:seminfo_semmns=2048
set semsys:seminfo_semmsl=2048
set semsys:seminfo_semume=64
set semsys:seminfo_semmnu=768
set semsys:seminfo_semmap=20
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767



5、安装Oracle8.1.7i
第一步:以ORACLE用户登录系统并进入X-Windows画
第二步:启动安装程序
1、cd /backup/Disk1
2、./runInstaller (运行runInstaller文件)
3、接下来就和windows安装一样,选择安装类型、安装路径、工作组名、JDK路径、数据库SID等。
在这个过程中注意以下问题:
A、工作组名添写oinstall。
B、安装过程中会要求以root身份进行orainstRoot.sh
C、安装过程会提示ins_ctx.mk出错。新开一个konsole窗口,以root身份运行命令
cp /backup/env_ctx.mk $ORACLE_HOME/ctx/lib (然后返回安装界面,点击Retry即可)
D、提示以Root身份运行root.sh
E、出现net8配置窗口,:(不要着急点下一步,一定要在创建数据库之前,新开一个konsole,以root身份运行以下命令)
 cd $ORACLE_HOME
 tar -xvzf /backup/glibc-2.1.3-stubs.tar.gz
 ./setup_stubs.sh (安装过程大约要五分钟的时间)
 等待程序运行完毕,返回安装界面。
 选择Perform typical configuration,下一步,开始创建数据库。
 最后提示数据库创建完成。恭禧你Oracle安装成功。


6、 进行测试一下:
第一步:打开一个konsole窗口,运行Svrmgrl,看是否出现连接Oracle8.1.7成功。
第二步:运行connect internal,看是否出现Connected字样。
第三步:退出Svrmgrl运行sqlplus system/manager 看显示是否正常。
[oracle@only_you oracle] svrmgrl
Oracle Server Manager Release 3.1.6.0.0 - Production
Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.
Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
SVRMGR>connect internal
Connected.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR>startup
ORACLE instance started.
Total System Global Area 56012784 bytes
Fixed Size 69616 bytes
Variable Size 38993920 bytes
Database Buffers 16777216 bytes
Redo Buffers 172032 bytes
Database mounted.
Database opened.
SVRMGR> quit
Server Manager complete.



7.将数据库启动命令和修改内核命令放在系统启动脚本中
修改/etc/rc.d/rc.local,加入:
#modify kernel parameter
echo 134217728 > /proc/sys/kernel/shmmax
echo -e "250 32000 100 128" > /proc/sys/kernel/sem
#start Oracle8.1.7
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'


呵写了这么多,也许有人会说怎么安个oracle8i这么麻烦啊,干脆装9i得了,可是9i在pc机下安装的话实在是太慢了,简直就是一个吃内存的大户,有什么好方法呢?呵呵其实有一个非常简单的方法,就是还是装8i,我们一般装的都是oracle8.1.7.0.1
你需要找oracle8.1.7.0版安装,不要小看.0和.1的区别啊,就因为少了一个.1
你的oracle8i什么补丁都不用打,只设置一下环境变量,然后就和在win下面装common software一样了^_^
甚至连最后的root.sh都不需要编辑,直接执行就可以了,其实一开始我也不相信会这么容易,后来非凡公子传了我一个oracle 8.1.7.0,我试装了一下没有问题~呵呵

接着上面这个贴子我还要写一篇关于oracle内存篇的support,我想这样才是一篇完整的orcle for linux安装文档,请大家多多指教~
thanks ~

oracle 内存补遗

sizing Swap Space 设置swap内存
in order to perform a typical Oracle8i installation and to create a prototype
database Oracle says that u need a minimum of 256 MB of RAM for o8i Server and the mount of swap of swap space should be equal to twice the amount of RAM or at least
400MB whichever is greater oracle also says that the minimum swap space should be at least the same as physical memory size
为了更好的安装o8i server 至少需要256m物理内存,你的swap分区至少要两倍于你的RAM
swap size recommendations
to summarize oracle’s recommendation for the database and to take system configurations into account that were used for workload testings,here is what I came up with:
这是oracle在服务器的swap分区建议:
0.5 GB RAM 1 GB - 2 GB Swap Space
1 GB RAM 2 GB - 3 GB Swap Space
2 GB RAM 2 GB - 3 GB Swap Space
3 GB RAM 3 GB Swap Space
4 GB RAM 4 GB Swap Space
8 GB RAM 4 GB Swap Space
16 GB RAM 8 GB Swap Space
the swap space will not be utilized until the system runs out of physical memory.
So don’t configure too much swap space. Keep in mind that if the system starts using swap space,it has a negative impact to the performance of the database. So make sure that the system has always enough physical RAM and that it doesn’t use swap space continuously.

Checking physical Memory
U can check the size of physical memory by running the following command:

grep MemTotal /proc/meminfo 或者直接进入/proc看more meminfo

MemTotal: 254976 kB 我的内存(vmware下的)

Checking swap space size and usage

U can check the size and current usage of swap space by running the following command
cat /proc/swaps

Filename Type Size Used Priority
/dev/sda3 partition 506036 0 -1

alternatively,u can use /sbin/swapon –s to check the swap memory
或者你用swapon –s这个command也可以
/sbin/swapon –s
Filename Type Size Used Priority
/dev/sda3 partition 506036 0 -1

其中506036就是我的swap分区的大小

Setting shmmax parameter
This parameter defines the maximum size in bytes for a shared memory segment.since the SGA(SHARED GLOBAL AREA) is comprised of shared memory, SHMMAX can potentially
Limit the size of the SGA ideally,SHMMAX should be large enough so that SGA can fit into one segment.
The default size on RH2.1 AS is 33554432. with this value,the oracle database configuration assistant failed on my server with the following error message:

ORA-27123: unable to attach to shared memory segment

Setting SHMMAX to 1 GB always worked for me when I setup a medium sized database. However, it is suggested that it should be set to 2 GB; the default maximum size of the SGA is 1.7 GB which requires a larger SHMMAX. And if the available size of the SGA is set to 2.7 GB by changing "mapped base" at the Linux OS level, then SHMMAX should be set to 3 GB. The maximum value of SHMMAX can be set to 4GB-1. (A typical 32-bit Linux system without Physical Address Extension (PAE) is divided into 3 GB user space and 1 GB kernel space.)

一般来说,rh server SHMMAX是3355432,这个value在用其oracle建库助手建库时一般会报ora-27123的错误,或者hang up在那里,所以需要修改shmmax这个参数至少是1GB

The default shared memory limit for SHMMAX can be changed in the proc file system without reboot:
su - root
echo "2147483648" > /proc/sys/kernel/shmmax
改shmmax参数

Alternatively, you can use sysctl(icon_cool.gif to change it: 或者
sysctl -w kernel.shmmax=2147483648

To make the change permanent, add the following line to the file /etc/sysctl.conf. This file is used during the boot process.
如果你想永久的改变这个参数的话
echo "kernel.shmmax=2147483648" >> /etc/sysctl.conf

(注:设置共享内存大小,共享内存大小一般设为物理内存的一半,在这里我们假设物理内存256M则共享内存为134217728,(算法:256/2=shmmaxk*1024=shmmaxk(k)*1024=shmmaxk(byte))512M则共享内存的值4294967295以此类推,
如果你的物理内存是1G则这里的值则是8589934590: echo 4294967295 > shmmax )


setting shmmni parameter

this parameter sets the total amount of shared memory in bytes that can be used at one time on the system the default size
on rh 2.1 AS is 2097152
cat /proc/sys/kernel/shmmni
4096

to my knowledge this value should be sufficient !


setting shmall parameter

this parameter sets the total amount of shared memory in bytes that can be used at one time on the system.the default size on
RH 2.1 AS is 2097152.

cat /proc/sys/kernel/shmall
2097152

to my knowledge this value should be sufficient !


setting semaphores

semaphores can best be described as counters which are used to provide synchronization between processes or between threads
within a process for shared resources like shared memories. system V semapores support semaphore sets where each one is a counting
semapore.so when an application requests semaphores,the kernel releases them in "sets" the number of semaphores per set can be defined through
the kernel parameter SEMMSL

to see all semaphore settings,run:

ipcs -ls or ipcs -l

the semmsl parameter

this parameter defines the maximum number of semaphores per semaphore set.
oracle recommends to set SEMMSL to the largest processes init.ora parameter of any database on the linux system
oracle also recommends to set semmsl to a minimum value of 100.

The init.ora parameter PROCESSES specifies the maximum number of operating system processes that can be started by the Oracle instance. In a non MTS environment, Oracle spawns a system user process for each connection. This means that in such an environment the PROCESSES parameter defines the maximum number of simultaneous Oracle connections minus sum of all Oracle background processes.
It can also be said that the PROCESSES value should never be greater than SEMMSL.


The SEMMNI Parameter

This parameter defines the maximum number of semaphore sets (identifiers) in the entire Linux system.

Oracle recommends to set SEMMNI to a minimum value of 100.

The SEMMNS Parameter

This parameter defines the total number of semaphores (not semaphore set) in the entire Linux system. A semaphore set can have more than one semaphore, and according to the semget(2) man page, values greater than SEMMSL * SEMMNI makes it irrelevant.

Setting it to a minimum value of 256 is for initial Oracle installation only.
Oracle recommends to set SEMMNS to the sum of the PROCESSES parameter for each database on the system, adding the largest PROCESSES twice, and then adding 10 for each DB.

The maximum number of semaphores that can be allocated on a Linux system will be the lesser of:
SEMMNS or (SEMMSL * SEMMNI)

Setting SEMMSL and SEMMNI to 100 makes sure that SEMMNS semaphores can be allocated as determined by the above calculation.



The SEMOPM Parameter

This parameter defines the maximum number of semaphore operations that can be performed per semop(2) system call.

The semop(2) function provides the ability to do operations for multiple semaphores with one semop(2) system call. Since a semaphore set can have the maximum number of SEMMSL semaphores per semaphore set, it is often recommended to set SEMOPM equal to SEMMSL.

Oracle recommends to set SEMOPM to a minimum value of 100.



Setting the Semaphore Kernel Parameters


Setting the Semaphore Kernel Parameters

To determine the values of the four described semaphore parameters, run:
# cat /proc/sys/kernel/sem
250 32000 32 128

Alternatively, you can run:

ipcs -ls

All four described semaphore parameters can be changed in the proc file system without reboot:


echo SEMMSL_value SEMMNS_value SEMOPM_value SEMMNI_value > /proc/sys/kernel/sem
These are the values I'm using since I don't want to lower Red Hat's default
values. The only value I raise is SEMOPM to comply with Oracle's minimum
requirement for SEMOPM.

echo "250 32000 100 128" > /proc/sys/kernel/sem
其中, 250 是参数SEMMSL的值,32000是参数SEMMNS的值, 32是参数SEMOPM的值,而128则是参数SEMMNI的值
其中SEMMSL_value、SEMMNS_value、SEMOPM_value、SEMMNI_value分别用相应的值进行替换,并且这些值的顺序不能调换


Alternatively, you can use sysctl(icon_cool.gif to change it:
sysctl -w kernel.sem="250 32000 100 128"


To make the change permanent, add or change the following line in the file /etc/sysctl.conf. This file is used during the boot process.

echo "kernel.sem="250 32000 100 128"" >> /etc/sysctl.conf

To see the new updated semaphore settings, run:

ipcs -ls

Setting File Handles

The maximum number of file handles denotes the maximum number of open files that you can have on the Linux system.

Setting System Wide Limit for File Handles

The value in /proc/sys/fs/file-max sets the maximum number of file handles or open files that the Linux kernel will allocate. When you get error messages about running out of file handles, then you might want to raise this limit. The default value on RH 2.1AS is 8192.

For an Oracle server it is recommended that the file handles for the entire system is set to at least 65536.

To determine the number of file handles for the entire system, run:

cat /proc/sys/fs/file-max

The maximum number of file handles can be changed in the proc file system without reboot:

su - root
echo "65536" > /proc/sys/fs/file-max

Alternatively, you can use sysctl(icon_cool.gif to change it:
sysctl -w fs.file-max=65536

To make the change permanent, add or change the following line in the file /etc/sysctl.conf. This file is used during the boot process.
echo "fs.file-max=65536" >> /etc/sysctl.conf


Setting File Handles Limit for the Oracle User

There is still a per user limit of open files which is set to 1024 by default:
$ su - oracle
$ ulimit -n
1024
$

To change this, you have to edit the file /etc/security/limits.conf as root and make the following changes or add the following lines, respectively:
oracle soft nofile 4096
oracle hard nofile 8192

The "soft limit" in the first line defines the number of file handles or open files that the Oracle user will have after login. If the Oracle user gets error messages about running out of file handles, then the Oracle user can increase the number of file handles in this example up to 8192 ("hard limit") by running the following command:

ulimit -n 8192

You can set the "soft" and "hard" limits higher if necessary.


Now login to the oracle account again since the changes will become effective for new login sessions only.
$ su - oracle
$ ulimit -n
4096
$

The default limit for oracle is now 4096 and the oracle user can increase the number of file handles up to 8192:
$ su - oracle
$ ulimit -n
4096
$ ulimit -n 8192
$ ulimit -n
8192
$


综上所述,这就是我们为什么要在/etc/services中加上
set shmsys:shminfo_shmmax=134217728
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=100
set semsys:seminfo_semmns=200
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767

ok good luck ^_^

flying big pig兄,我的net8都已经安装完成了,可是到了oracle database creation的时候,系统就不动了,好长时间也没有动静。然后我想手动自己创建的时候,可是命令dbca找不到啊,find了整个硬盘也不成,真的不知道..........
建库失败一般分3种情况
1.你的gcc没有降级,就是在建库之前没有打那个glibc-2.1.3-stubs.tar.gz补丁包
2.没有增大你的shmmax parameter
3.没有增加你的Semaphore Kernel Parameters /proc/sys/kernel/sem