3.以下修改内核参数等文件,已保证Oracle的预安装准备成功。执行如下:
vi /etc/sysctl.conf 行末添加以下内容
# 20091208 add content for oracle install
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
执行下述命令。导入刚才写入的参数。不执行,oracle在后面安装前的检测会报警。
sysctl -p
vi /etc/security/limits.conf 行末添加以下内容
# 20071212 add content for oracle install
soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
vi /etc/pam.d/login 行末添加以下内容
# 20071212 add content for oracle install
session required pam_limits.so
vi /etc/selinux/config 确保以下内容
SELINUX=disabled
此处再确认一下吧。
4.创建oracle用户,和一些安装目录
groupadd dba
groupadd oinstall
useradd -g oinstall -G dba -m oracle
passwd oracle
mkdir -p /opt/oracle
chown -R oracle.oinstall /opt/oracle
将oracle的安装文件置于家目录,进行加压。
zcat 10201_database_linux_x86_64.cpio.gz | cpio -idmv
5.添加环境变量,定义SID等
su - oracle
vi .bash_profile
#--------------------------------------
# Set for Oracle10g Install;
#--------------------------------------
trap " " 0 1 2 3 5 9 15
trap clear 0
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=dsc
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
#export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/X11R6/lib64/
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_ASSUME_KERNEL=2.6.18
export NLS_LANG="AMERICAN_CHINA.ZHS16GBK"
LC_CTYPE=zh_CN.UTF8
LC_ALL=zh_CN.UTF8
LANG=zh_CN.UTF8
umask 022
#
执行环境设置
source ~/.bash_profile
6.因为oracle 的官方只支持到RHEL4为止,所以要修改版本说明,编辑文件 /etc/redhat-release
把Red Hat Enterprise Linux Server release 5 (Tikanga) 改成版本:
Red Hat Enterprise Linux AS release 4 (Nahant Update)
当然oracle安装完成后,要修改回来.
7.安装oracle
终端输入:xhost local:oracle
non-network local connections being added to access control list
#export DISPLAY=:0.0
#xhost +
su - oracle
export LANG=en_US
./database/runInstaller
安装到最后时,一定要注意运行安装系统提示的那两个脚本。
8.启动oracle
安装后的调整dbstart
在运行$ORACLE_HOME/bin/dbstart时报错,
Failed to auto-start Oracle Net Listene using
/ade/vikrkuma_new/oracle/bin/tnslsnr
解决方法:修改dbstart这个文件,找到ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
su - oracle
vi `which dbstart`
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改/etc/oratab文件
dsc:/datas/apps/oracle/product/10.2.0/db_1:Y
创建自启动脚本。
oracle
10g在自身的dbstart已经启动了lsnrctl,所以下面的脚本上注释掉了lsnrctl的启动
touch dbora
chmod 700 dbora
vi dbora
dbora内容如下
#!/bin/bash
#
# chkconfig: 2345 80 05
# description: Oracle 10g Server
# /etc/init.d/dbora
#
# Run-level Startup script for the Oracle Instance, Listener,
and
# Web Interface
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=dsc
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME
]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown,
restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
# su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl
start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start
dbconsole"
su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl
start"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
# su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl
stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop
dbconsole"
su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl
stop"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0`
start|stop|restart|reload"
exit 1
esac
exit 0
加载到自动启动目录
cp dbora /etc/rc.d/init.d
chkconfig --add dbora
chkconfig --list | grep dbora
[root@localhost init.d]# /sbin/chkconfig --add
dbora
[root@localhost init.d]# /sbin/chkconfig --list |grep
dbora
dbora 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
一些服务介绍和补充
a:$ORACLE_HOME/bin/dbstart | dbshut
b:$ORACLE_HOME/bin/lsnrctl start | stop 监听器启动|关闭。
c:$ORACLE_HOME/bin/emctl start | stop dbconsole
访问 http://yourIP:1158/em
d:$ORACLE_HOME/bin/isqlplusctl start | stop
访问 http://yourIP:5560/isqlplus