Linux 下自动启动多个oracle实例
2013-02-25 21:10
411 查看
转载自:http://blog.sina.com.cn/s/blog_4502d59c01017bau.html
#!/bin/bash
#
# chkconfig: 35 95 1
# description: init script. to start/stop oracle database10g, TNS
listener, EMS, isqlplus
#
#
#
# match these values to your environment:
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
# export ORACLE_TERM=xterm
export PATH=$PATH/ORACLE_HOME/bin
export NLS_LANG='american_america.ZHS16GBK'
export ORACLE_SID=orc1
# export DISPLAY=localhost:0
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
EOO
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
EOO
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
2)启动多个数据库实力时编写的脚本(取名dbauto)
//这个执行完成后所有实例都正常启动,服务正常运行============================================================
#!/bin/bash
#
# chkconfig: 35 95 1
# description: init script. to start/stop oracle database10g, TNS
listener, EMS, isqlplus
#
#
#
# match these values to your environment:
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
# export ORACLE_TERM=xterm
export PATH=$PATH/ORACLE_HOME/bin
export NLS_LANG='american_america.ZHS16GBK'
export ORACLE_SID=orc1
# export DISPLAY=localhost:0
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog <<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
#change ORACLE_SID
export ORACLE_SID=Test001
lsnrctl start
sqlplus /nolog <<EOS
connect /as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
EOO
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog <<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
#change ORACLE_SID
export ORACLE_SID=Test001
lsnrctl stop
sqlplus /nolog <<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
EOO
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
注意:编辑好启动文件后,需要给予执行权限!
Linux下自动启动多个oracle实例
—环境:
1> linux:linux4.5-32-bit-x86-setup
2> oracleracle Database10gRelease 2 (10.2.0.1.0) EnterpriseStandard Edition for Linux x86
--------------------------------------------------------
—操作详细过程:
[root@localhost ~]#cd /etc/rc.d/init.d
[root@localhost init.d]#touch dbauto
用命令新建好文件(或是 在root用户etc/rc.d/init.d目录下直接新建文件),然后在文件中加入--下面--的脚本
内容,保存
[root@localhost ~]# chmod 755 /etc/rc.d/init.d/dbauto // 设置文件权限
[root@localhost ~]# ls -l /etc/rc.d/init.d/dbauto
-rwxr-xr-x 1 oracle oinstall 785 Oct 23 08:27 /etc/rc.d/init.d/dbauto
[root@localhost ~]# chkconfig --add dbauto 服务添加服务列表
[root@localhost ~]# chkconfig --level 345 dbauto on //设置dbauto服务在指定的运行级别内被启动
[root@localhost ~]#vi dbauto //添加下面内容
1)启动一个数据库实力时编写的脚本(取名dbauto)
#!/bin/bash
#
# chkconfig: 35 95 1
# description: init script. to start/stop oracle database10g, TNS
listener, EMS, isqlplus
#
#
#
# match these values to your environment:
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
# export ORACLE_TERM=xterm
export PATH=$PATH/ORACLE_HOME/bin
export NLS_LANG='american_america.ZHS16GBK'
export ORACLE_SID=orc1
# export DISPLAY=localhost:0
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
EOO
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
EOO
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
2)启动多个数据库实力时编写的脚本(取名dbauto)
//这个执行完成后所有实例都正常启动,服务正常运行============================================================
#!/bin/bash
#
# chkconfig: 35 95 1
# description: init script. to start/stop oracle database10g, TNS
listener, EMS, isqlplus
#
#
#
# match these values to your environment:
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
# export ORACLE_TERM=xterm
export PATH=$PATH/ORACLE_HOME/bin
export NLS_LANG='american_america.ZHS16GBK'
export ORACLE_SID=orc1
# export DISPLAY=localhost:0
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog <<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
#change ORACLE_SID
export ORACLE_SID=Test001
lsnrctl start
sqlplus /nolog <<EOS
connect /as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
EOO
;;
stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog <<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
#change ORACLE_SID
export ORACLE_SID=Test001
lsnrctl stop
sqlplus /nolog <<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
EOO
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
注意:编辑好启动文件后,需要给予执行权限!
相关文章推荐
- Linux下oracle 10g开机自动启动(监听,实例)
- 在LINUX 启动时自动启动ORACLE 10G多个实例数据库的方法
- linux 系统下开机自动启动oracle 监听和实例 (亲测有效)
- linux下设置自动启动和关闭oracle实例、监听
- Linux下设置oracle 10g 服务以及实例自动启动方法
- linux oracle 设置随系统自动启动数据库实例和监听
- linux oracle 服务自动启动、关闭
- oracle as 开机自动启动(linux)
- linux下Oracle自动启动与停止(二)
- Linux开机自动启动ORACLE设置
- linux系统下设置oracle开机自动启动
- Linux平台Oracle多个实例启动说明
- linux下 Oracle自动启动与停止
- oracle的环境配置-设置开机(Linux)自动启动Oracle关机自动关闭Oracle
- linux自动启动 oracle脚本
- 讲解linux环境下Oracle的自动启动与停止
- 6个Linux chkconfig命令实例 - 增加,删除,查看和修改services的自动启动选项
- linux下 Oracle自动启动与停止
- oracle上设置自动启动多个数据实例
- 安装最后一步:linux设置oracle数据库和监听开机自动启动