RedHat 安装Oracle
RedHat 安装Oracle
版本
Linux :RedHat 5.6
Oracle:10.2
安装前准备
1.修改操作系统版本,oracle安装前会验证操作系统版本如果不认识的版本就无法安装
- vi /etc/redhat-release
- #注释掉原内容,把内容改为redhat-4
2.创建oracle用户
2.1创建用户组
- groupadd oinstall
- groupadd dba
- useradd oracle -g oinstall -G dba
- passwd oracle
3.准备安装目录
3.1创建目录
- mkdir /usr/local/src/oracle10g
- mkdir /usr/local/src/oracle10g/oradata
- chown -R oracle:oinstall /usr/local/src/oracle10g
- chown -R oracle:oinstall /usr/local/src/oracle10g/oradata
- chmod -R 755 /usr/local/src/oracle10g
- chmod -R 755 /usr/local/src/oracle10g/oradata
这步很重要,不要用su oracle,要登出当前的root用户后用oracle用户登录
5.设置oracle用户的环境变量
5.1修改环境变量
编辑~路径下.bash_profile
- vi .bash_profile
- export PATH
- export ORACLE_BASE=/usr/local/src/oracle10g
- export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
- export ORACLE_SID=risespdb
- export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
- source ~/.bash_profile
1.解压缩
如果oracle安装文件为1021_database_linux32.zip
- unzip 10201_database_linux32.zip 10201_database_linux32
- cd 10201_database_linux32
- chmod a+rwx -R database
- export LANG=en
- ./runInstall
安装到最后可能会有两个脚本文件因权限无法执行
哥们记不住确切名字了,记下这两个文件在哪,用root用户登录分别到文件所在目录下执行
- ./(脚本文件名).sh
3.完成后修改文件
- vi /etc/oratab
- orcl:/usr/local/src/oracle10g/product/10.2.0/db_1:Y
4.修改$ORACLE_HOME/bin/dbstart
- cd $ORACLE_HOME
- cd bin
- vi dbstart
- ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
更改为
- ORACLE_HOME_LISTNER=$ORACLE_HOME
- ./dbstart
6.创建oracled服务启动脚本
在/etc/init.d目录下创建文件名称为oracled的文件
在oracled文件中添加如下内容(脚本为网上搜索非原创)
- #! /bin/bash
- # chkconfig: - 85 15
- # description: oracle 10g is database. It is used to serve
- # file : /etc/init.d/oracled
- # Run-level Startup script for the Oracle Instance, Listener, Web Interface
- export ORACLE_BASE=/usr/local/src/oracle10g
- export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
- export ORACLE_SID=orcl
- ORA_OWNER="oracle"
- #if the executables do not exist ,then display error
- if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
- then
- echo "oracle startup : can't start"
- exit 1
- fi
- # the oracle10g database depending on parameter -- start, shutdown,restart
- case "$1" in
- start)
- echo -n "starting oracle:"
- su $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart"
- touch /var/lock/oracle
- echo "ok"
- ;;
- stop)
- echo -n "shutdown oracle:"
- su $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut"
- rm -f /var/lock/oracle
- echo "ok"
- ;;
- reload|restart)
- $0 stop
- $0 start
- ;;
- *)
- echo "Usage:`basename $0` start|stop|restart|reload"
- exit 1
- esac
- exit 0
- cd /etc/init.d
- chmod 755 oracled
- chkconfig -add oracled
- service oracled start
评论暂时关闭