linux as4单实例Oracle系统启动/关闭脚本

简介:

单实例Oracle系统启动/关闭脚本

 
1.          关于脚本的命名
脚本名称:oracle.sh 部署目录:/etc/rc.d/init.d 服务列表:redhat服务 操作用户:root
启动oracle命令:/etc/init.d/oracle start   关闭oracle命令:/etc/init.d/oracle stop
                service oracle start                         service oracle stop
2.          脚本内容
 
#!/bin/bash
#
# chkconfig: 2345 99 01
# de.ion: init . to start/stop oracle database 10g, TNS listener, EMS
#
#
# match these values to your environment:
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH:/usr/sbin:$HOME/bin
#export NLS_LANG='croatian_croatia.ee8iso8859p2'
export ORACLE_SID=oraDBServer1
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
EOO
        ;;
 
        stop)
        su - "$ORACLE_USER"<<EOO
        lsnrctl stop
        sqlplus /nolog<<EOS
        connect / as sysdba
        shutdown immediate
EOS
        emctl stop dbconsole
EOO
        ;;
 
        *)
        echo "Usage: $0 {start|stop}"
        ;;
esac
注意:
1)         其中两行注释,网上很多脚本因为少了这两行不能使服务自启动:
QUOTE:
#chkconfig: 2345 99 01
#de.ion: init . to start/stop oracle database 10g, TNS listener, EMS
其中chkconfig2345 99 01 是指脚本将为运行级2345启动oracle 10g服务,启动优先级为99,关闭优先级为01
3.          脚本的权限和服务添加操作
1)         使用root用户登录,把文件copy/etc/rc.d/init.d/目录下
2)         赋予执行权限
[root@localhost ~]#cd /etc/init.d
[root@localhost init.d]#chown oracle oracle
[root@localhost init.d]#chmod 755 oracle   
3)         建立符号链接
[root@localhost ~]# cd /etc/rc2.d
[root@localhost rc2.d]#ln -s /etc/rc.d/init.d/oracle S99oracle
[root@localhost init.d]# chkconfig --list oracle
[root@localhost init.d]# chkconfig --level 2345 oracle .
 
重启系统,就可以在启动的过程中看到 Starting oracle,因为我们设置的优先级为99,一般是最后启动。[OK]以后就可以了。因为要启动emctl,可能有点慢,等待的时间要稍微长一点。
 
 
注意:要修改/etc/oratab文件
     orcl:/opt/app/oracle/product/10.2.0/db_1:N (将N该为Y)

本文转自 pgmia 51CTO博客,原文链接:
http://blog.51cto.com/heyiyi/127440
相关文章
|
1天前
|
Ubuntu Linux
Linux(Ubuntu)系统临时IP以及静态IP配置(关闭、启动网卡等操作)
请注意,以上步骤是在临时基础上进行配置的。如果要永久保存静态IP地址,通常还需要修改 `/etc/network/interfaces`文件,以便在系统重启后保持配置。同时,确保备份相关配置文件以防止出现问题。
12 1
|
2天前
|
Linux 数据安全/隐私保护
Linux系统忘记密码的三种解决办法
这篇博客介绍了三种在Linux忘记密码时重置登录密码的方法:1) 使用恢复模式,通过控制台界面以管理员权限更改密码;2) 利用Linux Live CD/USB启动,挂载硬盘分区并使用终端更改密码;3) 进入单用户模式,自动以管理员身份登录后重置密码。每个方法都提供了详细步骤,提醒用户在操作前备份重要数据。
|
2天前
|
JSON Unix Linux
Linux系统之jq工具的基本使用
Linux系统之jq工具的基本使用
29 2
|
2天前
|
数据采集 监控 安全
linux系统被×××后处理经历
linux系统被×××后处理经历
|
3天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
41 2
|
3天前
|
缓存 Linux
linux系统缓存机制
linux系统缓存机制
|
3天前
|
存储 Linux Android开发
RK3568 Android/Linux 系统动态更换 U-Boot/Kernel Logo
RK3568 Android/Linux 系统动态更换 U-Boot/Kernel Logo
18 0
|
Oracle 网络协议 关系型数据库
linux安装oracle client客户端远程连接数据库
  linux安装oracle client客户端远程连接数据库。   1.到oracle官网下载basic,sqlplus,devel三个软件包   oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.tar   oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.tar   oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.tar   2.到root用户下创建一个oracle文件夹
417 0
|
Oracle 关系型数据库 Linux
实战篇:Linux 安装 Oracle 11GR2 数据库保姆级教程(二)
实战篇:Linux 安装 Oracle 11GR2 数据库保姆级教程(二)
实战篇:Linux 安装 Oracle 11GR2 数据库保姆级教程(二)
|
存储 Oracle 关系型数据库