一個關(guān)于Oracle數(shù)據(jù)庫的有趣問題:
中遠公司在沒加磁盤陣列前建了一個Oracle實例zycw,加磁盤陣列后新建了一個實例zync。
為了節(jié)省系統(tǒng)資源本打算平時只啟實例yznc,需要時才啟動zycw?擅看蜗到y(tǒng)重啟后系統(tǒng)會自動重啟實例zycw,rc.d下沒有找到任何自動重啟數(shù)據(jù)庫的腳本,ORACL_HOME/network/admin下也沒有l(wèi)istener.ora文件(系統(tǒng)自啟動時listener服務(wù)時是讀取何處的參數(shù)文件還未搞清楚)。
-
后來才找到系統(tǒng)通過在inittab文件中加入一行startdb:2345678:wait:/etc/rc.startdb調(diào)用/etc/rc.startdb啟動Oracle的。下面詳細介紹一下Oracle的這種自啟動方式:
1、 編輯修改 /etc/oratab文件將要啟動的實例后面的字符改成Y。 文本樣例:
#
# This file is used by Oracle utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $Oracle_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $Oracle_SID are not allowed.
##
*:/home/Oracle:N
# *:/u2/Oracle/product/9.2.0.2.0:N
zycw:/u2/Oracle/product/9.2.0.2.0:N
*:/u2/Oracle/product/9.2.0.2.0:N
zync:/u2/Oracle/product/9.2.0.2.0:Y
#
2、 配置啟動文件: 在/etc下建立文件rc.startdb,腳本如下:(這里是直接調(diào)用Oracle系統(tǒng)自帶的啟動腳本,也可自己編寫啟動腳本)
su - Oracle "-c /u2/oracle/product/9.2.0.2.0/bin/dbstart"
3、 下面要把啟動信息放到/etc/inittab中,加入一行 startdb:2345678:wait:/etc/rc.startdb ,文本樣例:
: @(#)49 1.28.2.9 src/bos/etc/inittab/inittab, cmdoper, bos520 8/23/00 19:50:13
: IBM_PROLOG_BEGIN_TAG
: This is an automatically generated prolog.
:
: bos520 src/bos/etc/inittab/inittab 1.28.2.9
:
: Licensed Materials - Property of IBM
:
: (C) COPYRIGHT International Business Machines Corp. 1989,1993
: All Rights Reserved
:
: US Government Users Restricted Rights - Use, duplication or
: disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
:
: IBM_PROLOG_END_TAG
:
: COMPONENT_NAME: CMDOPER
:
: ORIGINS: 3, 27
:
: (C) COPYRIGHT International Business Machines Corp. 1989, 1993
: All Rights Reserved
: Licensed Materials - Property of IBM
:
: US Government Users Restricted Rights - Use, duplication or
: disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
:
: Note - initdefault and sysinit should be the first and second entry.
:
init:2:initdefault:
brc::sysinit:/sbin/rc.boot 3 >/dev/console 2>&1 # Phase 3 of system boot
powerfail::powerfail:/etc/rc.powerfail 2>&1 | alog -tboot > /dev/console # Power Failure Detection
mkatmpvc:2:once:/usr/sbin/mkatmpvc >/dev/console 2>&1
atmsvcd:2:once:/usr/sbin/atmsvcd >/dev/console 2>&1
load64bit:2:wait:/etc/methods/cfg64 >/dev/console 2>&1 # Enable 64-bit execs
tunables:23456789:wait:/usr/sbin/tunrestore -R > /dev/console 2>&1 # Set tunables
rc:23456789:wait:/etc/rc 2>&1 | alog -tboot > /dev/console # Multi-User checks
fbcheck:23456789:wait:/usr/sbin/fbcheck 2>&1 | alog -tboot > /dev/console # run /etc/firstboot
srcmstr:23456789:respawn:/usr/sbin/srcmstr # System Resource Controller
rctcpip:23456789:wait:/etc/rc.tcpip > /dev/console 2>&1 # Start TCP/IP daemons
sniinst:2:wait:/var/adm/sni/sniprei > /dev/console 2>&1
rcnfs:23456789:wait:/etc/rc.nfs > /dev/console 2>&1 # Start NFS Daemons
cron:23456789:respawn:/usr/sbin/cron
piobe:2:wait:/usr/lib/lpd/pio/etc/pioinit >/dev/null 2>&1 # pb cleanup
qdaemon:23456789:wait:/usr/bin/startsrc -sqdaemon
writesrv:23456789:wait:/usr/bin/startsrc -swritesrv
uprintfd:23456789:respawn:/usr/sbin/uprintfd
shdaemon:2:off:/usr/sbin/shdaemon >/dev/console 2>&1 # High availability daemon
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
l7:7:wait:/etc/rc.d/rc 7
l8:8:wait:/etc/rc.d/rc 8
l9:9:wait:/etc/rc.d/rc 9
naudio::boot:/usr/sbin/naudio > /dev/null
logsymp:2:once:/usr/lib/ras/logsymptom # for system dumps
diagd:2:once:/usr/lpp/diagnostics/bin/diagd >/dev/console 2>&1
ctrmc:2:once:/usr/bin/startsrc -s ctrmc > /dev/console 2>&1
dt:2:wait:/etc/rc.dt
cons:0123456789:respawn:/usr/sbin/getty /dev/console
ha_star:h2:once:/etc/rc.ha_star >/dev/console 2>&1
ntbl_reset:2:once:/usr/bin/ntbl_reset_datafiles
rcml:2:once:/usr/sni/aix52/rc.ml > /dev/console 2>&1
tty0:2:off:/usr/sbin/getty /dev/tty0
tty1:2:off:/usr/sbin/getty /dev/tty1
tty2:2:off:/usr/sbin/getty /dev/tty2
startdb:2345678:wait:/etc/rc.startdb
AIX下Oracle數(shù)據(jù)庫重啟設(shè)置的資料文檔:
Automating Database Startup for AIX (Optional)
Oracle Corporation recommends that you configure your system to automatically
start Oracle databases when your system starts up, and to shut down Oracle
databases when your system shuts down. Automatic database startup and
shutdown protects against improper shutdown of the database.
Automating Database Startup
Perform the following tasks to set up the dbstart and dbshut scripts so that they
are called at system startup. This process must be completed for every new
database that you want to configure for automated startup:
1. Edit the /etc/oratab file.
Configuration Tasks to Perform as the root User
Database entries in the oratab file appears in the following format:
Oracle_SID:ORACLE_HOME:{Y|N}
In the preceding command, Y or N specifies whether you want the dbstart
and dbshut scripts to start up and shut down the database.
For Oracle Real Application Clusters installation, this entry appears in the
following format:
DB_NAME:Oracle_HOME:{Y|N}
In the preceding command, DB_NAME is the cluster database name. Y or N
specifies whether you want the dbstart and dbshut scripts to start up and
shut down the database.
2. For each database that you want to start up, find the Oracle_SID entry
identified by the sid in the first field. Change the last field for each to Y.
3. Add the dbstart script to the /etc/inittab file:
# mkitab "oradb:2:wait:/bin/su oradb -c|/$Oracle_HOMES/bin/dbstart"
In the preceding command, oradb is the identifier of the Oracle user for
which you want to start the database. 本文出自:億恩科技【www.riomediacenter.com】
服務(wù)器租用/服務(wù)器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|