Home Database Mysql Tutorial Oracle RAC 监听配置 (listener.ora tnsnames.ora)

Oracle RAC 监听配置 (listener.ora tnsnames.ora)

Jun 07, 2016 pm 05:20 PM
oracle rac

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   
     
    #通过上面的观察可知,当前的两个实例都是在各自所在主机上的监听器进行了注册。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

How does MySQL index cardinality affect query performance? How does MySQL index cardinality affect query performance? Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

Explain the InnoDB Buffer Pool and its importance for performance. Explain the InnoDB Buffer Pool and its importance for performance. Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

See all articles