如何查看Oracle的启动状态
2017-09-22
展开全部
要检查 Oracle DB 是否启动与运作,可以照下列程序检查,若能够通过检查,就表示Oracle正常运作。
这个程序在HP-UX 11.11 & Oracle 9.2 上测试过
1. Check Oracle process
检查作业系统是否有Oracle的process,而且对应的DB SID出现于结果中,表示该Oracle instance应该是执行中。例如主机内现有两个Oracle instance执行中,其中一个SID一个是ADEV,另一个DB的SID为ATEST,检查结果就会看到两个对应的process存在。
Example:
# ps -ef | grep dbw
oracle 2401 1 0 Oct 19 ? 2:31 ora_dbw0_ADEV
oracle 2464 1 0 Oct 19 ? 2:38 ora_dbw0_ATEST
2. Check OPEN_MODE of Oracle instance
切换使用者帐号为oracle,指定instance并使用sqlplus登入Oracle,查询该instance的OPEN_MODE,应出现READ WRITE的字眼(除非有特殊需求,通常Oracle是起在READ WRITE模式的,这样才能正常读写啰~ )。
Example:
# su - oracle
# export ORACLE_SID=ADEV
# sqlplus "/as sysdba"
SQL> desc v$database
SQL> select name from v$database;
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
3. Check STATUS of Oracle instance
切换使用者帐号为 oracle,指定instance并使用sqlplus登入Oracle,查询该instance的STATUS,应出现OPEN的字眼,若出现其他字眼,则Oracle可能没有正常启动。
Example:
# su - oracle
# export ORACLE_SID=ADEV
# sqlplus "/as sysdba"
SQL> desc v$instance;
SQL> select status from v$instance;
STATUS
------------
OPEN
4. Check LISTENER
4.1 检查作业系统中 LISTENER 的process是否已经启动。
Oracle instance共用LISTENER的状况,通常会将LISTENER直接取名为LISTNER,可以看到如下的process。
Example:
# ps -ef | grep lsnr
oracle 21327 1 3 00:42:33 ? 4:34 /oracle/product/9.2/bin/tnslsnr LISTENER -inherit
OR
Oracle instance各自独立使用LISTENER的状况,通常LISTENER名称会跟SID相关连,以方便辨识。
Example:
# ps -ef | grep lsnr
oracle 1609 1 0 Sep 12 ? 15:54 /oracle/product/9.2/bin/tnslsnr LISTENER_ADEV -inherit
oracle 27399 1 0 Oct 12 ? 8:45 /oracle/product/9.2/bin/tnslsnr LISTENER_ATEST -inherit
4.2 检查LISTENER的设定值
Oracle instance共用LISTENER的状况,通常会将LISTENER直接取名为LISTNER,在设定档中会把两个instance的设定包在一起。
Example:
# cat /oracle/product/9.2/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = ADEV))
(ADDRESS = (PROTOCOL = IPC)(KEY = ATEST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ADEV)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ADEV)
)
(SID_DESC =
(GLOBAL_DBNAME = ATEST)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ATLTEST)
)
)
OR
Oracle instance各自独立使用LISTENER的状况,LISTENER设定档中就会将两个LISTENER分开,以方便辨识。
Example:
# cat /oracle/product/9.2/network/admin/listener.ora
LISTENER_ADEV =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1521))
)
)
)
SID_LIST_LISTENER_ADEV =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ADEV)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ADEV)
)
)
LISTENER_ATEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1522))
)
)
)
SID_LIST_LISTENER_ATEST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ATEST)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ATEST)
)
)
5. Use tnsping
使用Oracle提供的tnsping工具,可以检查DB的连线状况,如果最后显示OK,并显示极短的时间,如OK( 0 msec ),表示应该没问题可以连接~
Example:
# su - oracle
# tnsping ADEV
TNS Ping Utility for HPUX: Version 9.2.0.0.0 - Production on 02-NOV-2010 09:54:11
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
/oracle/product/9.2/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
(PROTOCOL = IPC)(KEY = ADEV))) (CONNECT_DATA = (SID = ADEV)
(PRESENTATION = RO)))
OK (0 msec)
6. 检查log
这个程序在HP-UX 11.11 & Oracle 9.2 上测试过
1. Check Oracle process
检查作业系统是否有Oracle的process,而且对应的DB SID出现于结果中,表示该Oracle instance应该是执行中。例如主机内现有两个Oracle instance执行中,其中一个SID一个是ADEV,另一个DB的SID为ATEST,检查结果就会看到两个对应的process存在。
Example:
# ps -ef | grep dbw
oracle 2401 1 0 Oct 19 ? 2:31 ora_dbw0_ADEV
oracle 2464 1 0 Oct 19 ? 2:38 ora_dbw0_ATEST
2. Check OPEN_MODE of Oracle instance
切换使用者帐号为oracle,指定instance并使用sqlplus登入Oracle,查询该instance的OPEN_MODE,应出现READ WRITE的字眼(除非有特殊需求,通常Oracle是起在READ WRITE模式的,这样才能正常读写啰~ )。
Example:
# su - oracle
# export ORACLE_SID=ADEV
# sqlplus "/as sysdba"
SQL> desc v$database
SQL> select name from v$database;
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
3. Check STATUS of Oracle instance
切换使用者帐号为 oracle,指定instance并使用sqlplus登入Oracle,查询该instance的STATUS,应出现OPEN的字眼,若出现其他字眼,则Oracle可能没有正常启动。
Example:
# su - oracle
# export ORACLE_SID=ADEV
# sqlplus "/as sysdba"
SQL> desc v$instance;
SQL> select status from v$instance;
STATUS
------------
OPEN
4. Check LISTENER
4.1 检查作业系统中 LISTENER 的process是否已经启动。
Oracle instance共用LISTENER的状况,通常会将LISTENER直接取名为LISTNER,可以看到如下的process。
Example:
# ps -ef | grep lsnr
oracle 21327 1 3 00:42:33 ? 4:34 /oracle/product/9.2/bin/tnslsnr LISTENER -inherit
OR
Oracle instance各自独立使用LISTENER的状况,通常LISTENER名称会跟SID相关连,以方便辨识。
Example:
# ps -ef | grep lsnr
oracle 1609 1 0 Sep 12 ? 15:54 /oracle/product/9.2/bin/tnslsnr LISTENER_ADEV -inherit
oracle 27399 1 0 Oct 12 ? 8:45 /oracle/product/9.2/bin/tnslsnr LISTENER_ATEST -inherit
4.2 检查LISTENER的设定值
Oracle instance共用LISTENER的状况,通常会将LISTENER直接取名为LISTNER,在设定档中会把两个instance的设定包在一起。
Example:
# cat /oracle/product/9.2/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = ADEV))
(ADDRESS = (PROTOCOL = IPC)(KEY = ATEST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ADEV)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ADEV)
)
(SID_DESC =
(GLOBAL_DBNAME = ATEST)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ATLTEST)
)
)
OR
Oracle instance各自独立使用LISTENER的状况,LISTENER设定档中就会将两个LISTENER分开,以方便辨识。
Example:
# cat /oracle/product/9.2/network/admin/listener.ora
LISTENER_ADEV =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1521))
)
)
)
SID_LIST_LISTENER_ADEV =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ADEV)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ADEV)
)
)
LISTENER_ATEST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01)(PORT = 1522))
)
)
)
SID_LIST_LISTENER_ATEST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ATEST)
(ORACLE_HOME = /oracle/product/9.2)
(SID_NAME = ATEST)
)
)
5. Use tnsping
使用Oracle提供的tnsping工具,可以检查DB的连线状况,如果最后显示OK,并显示极短的时间,如OK( 0 msec ),表示应该没问题可以连接~
Example:
# su - oracle
# tnsping ADEV
TNS Ping Utility for HPUX: Version 9.2.0.0.0 - Production on 02-NOV-2010 09:54:11
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
/oracle/product/9.2/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
(PROTOCOL = IPC)(KEY = ADEV))) (CONNECT_DATA = (SID = ADEV)
(PRESENTATION = RO)))
OK (0 msec)
6. 检查log
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询