您好,欢迎访问一九零五行业门户网

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

linux/unix平台如何查看os上存在有哪些数据库或实例
其实这是一个不难的问题,由于有同事问到这个问题,我就把这个问题的方法写下来好了,必竟有一个人来问,说不定还有第二个人不会,希望对还不会的或是刚入行的朋友有所帮助吧。
linux/unix平台如何查看os上存在多少个数据库,查询方法主要有三种,下面分别进行介绍 
1、 通过lsnrctl status命令查看
通过该方法,,可以查看已经注册到listener中的数据库实例,在一定程度可以说明os上存在有命令结果中所列出来的数据库实例,当然未启动的和未注册进来的除外
命令:#su – oracle
$lsnrctl status
[oracle@oraclelinux ~]$ lsnrctl status
lsnrctl for linux: version 11.2.0.3.0 - production on 04-aug-2013 06:03:29
copyright (c) 1991, 2011, oracle. all rights reserved.
connecting to (description=(address=(protocol=tcp)(host=192.168.171.100)(port=1521)))
status of the listener
------------------------
alias listener
version tnslsnr for linux: version 11.2.0.3.0 - production
start date 04-aug-2013 05:57:12
uptime 0 days 0 hr. 6 min. 17 sec
trace level off
security on: local os authentication
snmp off
listener parameter file /dba/oracle/product/11.2.0/db_1/network/admin/listener.ora
listener log file /dba/oracle/diag/tnslsnr/oraclelinux/listener/alert/log.xml
listening endpoints summary...
(description=(address=(protocol=tcp)(host=192.168.171.100)(port=1521)))
(description=(address=(protocol=ipc)(key=extproc1521)))
services summary...
service litest has 1 instance(s).
instance litest, status ready, has 1 handler(s) for this service...
service litestxdb has 1 instance(s).
instance litest, status ready, has 1 handler(s) for this service...
the command completed successfully
从上面表格结果集中,可以看到有一个 “litest”的数据库实例注册到了listener中来了,说明该os上最少有一个名叫litest的数据库实例存在 
2、通过cat /etc/oratab方式查看
创建数据库或实例时,会在/etc/oratab文件中增加一行记录,哪怕是数据库实例没有启动,用此方法也可以查看得到。如下所示:
命令:#cat /etc/oratab
[root@oraclelinux ~]# cat /etc/oratab
# 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::
#
# 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.
#
litest:/dba/oracle/product/11.2.0/db_1:n
从上面表格中最后一行结果中,可以看出该os上存在有一个叫litest的数据库(包括实例) 
3、通过ps –ef |grep ora_pmon方式查看
如果数据库或实例已经启动至nomount模式,就会产生pmon进程,所以我们可以通过查看os是否存在pmon进程的方式来查看有几个数据库实例存在,每一个实例都会有一个pmon进程,如果查到存在有多个pmon进程,就意味着os上存在着多个数据库实例
命令:# ps -ef |grep pmon
[root@oraclelinux ~]# ps -ef |grep pmon
oracle 3491 1 0 06:10 ? 00:00:00 ora_pmon_litest
root 3528 3459 0 06:11 pts/1 00:00:00 grep pmon
从上面表格中的结果中可以看到,os上运行着一个名叫“litest”的数据库实例
其它类似信息

推荐信息