设置linux重启后oracle自动启动的步骤

时间:2021-03-08 08:34:00

数据库单机,为什么这么慢呢,这么空闲

DB Name DB Id Instance Inst num Startup Time Release RAC
XE 2672432555 XE 1 16-Aug-12 16:08 11.2.0.2.0 NO

Host Name Platform CPUs Cores Sockets Memory (GB)
localhost.localdomain Linux x86 64-bit       .00

  Snap Id Snap Time Sessions Cursors/Session
Begin Snap: 355 29-Aug-12 12:00:20    
End Snap: 356 29-Aug-12 13:00:40    
Elapsed:   60.34 (mins)    
DB Time:   0.00 (mins)    

Report Summary


那是应该有很多应用(CPU 和Mem没有了)

top - 13:23:32 up 12 days, 21:05, 14 users,  load average: 0.13, 3.69, 6.22
Tasks: 433 total,   1 running, 431 sleeping,   1 stopped,   0 zombie
Cpu(s): 13.6%us,  1.3%sy,  0.0%ni, 85.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  32841032k total,  31489664k used, 1351368k free,     5940k buffers
Swap: 32767992k total,   403456k used, 32364536k free,   102016k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                      
14248 root      20   0 1380m 377m 1048 S 195.0  1.2   2398:51 BrdUnostat_pd                
28460 root      20   0 1024m  11m  836 S 28.9  0.0   4950:43 BrdUnostat_Abis  


以下步骤是自动启动步骤(断电开机后,自动拉起):

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

1.用root在/etc/rc.d/rc.local(是个文件)中添加下面红色的内容
[root@ksdb rc.d]# more rc.local;
#!/bin/sh
#
# This script. will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style. init stuff.

touch /var/lock/subsys/local
##the script. add /etc/rc.d/rc.local##
##start db script###
export ORACLE_SID=XE
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
su - oracle -c "/u01/app/oracle/product/11.2.0/xe/bin/dbstart"

2.设置:用root在
/etc/oratab中设置下面:
[root@localhost ~]# more /etc/oratab
XE:/u01/app/oracle/product/11.2.0/xe:N

把N改成Y

3.修改$ORACLE_HOME/bin/dbstart脚本(先备份dbstart)
注释掉下面一行
ORACLE_HOME_LISTNER=$1
效果如下:
# Set this to bring up Oracle Net Listener
#ORACLE_HOME_LISTNER=$1

添加下面一行:
export ORACLE_HOME_LISTNER=$ORACLE_HOME

效果:
# Set this to bring up Oracle Net Listener
#ORACLE_HOME_LISTNER=$1
export ORACLE_HOME_LISTNER=$ORACLE_HOME

保存dbstart脚本

3.用root.重启,应该就没有问题了