Linux 下Oracle11g 自動隨系統啟動

2021-08-23 15:50:00 字數 2594 閱讀 9847

安裝完畢 oracle 11g 每次都得手動啟動 | 停止資料庫(dbstart | dbshut)、***(lsnrctl)、控制台(emtcl)。

設定一下,若手動啟動資料庫的同時***沒有啟動(即啟動資料庫時自動啟動***,停止資料庫時停止***),則需要修改 dbstart 指令碼檔案

# vi dbstart

找到此段話,在最前端

# first argument is used to bring up oracle net listener

oracle_home_listner=$1

//需要將此處的 oracle_home_listner=$1 修改為 oracle_home_listner=$oracle_home

if [ ! $oracle_home_listner ] ; then

echo "oracle_home_listner is not set, unable to auto-start oracle net listener"

echo "usage: $0 oracle_home"

else

log=$oracle_home_listner/listener.log

同樣,也需要修改 dbshut

# vi dbshut

# the this to bring down oracle net listener

oracle_home_listner=$1

//需要將此處的 oracle_home_listner=$1 修改為 oracle_home_listner=$oracle_home

if [ ! $oracle_home_listner ] ; then

echo "oracle_home_listner is not set, unable to auto-stop oracle net listener"

echo "usage: $0 oracle_home"

else

log=$oracle_home_listner/listener.log

在啟動了linux系統之後,轉到 /etc/init.d 目錄下;

# cd /etc/init.d

使用 vi 命令,新建乙個以 oracle 命名的檔案(並將以下**複製至檔案中)

# vi oracle

#!/bin/sh

# chkconfig: 345 61 61

# description: oracle 11g autorun services

# /etc/init.d/oracle

## run-level startup script for the oracle instance, listener, and

# web inte***ce

export oracle_home=$oracle_base/product/11.1.0/db_1

export oracle_sid=orcl

export path=$path:$oracle_home/bin

ora_ownr="oracle"

# if the executables do not exist -- 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

su $ora_ownr -lc $oracle_home/bin/dbstart

echo "oracle start succesful!ok."

;;stop)

# oracle listener and instance shutdown

su $ora_ownr -lc $oracle_home/bin/dbshut

echo "oracle stop succesful!ok."

;;reload|restart)

$0 stop

$0 start

;;*)

echo $"usage: `basename $0` "

exit 1

esac

exit 0

在編輯完成之後,使用 :x 命令儲存此檔案。

賦予執行許可權

# chmod 750 /etc/init.d/oracle

# ln -s /etc/init.d/oracle /etc/rc1.d/k61oracle

# ln -s /etc/init.d/oracle /etc/rc3.d/s61oracle

執行以下命令:

# chkconfig --level 345 oracle on

# chkconfig --add oracle //新增到服務裡

Linux下解除安裝Oracle 11g

第一種方法 使用oracle自帶的runinstaller 解除安裝 oracle localhost cd opt oracle product 11.2.0 dbhome 1 deinstall oracle localhost deinstall export lang en oracle l...

Linux下解除安裝Oracle 11g

第一種方法 使用oracle自帶的runinstaller 解除安裝 oracle localhost cd opt oracle product 11.2.0 dbhome 1 deinstall oracle localhost deinstall export lang en oracle l...

在Linux下解除安裝Oracle 11g

1.使用sql plus停止資料庫 oracle oracletest oracle sqlplus nolog sql connect as sysdba sql shutdown immediate sql exit 2.停止listener oracle oracletest oracle l...