[原创] Redhat AS3_U6 的 Oracle9i 安装完全攻略--脚本精选
发信人: Wwashington (Jacky), 信区: NewSoftware
标 题: [原创] Redhat AS3_U6 的 Oracle9i 安装完全攻略--脚本精选
发信站: 水木社区 (Thu Apr 6 23:39:42 2006), 站内
Written By: Wwashington(AT)newsmth.org
Published : 2006/04/06
脚本说明:对 grep 程序路径和参数进行管理,是为了确保在SunOS/HP-UX
及Redhat 9.0/Redhat AS3运行的兼容性,得到准确的检查结果。
如果不作特别声明,以下内容默认是以 root 权限操作的。
/etc/rc.d/init.d/dbora 这个脚本是以 Oracle 8i 和 Redhat 7.3 为基础
设计的,修改个别参数后能在 Oracle 9i 和 Redhat 9.0、Redhat AS3
上正常使用。因为篇幅的关系,请大家参考网页。
http://www.chinaunix.net/jh/4/426316.html
Oracle 的标准系统服务脚本 for Redhat Linux
$ORACLE_HOME 的 .bash_profile 和 .bashrc 这两个是 oracle 登录脚本
/usr/bin/dbstat 通过 ps, lsof, grep 这几个命令,来检测服务运行状态
/usr/bin/mc 修改 gcc 和 gc++ 的当前版本,一般是 link 到 296 或 323
/usr/bin/mn 过滤 chinput 垃圾信息要用,必须确保 /dev/null 设备存在
/usr/bin/mo 如果 Oracle9i 已经安装,但是 dbstart 不能用,这里修正
/usr/bin/pc 运行 chinput,常用在 Linux 本机 X,WinXp 的 Xman,Vnc
/usr/bin/pg 查找名字包含特定字符的进程,显示出来。例如 pg chinput
/usr/bin/pk 查找名字包含特定字符的进程,并且杀掉。例如 pk chinput
---------------------------------------------------------------------
su - oracle; 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=/uxdb/ora9i
export ORACLE_HOME=/uxdb/ora9i/product/9.2
export ORACLE_OWNER=oracle
export ORACLE_SID=ora9i
export ORACLE_NAME=turbo
export ORACLE_TERM=xterm
export PATH=$ORACLE_BASE/OPatch:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/local/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export NLS_LANG='American_America.ZHS16GBK'
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
if [ -z "$DISPLAY" ]; then export DISPLAY=127.0.0.1:0.0; fi
if [ "$USER" = "oracle" ]; then
export PATH=$ORACLE_HOME/jdk/bin:$ORACLE_HOME/Apache/perl/bin:$PATH
export PERL5LIB=/uxdb/ora9i/product/9.2/Apache/perl/lib/5.00503:/uxdb/ora9i/product/9.2/Apache/perl/lib/site_perl/5.005/i686-linux
export LD_ASSUME_KERNEL=2.4.1
else
JAVA_HOME=/usr/j2sdk
JRE_HOME=$JAVA_HOME/jre
export JAVA_HOME JRE_HOME
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
CLASSPATH=$JRE_HOME:$CLASSPATH
export PATH CLASSPATH
fi
----->
---------------------------------------------------------------------
su - oracle; vi ~/.bashrc
<-----
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ll='ls -laF'
alias al='alias'
alias cl='clear'
alias oe='env | grep -e DISP -e FLAG -e HOME -e LIB -e KER'
alias op='if [ "$USERNAME" = "root" ]; then /usr/sbin/lsof -P | grep -e :177 -e :6000 -e :7100 | grep -e UDP -e LISTEN; else echo "You must be root to run it!";fi'
alias cda='cd $ORACLE_HOME/Apache/Apache/bin'
alias cdb='cd $ORACLE_BASE'
alias cdn='cd $ORACLE_HOME/network/lib'
alias cdo='cd $ORACLE_HOME'
alias cdv='cd ~/.vnc'
alias vnc='vncserver'
alias vnl="ls -w5 ~/.vnc/\$HOSTNAME*.pid 2> /dev/null; netstat -na | grep -e :590 | grep LISTEN; ps -ef | grep Xvnc | grep -v grep | awk '{ print \"[USER]=\"\$1\"\t\t [PORT]=\" \$26\"\t\t[PID]=\"\$2 }'"
alias vnk='for i in ~/.vnc/$HOSTNAME:*.pid ; do basename $i .pid | xargs -i vncserver -kill {}; done'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
if [ "$USER" = "oracle" ]; then
if [ -n "$SESSION_MANAGER" ]; then
pk chinput > /dev/null
#--- Remark the 2 xprop after Ora9i installation
xprop -root -remove _MOTIF_DEFAULT_BINDINGS
xprop -root -remove WM_LOCALE_NAME
#--- xprop -root -remove XIM_SERVERS
#--- {VNC} xprop: no such property "XIM_SERVERS"
fi
#- If only LANG is set, so that LANG=C means English
#- If all 3 env are set, then LC_ALL=C means English
export LANG=zh_CN.GB2312
#- export LC_ALL=zh_CN.GB2312
#- export LC_CTYPE=zh_CN.GB2312
export LANGUAGE=zh_CN.GB2312:zh_CN
fi
----->
---------------------------------------------------------------------
vi /usr/bin/dbstat
<-----
GREP_UNIX=`uname | awk '{if($1 ~ /(^SunOS|^HP-UX)/) print $1}'`
if ! [ "$GREP_UNIX" = "" ]
then
GREP_FILE=/usr/xpg4/bin/grep
GREP_FLAG=ef
else
GREP_FILE=/bin/grep
GREP_FLAG=efw
fi
echo
echo "--- 1) Check Apache Java Service -------------------------------------------------"
echo "# /usr/sbin/lsof -P | grep httpd | grep LISTEN | grep -v grep"
/usr/sbin/lsof -P | grep httpd | grep LISTEN | grep -v grep
echo "--- 2) Check Oracle Agent DBSNMP -------------------------------------------------"
echo "# ps -$GREP_FLAG | $GREP_FILE -e dbsnmp | grep -v grep"
ps -$GREP_FLAG | $GREP_FILE -e dbsnmp | grep -v grep
echo "--- 3) Check Oracle and Listener -------------------------------------------------"
echo "# ps -$GREP_FLAG | $GREP_FILE -e ora_ -e lsnr | grep -v grep"
ps -$GREP_FLAG | $GREP_FILE -e ora_ -e lsnr | grep -v grep
echo
----->
chmod +x /usr/bin/dbstat
---------------------------------------------------------------------
vi /usr/bin/mc
<-----
GCC_OLD=296
GCC_NEW=323
cd /usr/bin
if [ ! -r gcc$GCC_NEW ]; then mv gcc gcc$GCC_NEW; fi
if [ ! -r g++$GCC_NEW ]; then mv g++ g++$GCC_NEW; fi
if [ "$1" = "" ]; then
echo Please input gcc version, {value} = $GCC_OLD OR $GCC_NEW
echo ---OOO---OOO---OOO---OOO---OOO---OOO---OOO---!
else
if [ "$1" = "$GCC_OLD" -o "$1" = "$GCC_NEW" ]; then
rm -f gcc g++
ln -s gcc$1 gcc
ln -s g++$1 g++
else
echo Wrong input gcc version, {value} = $GCC_OLD OR $GCC_NEW
echo ---XXX---XXX---XXX---XXX---XXX---XXX---XXX---!!
fi
fi
ls -la gcc* g++*
----->
chmod +x /usr/bin/mc
---------------------------------------------------------------------
vi /usr/bin/mn
<-----
if [ ! -r /dev/null ]; then mknod /dev/null c 1 3; chmod 666 /dev/null; fi; ls -la /dev/null
----->
chmod +x /usr/bin/mn
---------------------------------------------------------------------
vi /usr/bin/mo
<-----
if [ -r $ORACLE_BASE/admin/$ORACLE_NAME/pfile/. ]; then
ls $ORACLE_BASE/admin/$ORACLE_NAME/pfile/*
rm -f $ORACLE_HOME/dbs/init$ORACLE_SID.ora
cp $ORACLE_BASE/admin/$ORACLE_NAME/pfile/init$ORACLE_SID.ora.* $ORACLE_HOME/dbs/init$ORACLE_SID.ora
echo "# copy to: dbs ---->"
ls $ORACLE_HOME/dbs/init$ORACLE_SID.ora
echo "# check spfile ---->"
ls $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora
else
echo Oracle9i is not installed or has been damaged!
fi
----->
chmod +x /usr/bin/mo
---------------------------------------------------------------------
vi /usr/bin/pc
<-----
chinput > /dev/null
----->
chmod +x /usr/bin/pc
---------------------------------------------------------------------
vi /usr/bin/pg
<-----
GREP_UNIX=`uname | awk '{if($1 ~ /(^SunOS|^HP-UX)/) print $1}'`
if ! [ "$GREP_UNIX" = "" ]
then
GREP_FILE=/usr/xpg4/bin/grep
GREP_FLAG=ef
else
GREP_FILE=/bin/grep
GREP_FLAG=efw
fi
GREP_DATA=`ps -$GREP_FLAG | grep $1 | grep -v grep`
if [ -n "$GREP_DATA" ]; then
ps -$GREP_FLAG | $GREP_FILE -e $1 -e "PID PPID" | grep -v grep
fi
----->
chmod +x /usr/bin/pg
---------------------------------------------------------------------
vi /usr/bin/pk
<-----
# You can define the program to kill by name here. grep -v is list exception
# for some keyword. ps and grep will randomly list itself, grep -v filter it.
export KILL_PRG=$1
echo "# ps -ef | grep $KILL_PRG | grep -v grep | awk '{ print \$2 }' | xargs -i kill -9 {}"
ps -ef | grep $KILL_PRG | grep -v grep | awk '{ print $2 }' | xargs -i kill -9 {}
----->
chmod +x /usr/bin/pk
---------------------------------------------------------------------
[ 本帖最后由 wwashington 于 2006-4-13 21:45 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新了两个 alias,查看全部 vnc 以及杀掉当前用户的 vnc,支持多用户多进程。
其中的 2> /dev/null 是把标准错误重定向到 null 设备,也就是不显示错误。
alias vnl="ls -w5 ~/.vnc/\$HOSTNAME*.pid 2> /dev/null; netstat -na | grep -e :590 | grep LISTEN; ps -ef | grep Xvnc | grep -v grep | awk '{ print \"[USER]=\"\$1\"\t\t [PORT]=\" \$26\"\t\t[PID]=\"\$2 }'"
alias vnk='for i in ~/.vnc/$HOSTNAME:*.pid ; do basename $i .pid | xargs -i vncserver -kill {}; done'
[oracle@rebeca oracle]$ vnl
/home/oracle/.vnc/rebeca:2.pid
/home/oracle/.vnc/rebeca:3.pid
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5903 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5904 0.0.0.0:* LISTEN
[USER]=root [PORT]=5901 [PID]=10418
[USER]=oracle [PORT]=5902 [PID]=10477
[USER]=oracle [PORT]=5903 [PID]=10531
[USER]=root [PORT]=5904 [PID]=10590
[oracle@rebeca oracle]$ vnk
Killing Xvnc process ID 10477
Killing Xvnc process ID 10531
[root@rebeca root]# vnk {注意:这个是 root 用户}
Killing Xvnc process ID 10418
Killing Xvnc process ID 10590
[ 本帖最后由 wwashington 于 2006-4-13 21:50 编辑 ]