oracle数据库安装3

前面已经安装好了oracle数据库,那么在这一节我要写的是系统启动时,自动启动oracle监听和启动oracle数据库。

1    写数据库启动和停止脚本

[oracle@zjk ~]$ vim shutdown11g
#!/bin/bash
source /home/oracle/.db11g
sqlplus / as sysdba << EOF
shutdown immediate
EOF
lsnrctl stop

[oracle@zjk ~]$ chmod u+x shutdown11g 

[oracle@zjk ~]$ vim start11g
#!/bin/bash
source /home/oracle/.db11g
lsnrctl start
sqlplus / as sysdba << EOF
startup
EOF

[oracle@zjk ~]$ chmod u+x start11g 

2    把启动和停止脚本添加到系统服务中

[root@zjk init.d]# cp /etc/init.d/network /etc/init.d/oracle

[root@zjk init.d]# vim oracle

#! /bin/bash
#
# oracle Bring up/down oracle
#
# chkconfig: 2345 90 1
# description: Activates/Deactivates aoracle configured to \
# start at boot time.
#

# Source function library.
. /etc/init.d/functions



# See how we were called.
case "$1" in
start)
       su - oracle -c "/home/oracle/start11g"
        ;;
stop)
       su - oracle -c "home/oracle/shutdown11g"
        ;;
*)
        echo $"Usage: $0 {start|stop}"
        exit 2
esac

[root@zjk init.d]# chmod u+x /etc/init.d/oracle

[root@zjk init.d]# chkconfig oracle on

这样就完成了系统启动,然后可以自动启动oracle数据库监听和启动oracle数据库的功能了。

3    使sqlplus可以上下翻命令的方法

tar -zxvf rlwrap-0.37.tar.gz

./configure

make

make install

rlwrap sqlplus / as sysdba

这个rlwrap-0.37.tar.gz包网上可以下载到的。

希望我的这三篇数据库安装的文章对刚学数据库安装有帮助。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值