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:29Copyright (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 LISTENERVersion TNSLSNR for Linux: Version 11.2.0.3.0 - ProductionStart Date 04-AUG-2013 05:57:12Uptime 0 days 0 hr. 6 min. 17 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /dba/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File /dba/oracle/diag/tnslsnr/oraclelinux/listener/alert/log.xmlListening 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:<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.#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 pmonoracle 3491 1 0 06:10 ? 00:00:00 ora_pmon_litestroot 3528 3459 0 06:11 pts/1 00:00:00 grep pmon 從上面表格中的結果中可以看到,OS上運行著一個名叫“litest”的資料庫執行個體