重力眩晕 ps4 评测:AIX不完整的补丁安装以及Oracle的Bug

来源:百度文库 编辑:九乡新闻网 时间:2024/04/27 21:36:51
今天遇到一个AIX系统BUG,Oracle数据库无法启动,甚至无法Nomount,实例在Nomount之后马上Crash。
报告的错误是PMON无法启动。
告警日志信息摘录:
PMON started with pid=2, OS id=295272
Sun Dec 2 21:33:20 2007
Errors in file /oracle/admin/oinst/bdump/oinst_pmon_295272.trc:
ORA-07445: exception encountered: core dump [] [] [] [] [] []
PSP0 started with pid=3, OS id=336364
MMAN started with pid=4, OS id=385228
DBW0 started with pid=5, OS id=389154
DBW1 started with pid=6, OS id=360558
DBW2 started with pid=7, OS id=340122
DBW3 started with pid=8, OS id=274592
LGWR started with pid=9, OS id=172072
CKPT started with pid=10, OS id=151578
SMON started with pid=11, OS id=369006
RECO started with pid=12, OS id=315902
CJQ0 started with pid=13, OS id=463090
MMON started with pid=14, OS id=299320
MMNL started with pid=15, OS id=278948
Sun Dec 2 21:33:23 2007
PSP0: terminating instance due to error 472
Instance terminated by PSP0, pid = 336364

 

    最后确定疑似Oracle的一个Bug,BUG Number:6413391
对于这个BUG,Oracle建议的修正是Apply ML06 to AIX 5.3

    而客户的系统目前看来ML06的安装是不完全的:

instfix -i|grep ML
All filesets for 5.3.0.0_AIX_ML were found.
All filesets for 5300-01_AIX_ML were found.
All filesets for 5300-02_AIX_ML were found.
All filesets for 5300-03_AIX_ML were found.
All filesets for 5300-04_AIX_ML were found.
All filesets for 5300-05_AIX_ML were found.
Not all filesets for 5300-06_AIX_ML were found.

 

    不完全的补丁安装是危险的,在进行系统升级时一定要慎重,最好将系统运行在经过验证的稳定的系统版本上,升级过快可能会带来更多的不稳定因素。

3、安装

1)环境

内存 2048M,硬盘146G

2)分区

/ 30G

/tmp 2G

/var 3G

/app 20G

/app/oradata 60G

/app/oraBP 20G

3)安装

选择所有的管理工具,开发工具,Gnome环境,Web Server,FTP Server

除sysstat包都成功安装,

sysstat包在4号盘上,rpm -i sysstat-5.0.5-1.i386.rpm

4、安装Oracle

1)添加用户组

判断用户和组是否存在

grep dba /etc/group

grep oinstall /etc/group

id oracle

id nobody

有则不添加

groupadd oinstall

groupadd dba

useradd -g oinstall -G dba oracle

--oracle 已经存在 但不是 oinstall组,也非dba组成员

usermod -g oinstall -G dba oracle

useradd nobody

2)内核参数

Parameter Value File

semmsl 250 /proc/sys/kernel/sem

semmns 32000

semopm 100

semmni 128

shmall 2097152 /proc/sys/kernel/shmall

shmmax Half the size of physical memory (in bytes) /proc/sys/kernel/shmmax

shmmni 4096 /proc/sys/kernel/shmmni

file-max 65536 /proc/sys/fs/file-max

ip_local_port_range Minimum: 1024 /proc/sys/net/ipv4/ip_local_port_range

Maximum: 65000

rmem_default 1048576 /proc/sys/net/core/rmem_default

rmem_max 1048576 /proc/sys/net/core/rmem_max

wmem_default 262144 /proc/sys/net/core/wmem_default

wmem_max 262144 /proc/sys/net/core/wmem_max

命令

semmsl, semmns, semopm, and semmni # /sbin/sysctl -a | grep sem

shmall, shmmax, and shmmni # /sbin/sysctl -a | grep shm

file-max # /sbin/sysctl -a | grep file-max

ip_local_port_range # /sbin/sysctl -a | grep ip_local_port_range

rmem_default # /sbin/sysctl -a | grep rmem_default

rmem_max # /sbin/sysctl -a | grep rmem_max

wmem_default # /sbin/sysctl -a | grep wmem_default

wmem_max # /sbin/sysctl -a | grep wmem_max

修改配置文件/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 = 1048576

net.core.rmem_max = 1048576

net.core.wmem_default = 262144

net.core.wmem_max = 262144

重新启动

3)设置oracle用户的shell

a)增加如下行到/etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

b)增加下列行到/etc/pam.d/login

session required /lib/security/pam_limits.so

session required pam_limits.so

c)修改Shell默认启动文件

Bourne,Bash,Korm shell下增加下列行到/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

C shell下,增加下列行到/etc/csh.login

if ( $USER == "oracle" ) then

limit maxproc 16384

limit descriptors 65536

endif

4)创建需要的目录

mkdir /app/oracle

chown -R oracle:oinstall /app/oracle

chmod -R 775 /app/oracle

chown -R oracle:oinstall /app/oradata

chmod -R 775 /app/oradata

chown -R oracle:oinstall /app/orabp

chmod -R 775 /app/orabp

