Oracle RAC 监听器的配置与单实例稍有不同,但原理和实现方法基本上是相同的。在Oracle中 tns进程用于为指定网络地址上的一个或多
Oracle RAC 监听器的配置与单实例稍有不同,但原理和实现方法基本上是相同的。在Oracle中 tns进程用于为指定网络地址上的一个或多个Oracle 实例提供服务注册,并响应来自客户端对该服务提出的连接请求。一旦连接请求到达,并派生出一个服务器进程建立服务器与用户端之间的连接(专有服务器dedicated server)或转发服务请求(共享服务器模式shared server)。如果监听器知道多于一个实例提供所请求的服务,则可能会根据客户端与服务器端相关配置将请求定位到较低负载的实例为其提供服务。因此合理正确配置监听器以及tnsnames是Oracle RAC实现负载均衡以及failover的前提,本文将描述基于 SUSE linux 10 + Oracle 10g RAC 下监听器的配置。
一、节点上监听信息
1、两个节点及主机配置信息(bo2dbp,,bo2dbs)
oracle@bo2dbp:/u01/oracle/db/network/admin> cat /etc/hosts
127.0.0.1 localhost.2gotrade.com localhost
# Public
192.168.7.51 bo2dbp.2gotrade.com bo2dbp
192.168.7.52 bo2dbs.2gotrade.com bo2dbs
#Private
10.10.7.51 bo2dbp-priv.2gotrade.com bo2dbp-priv
10.10.7.52 bo2dbs-priv.2gotrade.com bo2dbs-priv
#Virtual
192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip
2、节点bo2dbp上的listener.ora
oracle@bo2dbp:/u01/oracle/db/network/admin> more listener.ora
# listener.ora.bo2dbp Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbp
# Generated by Oracle configuration tools.
LISTENER_BO2DBP =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.51)(PORT = 1521)(IP = FIRST))
)
)
SID_LIST_LISTENER_BO2DBP =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/db)
(PROGRAM = extproc)
)
)
3、节点bo2dbp上的tnsnames.ora
oracle@bo2dbp:/u01/oracle/db/network/admin> more tnsnames.ora
#对于连接字符串GOBO1A,GOBO1B,GOBO1在此处可以省略
#这些字符串通常用于客户端连接到数据库
GOBO1B =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = GOBO1)
(INSTANCE_NAME = GOBO1B)
)
)
GOBO1A =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = GOBO1)
(INSTANCE_NAME = GOBO1A)
)
)
GOBO1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = GOBO1)
)
)
#下面是几个重要的用于设置local_listener 以及remote_listener参数的定义信息
LISTENER_BO2DB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
)
LISTENER_BO2DBP =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.61)(PORT = 1521))
)
LISTENER_BO2DBS =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.62)(PORT = 1521))
)
#Author: Robinson cheng
#Blog :
4、节点bo2dbp上监听器的信息
#可以看出只有实例 GOBO1A 注册到监听器 LISTENER_BO2DBP
oracle@bo2dbp:/u01/oracle/db/network/admin> lsnrctl status LISTENER_BO2DBP
LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 25-SEP-2012 17:12:04
Copyright (c) 1991, 2006, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bo2dbp-vip.2gotrade.com)(PORT=1521)(IP=FIRST)))
STATUS of the LISTENER
------------------------
..............
Listener Parameter File /u01/oracle/db/network/admin/listener.ora
Listener Log File /u01/oracle/db/network/log/listener_bo2dbp.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.61)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.51)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...
Service "GOBO1" has 1 instance(s).
Instance "GOBO1A", status READY, has 1 handler(s) for this service...
Service "GOBO1XDB" has 1 instance(s).
Instance "GOBO1A", status READY, has 1 handler(s) for this service...
Service "GOBO1_XPT" has 1 instance(s).
Instance "GOBO1A", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
5、节点bo2dbs上的listener.ora
oracle@bo2dbs:/u01/oracle/db/network/admin> more listener.ora
# listener.ora.bo2dbs Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbs
# Generated by Oracle configuration tools.
LISTENER_BO2DBS =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbs-vip.2gotrade.com)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.52)(PORT = 1521)(IP = FIRST))
)
)
SID_LIST_LISTENER_BO2DBS =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/db)
(PROGRAM = extproc)
)
)
#由于节点bo2dbs上的tnsnames.ora与节点bo2dbp内容相同,不再列出
6、节点bo2dbs上的监听器状态
#同样可以看到只有一个 instance,即GOBO1B注册到了监听器 LISTENER_BO2DBS
oracle@bo2dbs:/u01/oracle/db/network/admin> lsnrctl status LISTENER_BO2DBS
LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 25-SEP-2012 17:12:31
Copyright (c) 1991, 2006, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bo2dbs-vip.2gotrade.com)(PORT=1521)(IP=FIRST)))
STATUS of the LISTENER
------------------------
.......................
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.62)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.52)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "GOBO1" has 1 instance(s).
Instance "GOBO1B", status READY, has 1 handler(s) for this service...
Service "GOBO1XDB" has 1 instance(s).
Instance "GOBO1B", status READY, has 1 handler(s) for this service...
Service "GOBO1_XPT" has 1 instance(s).
Instance "GOBO1B", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
#通过上面的观察可知,当前的两个实例都是在各自所在主机上的监听器进行了注册。

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
