同一台服务器,相同实例名,不同端口的情况怎么管理
本帖最后由 wxueyu 于 2015-1-26 14:33 编辑各位好!
刚跳到新公司,没有DBA交接,衰!
在熟悉数据库的过程中,遇到同一台小机,不同监听端口,相同实例名字,数据库用户分别不同的问题,请大家帮忙分析分析,这个库要怎么连接。
# cat /etc/redhat-release
CentOS release 6.4 (Final)
# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
监听端口:1521,9521(开发提供的,测试两个端口都可以登录,实例配置均为 orcl ,但是数据库用户等信息不同)
ORCL_139=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=192.168.56.139)
(PORT=1521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=orcl)
)
)
ORCL_952=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=192.168.56.139)
(PORT=9521)
)
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=orcl)
)
)
在服务器端,只有一个监听listener.ora文件
# find / -name listener.ora
/opt/oracle/product/11.2.0/db_1/network/admin/samples/listener.ora
/opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
监听文件:
cat /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
监听状态:
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-JAN-2015 09:56:42
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 10-JAN-2014 13:53:47
Uptime 377 days 20 hr. 2 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
端口 1521,9521 均有占用信息:
netstat -anp |grep 1521 |more
tcp 0 0 ::ffff:192.168.56.139:1521 ::ffff:11.26.1.16:51648 ESTABLISHED 23352/oracleorcl
.............................
netstat -anp |grep 9521 |more
tcp 0 0 ::ffff:192.168.56.139:9521 ::ffff:192.168.56.141:39521 ESTABLISHED 21731/oracleorcl
...............................
现在,我在服务器端,默认监听是 1521。
1:是通过怎么样的设置,才能达到这种效果?
2:要怎么操作,才能连接到 9521的端口? 增加监听,监听端口为9521 本帖最后由 wxueyu 于 2015-1-23 17:41 编辑
wutao0914 发表于 2015-1-23 15:56 static/image/common/back.gif
增加监听,监听端口为9521
TKS。
下面的是我在测试机上做的,是 一个实例,两个监听端口。
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = CTCDB)
(ORACLE_HOME = /u01/app/product/11.2.0/db_1)
(SID_NAME = CTCDB)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.18.101)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app
SID_LIST_LISTENER_NEW =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = CTCDB)
(ORACLE_HOME = /u01/app/product/11.2.0/db_1)
(SID_NAME = CTCDB)
)
)
LISTENER_NEW =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.18.101)(PORT = 1523))
)
但是,现在的问题是:生产环境,两个监听端口,虽然实例名相同,但是连接之后数据库用户信息不同,比如 A(1521) 中有 AA,BB,CC 用户,B(9521)中有 DD,EE,FF 用户。
这种情况是怎么产生的? 在该生产环境下,只有单个后台进程:
$ ps -ef|grep smon
oracle 13096 13006 0 17:42 pts/0 00:00:00 grep smon
oracle 27525 1 0 2014 ? 00:34:11 ora_smon_orcl
$ ps -ef|grep pmon
oracle 13104 13006 0 17:42 pts/0 00:00:00 grep pmon
oracle 27499 1 0 2014 ? 01:47:40 ora_pmon_orcl
从这点看应该可以排除2个实例的情况。
但是,两个端口下的数据库用户等信息不同,又有2个实例的可能啊。 为什么要实例名字SID一样? 你完全可以 DB_NAME 一样,但是SID 不一样 刘大,你的意思是 同一个库,两个实例?
单机情况下可以同时运行吗?
而且服务器上 smon pmon等后台进程只有一个,客户端却可以通过1521,9521 两个端口分别连接到不同的数据库实例。 wxueyu 发表于 2015-1-25 18:58 static/image/common/back.gif
刘大,你的意思是 同一个库,两个实例?
单机情况下可以同时运行吗?
而且服务器上 smon pmon等后台进程只 ...
不是的
是指 2个物理数据库, 但可以用 同样的DB_NAME , 不同的 SID , 使用不同的service_name。 Maclean Liu(刘相兵 发表于 2015-1-25 22:46 static/image/common/back.gif
不是的
是指 2个物理数据库, 但可以用 同样的DB_NAME , 不同的 SID , 使用不同的service_name。 ...
刘大,你说的这种情况下测试,安装目录、参数文件、控制文件等都分别有2份:spfileA.ora spfileB.ora。包括后台 PMON SMON 也都会有两个。
困惑的是在生产环境下 参数文件、控制文件、POMN\SMON 等只有一条信息,却同时跑了两个实例。
默认情况下 1521端口,监听状态为:
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JAN-2015 13:38:00
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 10-JAN-2014 13:53:47
Uptime 380 days 23 hr. 44 min. 13 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
$ cat /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string orcl
SQL> show parameter domian
SQL> show parameter domain
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_domain string
不知道这种情况,刘大遇到过没。 困惑的是在生产环境下 参数文件、控制文件、POMN\SMON 等只有一条信息,却同时跑了两个实例。
==> 哪里看出来的? Liu Maclean(刘相兵 发表于 2015-1-26 15:10 static/image/common/back.gif
困惑的是在生产环境下 参数文件、控制文件、POMN\SMON 等只有一条信息,却同时跑了两个实例。
==> 哪里看 ...
# find / -name control*.ctl
/opt/oracle/oradata/orcl/control01.ctl
/opt/oracle/flash_recovery_area/orcl/control02.ctl
# find / -name spfile*
/opt/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora
/opt/oracle/product/11.2.0/db_1/dbs/spfileorcl.ora.bak
# ps -ef|grep smon
oracle 27525 1 0 2014 ? 00:34:40 ora_smon_orcl
root 31601 26406 0 16:12 pts/0 00:00:00 grep smon
# ps -ef|grep pmon
oracle 27499 1 0 2014 ? 01:49:10 ora_pmon_orcl
root 31607 26406 0 16:12 pts/0 00:00:00 grep pmon
开始怀疑是不是从其它机器做了代理,映射到本机9521端口? 结贴!
是代理问题。
添麻烦了!
页:
[1]