这里只有一块硬盘,如果有多块硬盘,你需要将其建立一个挂接点,如u01,

则目录为/u01/app/oracle,这里只有一个硬盘,挂接点就是/

5)设置oracle用户环境

a)如果在远程系统上安装oracle,在本地的X-Windows里显示,要设置

xhost host_name

b)用oracle登陆X-windows系统,或su - oracle

c)查看默认Shell

echo $SHELL

d)bash

vi .bash_profile

如果设置了ORACLE_SID,ORACLE_HOME,ORACLE_BASE,删除相应行

e)umask 022

f)保存文件,执行

. .bash_profile

g)设置显示变量

DISPLAY=localhost:0.0 ; export DISPLAY

如果在远程显示界面,localhost就改成远程主机

h)如果/tmp空间不够,需要设置TMP,TMPDIR变量

$ su - root

# mkdir /mount_point/tmp

# chmod a+wr /mount_point/tmp

# exit

bash下

$ TMP=/mount_point/tmp

$ TMPDIR=/mount_point/tmp

$ export TMP TMPDIR

i)确定ORACLE_HOME,TNS_ADMIN没有设置

$ unset ORACLE_HOME

$ unset TNS_ADMIN

j)检验是否设置正确

$ umask

$ env | more

6)安装Oracle

a)取得Oracle安装件

从Oracle网站上下载,是免费的,只需要一个简单的注册即可,得到的是zip文件

unzip 10201_database_linux32.zip

如果是安装光盘,mount上介质

b)运行

runInstaller

c)安装过程和Windows非常类似,要注意的是

在选择dba组的时候选择oinstall

修改一下默认目录,如安装目录,Inventory目录

安装之前程序会检查一下系统配置,如果按照上面的设置,不会有任何问题,

install即可

这样安装的oracle的数据文件在默认目录下,如果要放到不同的盘上,

可以删除数据库重建,或者安装的时候选择高级安装

安装Net 8时,系统提示以root用户执行两个脚本,照做就可以了

 

5、点滴

1)注意ORACLE_HOME变量,如果不存在,需要手工设置

ORACLE_HOME=/app/oracle/product/10.2.0/db_1

2)建库命令为/app/oracle/product/10.2.0/db_1/bin/dbca &

注意设置字符集,因为安装界面用中文没法安装,所以使用英文环境安装,

所以不能使用默认配置,要修改默认字符集及默认语言

3)Net 8 命令为/app/oracle/product/10.2.0/db_1/bin/netca &

4)在其它机器上远程用Net8连接Oracle,需要打开Linux上的1521端口

配置如下

Applications->System Setting->Secuity Level 其它端口增加1521:tcp即可

5)让oracle随机器启动而启动

在.bash_profile里设置

ORACLE_SID=orcl

ORACLE_HOME=/app/oracle/product/10.2.0/db_1

export ORACLE_SID

export ORACLE_HOME

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH

修改/etc/oratab,

orcl:/app/oracle/product/10.2.0/db_1:Y

最后一个字母默认是N,修改为Y,否则dbstart,dbshut都不会起作用

修改/app/oracle/product/10.2.0/db_1/dbstart中的相关行为

ORACLE_HOME_LISTNER=/app/oracle/product/10.2.0/db_1

然后修改/etc/rc.local,增加这样的一行

su - oracle -c dbstart

这样就可以了,但不能关机的时候自动关闭,所以需要手工处理

su - oracle -c dbshut

如果是oracle用户可以直接dbshut

注:我曾经尝试过网上找到的如下方法,但系统没法启动,需要用恢复模式删掉脚本才可以,

不知道是不是我的配置问题,如果看出我的错误请告诉我

开机时让 RedHat Linux 自动启动Oracle,需要完成以下步骤:

运行 $ORACLE_HOME 下的 root.sh,会生成一个文件 /etc/oratab 。

编辑 /etc/oratab ,把所有的 instance 的重启动标志设置成 'Y',如:

ora10g:/home/oracle/OraHome_1:Y

做一个启动脚本 /etc/init.d/dbora ,如下所示:

#!/bin/sh

# description: Oracle auto start-stop script.

# chkconfig: - 20 80

#

# Set ORA_HOME to be equivalent to the $ORACLE_HOME

# from which you wish to execute dbstart and dbshut;

#

# Set ORA_OWNER to the user id of the owner of the

# Oracle database in ORA_HOME.

ORA_HOME=/app/oracle/product/10.2.0/db_1

ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]

then

echo "Oracle startup: cannot start"

exit

fi

case "$1" in

'start')

# Start the Oracle databases:

# The following command assumes that the oracle login

# will not prompt the user for any values

su - $ORA_OWNER -c $ORA_HOME/bin/dbstart

su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"

;;

'stop')

# Stop the Oracle databases:

# The following command assumes that the oracle login

# will not prompt the user for any values

su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"

su - $ORA_OWNER -c $ORA_HOME/bin/dbshut

;;

'restart')

$0 stop

$0 start

;;

esac

赋予执行权限

chmod 750 /etc/init.d/dbora

作成以下链接:

ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora

ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora

执行以下命令:

chkconfig --level 345 dbora on

这样就OK了。下次开关机的时候,Oracle也会随之启动/停止