编辑/etc/oratab文件,使其包括asm实例和oracle实例的自动启动行(红色部分)
[oracle@oracle 10.1]$ cat /etc/oratab # # 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:: # # 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. # # orcl:/oracle/app/10.1:Y +ASM:/oracle/app/10.1:Y |
在$ORACLE_HOME/bin目录中新建startdb.sh,其内容如下:
[@more@][oracle@oracle 10.1]$ cat $ORACLE_HOME/bin/startdb.sh su - oracle -c 'sh /oracle/app/10.1/bin/dbstart' |
修改$ORACLE_HOME/bin/startdb.sh文件的权限,使其对oracle用户可执行
[oracle@oracle 10.1]$ ls -l $ORACLE_HOME/bin/startdb.sh -rwxrwxrwx 1 oracle oinstall 49 Dec 20 09:56 /oracle/app/10.1/bin/startdb.sh |
修改/etc/inittab文件,增加asm和startdb.sh脚本的自动调用(红色的行)
[oracle@oracle 10.1]$ cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 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 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 h2:35:wait:/oracle/app/10.1/bin/startdb.sh >/tmp/stdb.out 2>&1 |
重启Linux主机,查看$ORACLE_HOME/startup.log文件,发现数据库已经启动成功
[oracle@oracle 10.1]$ cat $ORACLE_HOME/startup.log Failure 1 contacting CSS daemon logger: Waiting for Oracle CSS service to be available before starting logger: ASM instance +ASM. Wait 1. Failure 1 contacting CSS daemon logger: Waiting for Oracle CSS service to be available before starting logger: ASM instance +ASM. Wait 2. Failure 1 contacting CSS daemon logger: Waiting for Oracle CSS service to be available before starting logger: ASM instance +ASM. Wait 3. CSS appears healthy /oracle/app/10.1/bin/dbstart: Starting up database "+ASM" Sun Dec 20 10:04:19 CST 2009 SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 20 10:04:20 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> Connected to an idle instance. SQL> ASM instance started Total System Global Area 79691776 bytes Fixed Size 1217812 bytes Variable Size 53308140 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options /oracle/app/10.1/bin/dbstart: ASM instance "+ASM" warm started. /oracle/app/10.1/bin/dbstart: Starting up database "orcl" Sun Dec 20 10:04:37 CST 2009 SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 20 10:04:37 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> Connected to an idle instance. SQL> ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218292 bytes Variable Size 75499788 bytes Database Buffers 83886080 bytes Redo Buffers 7168000 bytes Database mounted. Database opened. SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options /oracle/app/10.1/bin/dbstart: Database instance "orcl" warm started. |
--end--
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22049049/viewspace-1029840/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22049049/viewspace-1029840/