猝然临之而不惊,无故加之而不怒。
分类: Oracle
2010-08-24 08:39:02
一,关机.
1,先停止AP1 & AP2的IIS服务,不要让其它操作人员有连接数据库的情况。
2,先关闭DB1主机. #sync;sync;sync;halt -p
观察DB2是否“夺权”,将DM & MES 数据库控制权都要过来。
#ps –ef |grep ora
3,再关闭DB2主机,#sync;sync;sync;halt –p
二,开机,
1, 同时按下DB1 & DB2的电源按钮,使两台SERVER同时开机即可。
2, DB1 & DB2 进入系统后,查看资料库是否正常启动,正常启动后才能进入步骤3
正常情况下,Oracle DB的启动情况:
[root@szcimesdb1 log]# ps -ef|grep ora
orames 989 1 0 15:39 ? 00:00:00 /oracle_mes/u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
orames 3209 1 0 16:27 ? 00:00:00 oraclemes (LOCAL=NO)
root 4175 4130 0 15:01 ? 00:00:00 hald-addon-storage: polling /dev/hda
orames 6045 1 0 15:02 ? 00:00:00 ora_pmon_mes
orames 6049 1 0 15:02 ? 00:00:00 ora_psp0_mes
orames 6053 1 0 15:02 ? 00:00:00 ora_mman_mes
orames 6056 1 0 15:02 ? 00:00:00 ora_dbw0_mes
orames 6058 1 0 15:02 ? 00:00:00 ora_lgwr_mes
orames 6062 1 0 15:02 ? 00:00:00 ora_ckpt_mes
orames 6064 1 0 15:02 ? 00:00:00 ora_smon_mes
orames 6066 1 0 15:02 ? 00:00:00 ora_reco_mes
orames 6069 1 0 15:02 ? 00:00:00 ora_cjq0_mes
orames 6071 1 0 15:02 ? 00:00:00 ora_mmon_mes
orames 6073 1 0 15:02 ? 00:00:00 ora_mmnl_mes
orames 6075 1 0 15:02 ? 00:00:00 ora_d000_mes
orames 6077 1 0 15:02 ? 00:00:00 ora_s000_mes
orames 6092 1 0 15:02 ? 00:00:00 ora_qmnc_mes
orames 6104 1 0 15:02 ? 00:00:01 ora_j000_mes
orames 6473 1 0 15:02 ? 00:00:00 ora_q000_mes
orames 6475 1 0 15:02 ? 00:00:00 ora_q001_mes
orames 19322 1 2 16:50 ? 00:00:06 oraclemes (LOCAL=NO)
root 23446 22143 0 16:56 pts/1 00:00:00 grep ora
orames 32647 1 0 16:23 ? 00:00:00 oraclemes (LOCAL=NO)
[root@szcimesdb1 log]# cd /home/orames
[root@szcimesdb1 orames]# ls
dbshutdown.sh dbstartup.sh Desktop oracle_mes_install.htm Screenshot-1.png Screenshot-2.png Screenshot-3.png Screenshot.png sqlnet.log
[root@szcimesdb1 orames]# more dbstartup.sh
#!/bin/bash
su - orames
oracle
lsnrctl start
sqlplus /nolog
<
connect /as sysdba
startup
quit
EOF
/* 正常情况 ,一台DB为DM,另一台为MES,如果szcimesdb1夺权为mes数据库才可以使用此用户及命令查询,否则无法执行 */
[root@szcimesdb1 orames]# su – orames
[orames@szcimesdb1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 23-AUG-2010 17:00:16
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 23-AUG-2010 15:39:21
Uptime 0 days 1 hr. 20 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle_mes/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle_mes/u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=szcimesdb1.umec.com.tw)(PORT=1521)))
Services Summary...
Service "mes" has 1 instance(s).
Instance "mes", status READY, has 1 handler(s) for this service...
Service "mesXDB" has 1 instance(s).
Instance "mes", status READY, has 1 handler(s) for this service...
Service "mes_XPT" has 1 instance(s).
Instance "mes", status READY, has 1 handler(s) for this service...
The command completed successfully
[orames@szcimesdb1 ~]$
[oradm@szcimesdb2 init.d]$ ps -ef |grep ora
oradm 2251 1 0 16:16 ? 00:00:08 ora_j000_dm
root 4153 4122 0 15:34 ? 00:00:00 hald-addon-storage: polling /dev/hda
root 5220 4778 0 17:06 pts/2 00:00:00 su - oradm
oradm 5221 5220 0 17:06 pts/2 00:00:00 -bash
oradm 5754 1 0 15:34 ? 00:00:00 /oracle_dm/u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oradm 5762 1 0 15:34 ? 00:00:00 ora_pmon_dm
oradm 5764 1 0 15:34 ? 00:00:00 ora_psp0_dm
oradm 5766 1 0 15:34 ? 00:00:00 ora_mman_dm
oradm 5768 1 0 15:34 ? 00:00:00 ora_dbw0_dm
oradm 5770 1 0 15:34 ? 00:00:00 ora_lgwr_dm
oradm 5772 1 0 15:34 ? 00:00:00 ora_ckpt_dm
oradm 5774 1 0 15:34 ? 00:00:00 ora_smon_dm
oradm 5776 1 0 15:34 ? 00:00:00 ora_reco_dm
oradm 5778 1 0 15:34 ? 00:00:00 ora_cjq0_dm
oradm 5780 1 0 15:34 ? 00:00:00 ora_mmon_dm
oradm 5782 1 0 15:34 ? 00:00:00 ora_mmnl_dm
oradm 5784 1 0 15:34 ? 00:00:00 ora_d000_dm
oradm 5786 1 0 15:34 ? 00:00:00 ora_s000_dm
oradm 5795 1 0 15:35 ? 00:00:00 ora_qmnc_dm
oradm 5994 1 0 15:35 ? 00:00:00 ora_q000_dm
oradm 5996 1 0 15:35 ? 00:00:00 ora_q001_dm
oradm 19289 5221 0 17:26 pts/2 00:00:00 ps -ef
oradm 19290 5221 0 17:26 pts/2 00:00:00 grep ora
[oradm@szcimesdb2 init.d]$cd /home
[root@szcimesdb2 home]# cd oradm
[root@szcimesdb2 oradm]# ls
dbshutdown.sh Desktop oracle_dm_install1.htm Screenshot-1.png Screenshot-3.png sqlnet.log
dbstartup.sh oracle_dm_install19.htm oracle_dm_install.htm Screenshot-2.png Screenshot.png
_dm_install.htm Screenshot-2.png Screenshot.png
[root@szcimesdb2 oradm]# more dbstartup.sh
#!/bin/bash
su - oradm
oracle
lsnrctl start
sqlplus /nolog
<
connect /as sysdba
startup
quit
EOF
[root@szcimesdb2 oradm]# su - oradm
[oradm@szcimesdb2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 23-AUG-2010 17:28:17
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 23-AUG-2010 15:34:53
Uptime 0 days 1 hr. 53 min. 24 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle_dm/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle_dm/u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=szcimesdb2.umec.com.tw)(PORT=1521)))
Services Summary...
Service "dm" has 1 instance(s).
Instance "dm", status READY, has 1 handler(s) for this service...
Service "dmXDB" has 1 instance(s).
Instance "dm", status READY, has 1 handler(s) for this service...
Service "dm_XPT" has 1 instance(s).
Instance "dm", status READY, has 1 handler(s) for this service...
The command completed successfully
[oradm@szcimesdb2 ~]$
3, 再开启AP1 & AP2的IIS服务。
Oracle 包括Linster和DB两部分,如果 Lister没有启动起来,晚一点操作即可。
/* 如果有资料库不能启动的情况,手工启动资料库 */
[orames@szcimesdb1 ~]$ cd /etc/rc.d/init.d
[orames@szcimesdb1 init.d]$ ls
acpid conman dnsmasq ip6tables luci netplugd oracledb_mes.bak readahead_early sendmail winbind
anacron cpuspeed dund ipmi lvm2-monitor network oracledb_mes.sh readahead_later setroubleshoot wpa_supplicant
atd crond firstboot iptables mcstrans NetworkManager oracledb_mes.sh~ restorecond single xfs
auditd cups functions ipvsadm mdmonitor nfs pand rgmanager smartd xinetd
autofs cups-config-daemon gfs irda mdmpd nfslock pcscd rhnsd snmpd ypbind
avahi-daemon dbdm.bak gfs2 irqbalance messagebus nscd piranha-gui ricci snmptrapd yum-updatesd
avahi-dnsconfd dbdm.sh gpm kdump microcode_ctl ntpd portmap rpcgssd sshd
bluetooth dbdm.sh~ haldaemon killall modclusterd oddjobd psacct rpcidmapd syslog
clvmd dbmes.bak halt krb524 multipathd openais pulse rpcsvcgssd tog-pegasus
cman dbmes.sh hidd kudzu netconsole oracledb_dm.bak qdiskd saslauthd vncserver
cmirror dbmes.sh~ httpd lm_sensors netfs oracledb_dm.sh rdisc scsi_reserve wdaemon
[orames@szcimesdb1 init.d]$ more dbdm.sh
!/bin/sh
ORAHOME=/oracle_dm/u01/app/oracle/product/10.2.0/db_1
ORAUSER=oradm
ORAUSER_HOME=/home/oradm
case "$1" in
'start')
# Start the Oracle databases:
echo -n "Starting Oracle Database: "
echo "`date +%Y-%m-%d_%H%M%S` dm Start" >> /var/log/messages
#
# Your service startup command goes here.
#
su - $ORAUSER -c "$ORAUSER_HOME/dbstartup.sh"
touch /var/lock/subsys/dm
echo
;;
'stop')
# Stop the Oracle databases:
echo -n "Shutting down Oracle Database: "
echo "`date +%Y-%m-%d_%H%M%S` dm Stop" >> /var/log/messages
#
# Your service shutdown command goes here.
#
su - $ORAUSER -c "$ORAUSER_HOME/dbshutdown.sh"
rm -f /var/lock/subsys/dm
echo
;;
'status')
# Stop the Oracle databases:
ps -ef | grep -v grep | grep -q ora_smon_dm
if [ $? = 0 ]
then exit 0
fi
;;
'restart')
# Restart the Oracle databases:
echo -n "Retarting Oracle Database: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: oradm { start | stop | restart }"
exit 1
;;
esac
exit 0
[orames@szcimesdb1 init.d]$ more dbmes.sh
#!/bin/sh
ORAHOME=/oracle_mes/u01/app/oracle/product/10.2.0/db_1
ORAUSER=orames
ORAUSER_HOME=/home/orames
case "$1" in
'start')
# Start the Oracle databases:
echo -n "Starting Oracle Database: "
echo "`date +%Y-%m-%d_%H%M%S` MES Start" >> /var/log/messages
#
# Your service startup command goes here.
#
su - $ORAUSER -c "$ORAUSER_HOME/dbstartup.sh"
touch /var/lock/subsys/mes
echo
;;
'stop')
# Stop the Oracle databases:
echo -n "Shutting down Oracle Database: "
echo "`date +%Y-%m-%d_%H%M%S` MES Stop" >> /var/log/messages
#
# Your service shutdown command goes here.
#
su - $ORAUSER -c "$ORAUSER_HOME/dbshutdown.sh"
rm -f /var/lock/subsys/mes
echo
;;
'status')
# Stop the Oracle databases:
ps -ef | grep -v grep | grep -q ora_smon_mes
if [ $? = 0 ]
then exit 0
fi
;;
'restart')
# Restart the Oracle databases:
echo -n "Retarting Oracle Database: "
$0 stop
$0 start
echo
;;
*)
echo "Usage: orames { start | stop | restart }"
exit 1
;;
esac
exit 0
[orames@szcimesdb1 init.d]$