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

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博客 ” ,链接:http://blog.itpub.net/30258496/viewspace-2122853/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30258496/viewspace-2122853/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值