Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101901111
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Oracle

2008-04-22 08:06:56

作者: drivers     出自:
一, 检查硬件需求及内存硬盘需求。
内存512M,swap分区500M

二,安装需要的包
sudo apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm libmotif3 libaio1 libstdc++5 alien

三,添加用户和组
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd oper
sudo useradd -g oinstall -G dba oracle
sudo passwd oracle

四,将oracle安装文件拷贝到目录/u01下,并解压设置权限
sudo mkdir /u01
sudo chown -R oracle /u01
sudo chmod -R 777 /u01
Oracle解压目录为/u01/ORACLE10GR2/database

五,修改sysctl.conf
sudo gedit /etc/sysctl.conf

添加如下行:
kernel.shmmax = 3147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

然后运行 sudo sysctl -p 使设置生效

六,修改 limits.conf
sudo gedit /etc/security/limits.conf
添加
* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

七,建立oracle的安装目录
sudo mkdir -p /u01/app/oracle/product/10.2.0/db_1
sudo chown -R oracle.oinstall /u01

八,建立一个 /etc/redhat-release文件,添加下行
redhat-4
或Red Hat Linux release 4.1

八,设置环境变量
sudo gedit /home/oracle/.profile

添加如下行
# add for oracle
ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1;export ORACLE_HOME

ORACLE_SID=orcl;export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

#end add for oracle

九,注销并用oracle登录,然后运行 /u01/ORACLE10GR2/database/runInstaller
cd /u01/ORACLE10GR2/database
./runInstaller

设置自动启动oracle
建立 /etc/init.d/oracldb 文件,并设置执行权限

内容如下
#add for auto start oracle
#/etc/init.d/oracledb

# set the env var
ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1;export ORACLE_HOME

ORACLE_SID=orcl;export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

#

ORA_OWNR="oracle"
#if the executables do not exists -- 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"
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"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0

#file end

设置权限
chmod 755 /etc/init.d/oracledb
update-rc.d oracledb defaults 99

oralce 的安装文件有些问题,所以如果只用上述的脚本是不能启动 listener的,要修改一下: 修改 /opt/ora10/bin/dbstart文件 查找:

# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

将其改为:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME

这样就可以自动运行了,测试一下
sudo /etc/init.d/oracledb reload
阅读(644) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~