ITPub博客

首页 > 数据库 > Oracle > Linux平台如何查看OS上存在有哪些数据库或实例

Linux平台如何查看OS上存在有哪些数据库或实例

原创 Oracle 作者:Tattao 时间:2016-08-02 14:25:25 0 删除 编辑

linux平台如何查看OS上存在多少个数据库,查询方法主要有三种,下面分别进行介绍 

1、 通过lsnrctl status命令查看

通过该方法,可以查看已经注册到listener中的数据库实例,在一定程度可以说明OS上存在有命令结果中所列出来的数据库实例,当然未启动的和未注册进来的除外

命令:#su – Oracle

$lsnrctl status

[oracle@rac1 ~]$ lsnrctl status  

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 23-JUL-2016 09:14:36

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                23-JUL-2016 08:47:22
Uptime                    0 days 0 hr. 27 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.11.101)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.11.103)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl1", status READY, has 1 handler(s) for this service...
The command completed successfully


从上面表格结果集中,可以看到有一个 “orcl1”的数据库实例注册到了listener中来了,说明该OS上最少有一个名叫orcl1的数据库实例存在 

2、通过cat /etc/oratab方式查看

创建数据库或实例时,会在/etc/oratab文件中增加一行记录,哪怕是数据库实例没有启动,用此方法也可以查看得到。如下所示:

命令:#cat /etc/oratab

[oracle@rac1 ~]$ cat /etc/oratab
#Backup file is  /u01/app/oracle/product/11.2.0/db_1/srvm/admin/oratab.bak.rac1 line added by Agent
#






# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.


# 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.
#
#
+ASM1:/u01/app/11.2.0/grid:N            # line added by Agent
orcl:/u01/app/oracle/product/11.2.0/db_1:N              # line added by Agent

从上面表格中最后一行结果中,可以看出该OS上存在有一个叫orcl的数据库(包括实例) 

3、通过ps –ef |grep ora_pmon方式查看

如果数据库或实例已经启动至nomount模式,就会产生pmon进程,所以我们可以通过查看OS是否存在pmon进程的方式来查看有几个数据库实例存在,每一个实例都会有一个pmon进程,如果查到存在有多个pmon进程,就意味着OS上存在着多个数据库实例

命令:# ps -ef |grep pmon

[oracle@rac1 ~]$ ps -ef|grep pmon
grid       5807      1  0 Jul21 ?        00:00:47 asm_pmon_+ASM1
oracle    14027   9142  0 09:18 pts/0    00:00:00 grep pmon
oracle    39213      1  0 06:22 ?        00:00:03 ora_pmon_orcl1


从上面表格中的结果中可以看到,OS上运行着一个名叫“orcl1”的数据库实例


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30258496/viewspace-2122853/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-05-24

  • 博文量
    20
  • 访问量
    50423