Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)

Source: Internet
Author: User

For listeners that are not on the default port (1521), The pmon process does not register the service/instance to the listener, that is, dynamic registration is not implemented. Similar to a single instance, listeners with non-default RAC ports also set the local_listener parameter. In addition, you can remotely register an instance to achieve load balancing. This is achieved through the remote_listener parameter.

 

For more information about the basics and concepts of Oracle network configuration, see:
Configure the Oracle client to connect to the database
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)

Configure RAC load balancing and Failover

Oracle RAC Listener Configuration

 

1. create non-default listeners
Use netca to create a non-default listener. You can also directly modify listener. ora on each node.
Oracle @ bo2dbp: ~> Export display = 192.168.7.20.: 0.0
Oracle @ bo2dbp: ~> Netca
-- Select cluster configuration
-- Select all nodes
-- Select Listener Configuration
-- Select Add
-- Set the name of a new listener, which is assumed to be listener_new
-- Select TCP
-- Set the non-default port number, which is 1314
-- Select "no" and click "Next ".
-- If the default listener already exists, the system prompts you to start the listener and select the newly created listener_new listener.
-- Next. The prompt is complete. Finish.

 

Ii. Comparison between the default listener and non-default listener


oracle @ bo2dbp: ~> ps -ef | grep lsnr
oracle 21097 1 0 17:40? 00:00:00 / u01 / oracle / db / bin / tnslsnr LISTENER_BO2DBP -inherit
oracle 26228 1 0 17:58? 00:00:00 / u01 / oracle / db / bin / tnslsnr LISTENER_NEW_BO2DBP -inherit
oracle 28842 19468 0 17:58 pts / 1 00:00:00 grep lsnr
At this point, you can see that there are two listeners, one is the original default, one is newly added, pay attention to the name of the listener, in the RAC environment is the name of the listener plus the hostname
The content of listener.ora below already contains two listeners, one is default and one is non-default.

Correspondingly, the non-default listener just created is also added to listener.ora
oracle @ bo2dbp: ~> more $ ORACLE_HOME / network / admin / listener.ora
# listener.ora.bo2dbp Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbp
# Generated by Oracle configuration tools.

LISTENER_NEW_BO2DBP =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314) (IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.51) (PORT = 1314) (IP = FIRST))
    )
  )

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_NEW_BO2DBP =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = / u01 / oracle / db)
      (PROGRAM = extproc)
    )
  )

SID_LIST_LISTENER_BO2DBP =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = / u01 / oracle / db)
      (PROGRAM = extproc)
    )
  )

#View the status of the listener
oracle @ bo2dbp: ~> ./crs_stat.sh
 Resource name Target State
-------------- ------ -----
ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
ora.GOBO4.db ONLINE ONLINE on bo2dbp
ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_NEW_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_NEW_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
ora.ora10g.db ONLINE ONLINE on bo2dbp
ora.ora10g.ora10g1.inst ONLINE ONLINE on bo2dbp
ora.ora10g.ora10g2.inst ONLINE ONLINE on bo2dbs

#Compare the status of the default listener with the non-default listener
oracle @ bo2dbp: ~> lsnrctl
LSNRCTL> set current_listener LISTENER_NEW_BO2DBP
LSNRCTL> status #There is only Service "PLSExtProc" when the port number is non-default, which is because there is no dynamic registration
Services Summary ...
Service "PLSExtProc" has 1 instance (s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service ...
The command completed successfully

LSNRCTL> set current_listener LISTENER_BO2DBP
Current Listener is LISTENER_BO2DBP
LSNRCTL> status
.........
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 "ora10g" has 2 instance (s).
  Instance "ora10g1", status READY, has 2 handler (s) for this service ...
  Instance "ora10g2", status READY, has 1 handler (s) for this service ...
.........
The command completed successfully

oracle @ bo2dbp: ~> lsnrctl status #View the status of the default listener (that is, the fracture number is 1521)
.......
  (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 "ora10g" has 2 instance (s).
  Instance "ora10g1", status READY, has 2 handler (s) for this service ...
  Instance "ora10g2", status READY, has 1 handler (s) for this service ...
.......
The command completed successfully

#View the local_listener and remote_listener parameters at this time
#Author: Robinson Cheng

#Blog: http://blog.csdn.net/robinson_0612

SQL> show parameter instance_name

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
instance_name string ora10g1
SQL> show parameter listener

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string
remote_listener string LISTENERS_ORA10G

In conclusion, same as single instance, if non-default l is not setistener, use listener and LISTENER_BO2DBP to see the same results
In other words, the lsnrctl status [listener_nam] view itself is the information of the default port listener.
For non-default port listeners, no database instance will be registered when local_listener is not set

#Close the default listener
SQL> ho srvctl stop listener -n bo2dbp -l LISTENER_BO2DBP

SQL> ho srvctl stop listener -n bo2dbs -l LISTENER_BO2DBS

SQL> ho ./crs_stat.sh
 Resource name Target State
-------------- ------ -----
ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE
ora.GOBO4.GOBO4B.inst OFFLINE OFFLINE
ora.GOBO4.db OFFLINE OFFLINE
ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_BO2DBP.lsnr OFFLINE OFFLINE
ora.bo2dbp.LISTENER_NEW_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_BO2DBS.lsnr OFFLINE OFFLINE
ora.bo2dbs.LISTENER_NEW_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
ora.ora10g.db ONLINE ONLINE on bo2dbp
ora.ora10g.ora10g1.inst ONLINE ONLINE on bo2dbp
ora.ora10g.ora10g2.inst ONLINE ONLINE on bo2dbs

3. Configure dynamic registration of non-default listeners

oracle @ bo2dbp: / u01 / oracle / db / network / admin> echo "
> LISTENERS_ORA10G1 =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314))
>) ">> tnsnames.ora #Use echo to add a new connection identifier to tnsnames.ora

oracle @ bo2dbp: / u01 / oracle / db / network / admin> tail -5 tnsnames.ora

LISTENERS_ORA10G1 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314))
)

SQL> alter system set local_listener = LISTENERS_ORA10G1 scope = both sid = 'ora10g1';

System altered.

SQL> ho lsnrctl status LISTENER_NEW_BO2DBP

LSNRCTL for Linux: Version 10.2.0.3.0-Production on 09-OCT-2012 11:56:15

Copyright (c) 1991, 2006, Oracle. All rights reserved.
Listening Endpoints Summary ...
  (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.7.61) (PORT = 1314)))
  (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.7.51) (PORT = 1314)))
Services Summary ...
Service "ora10g" has 1 instance (s).
  Instance "ora10g1", status READY, has 1 handler (s) for this service ...
........

#At this time, you have seen that ora10g1 has been registered to the non-default 1314 listener LISTENER_NEW_BO2DBP

#Modify the port number in ora10g in tnsnames.ora to 1314
#Test the modified situation below, you can see that port 1314 has been used
oracle @ bo2dbp: ~> tnsping ora10g

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314))
(ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbs-vip.2gotrade.com) (PORT = 1314)) (LOAD_BALANCE = yes)
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora10g)))
OK (10 msec)

oracle @ bo2dbp: ~> sqlplus scott / tiger @ ora10g

SQL> show parameter instance_name

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
instance_name string ora10g1

Set the local_listener on the second node using the same method as above.
That is, modify tnsnames.ora first, and then set local_listener. Pay attention to make the connector names as different as possible for distinguishing, such as setting LISTENERS_ORA10G2, pay attention to the host name and port number
SQL> show parameter instance_name

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
instance_name string ora10g2
SQL> alter system set local_listener = LISTENERS_ORA10G2 scope = both sid = 'ora10g2';

System altered.

SQL> alter system register;

System altered.

SQL> ho lsnrctl status LISTENER_NEW_BO2DBS

Listening Endpoints Summary ...
  (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.7.62) (PORT = 1314))) #You can see that the port number is 1314 at this time
  (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 192.168.7.52) (PORT = 1314)))
Service "ora10g" has 1 instance (s).
  Instance "ora10g2", status READY, has 1 handler (s) for this service ... #instance ora10g2 is registered
..............

4. Set remote registration for non-default listeners
Listener Remote Registration is mainly used to achieve load balancing. Generally, the connection request sent by the client is first accepted by local_listener, and then the master Instance determines which target instance of the current connection request should issue the server process to respond to the connection request. When Server Load balancer is enabled, the master instance forwards requests to instances with less load. If the instance specified in remote_listener has less load, the current request is redirected to an instance with a small load to establish a connection, and the derived server process performs the corresponding connection.

SQL> show parameter listener

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string LISTENERS_ORA10G1
remote_listener string LISTENERS_ORA10G

The value of remote_listener above, LISTENERS_ORA10G, was created when the database was created, and at this time we used a listener with a non-default port, so there are two ways to deal with it
The first is to change the port number in the corresponding LISTENERS_ORA10G connection character in tnsnamas.ora to 1314, followed by adding a new connection string. The second method is used below.

-> First clear the original remote_listener
SQL> alter system reset remote_listener scope = both sid = '*';

System altered.

SQL> show parameter listener

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string LISTENERS_ORA10G1
remote_listener string

-> Add string to tnsnames.ora
oracle @ bo2dbp: ~> echo "
remote_lsnr_ora10g =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314))
> (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbs-vip.2gotrade.com) (PORT = 1314))
>) ">> $ ORACLE_HOME / network / admin / tnsnames.ora

oracle @ bo2dbp: ~> tail -6 $ ORACLE_HOME / network / admin / tnsnames.ora

remote_lsnr_ora10g =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1314))
    (ADDRESS = (PROTOCOL = TCP) (HOST = bo2dbs-vip.2gotrade.com) (PORT = 1314))
  )

Use a similar method to add the above to tnsnames.ora on node 2

SQL> alter system set remote_listener = 'remote_lsnr_ora10g' scope = both sid = '*';

System altered.

SQL> show parameter listener

NAME TYPE VALUE
------------------------------------ ----------- --- ---------------------------
local_listener string LISTENERS_ORA10G1
remote_listener string remote_lsnr_ora10g
SQL> alter system register;

System altered.

SQL> ho lsnrctl status LISTENER_NEW_BO2DBP

Service "ora10g" has 2 instance (s). # 服务 ora10g has 2 instances to provide services
  Instance "ora10g1", status READY, has 2 handler (s) for this service ...
  Instance "ora10g2", status READY, has 1 handler (s) for this service ...
....... 

Vi. Summary of steps for configuring listeners on RAC
1. generate corresponding entries for each listener in listener. ora, and use the VIP address as much as possible for the host content (it is recommended to directly specify the IP address to avoid DNS resolution errors)
2. Configure the corresponding TNS entries for each node and use the VIP
Listeners_clustername = # global configuration, corresponding to remote_listener. That is, if two nodes list two VIPs, three nodes should list three VIPs.
(Address_list =
(Address = (Protocol = TCP) (host = node1-vip) (Port = 1521 ))
(Address = (Protocol = TCP) (host = node2-vip) (Port = 1521 ))
)

Listeners_cluster_1 = # local configuration, which only lists the node IP addresses of the current instance
(Address_list = # You can set it to listeners_cluster_1 on node 2, and the corresponding VIP is the VIP of Node 2.
(Address = (Protocol = TCP) (host = node1-vip) (Port = 1521 ))
) # You can also configure all local_listener connection identifiers on a node, and then copy tnsnames. ora to all nodes.

3. Set the global remote_listener parameter.
Alter system set remote_listener = 'listeners _ tertername' scope = both SID = '*';

4. Set the local local_listener parameter (set separately for each node)
Alter system set remote_listener = 'listeners _ terter_1 'scope = both SID = 'node1 ';
You can also directly set the IP address and port value to local_listener. In this case, you do not need to configure listeners_cluster_1 in step 1, as shown below:
Alter system set local_listener = '(address = (Protocol = TCP) (host = node1-vip) (Port = 1521)' SID = 'node1 ';

5. Use alter system register on each node to register immediately. This step can be omitted. Because we have set local_listener and remote_listener, and then wait for a moment to implement dynamic registration. Alter system register is only used to accelerate registration.

6. Use LSNRCTL stauts listener _

 

VII. More references

 

For more information about user-managed backup and recovery, see

Oracle cold backup

Oracle Hot Backup

Concept of Oracle backup recovery

Oracle instance recovery

Oracle recovery based on user management (describes media recovery and processing in detail)

System tablespace management and Backup Recovery

Sysaux tablespace management and recovery

Oracle backup control file recovery (unsing backup controlfile)

 

For information on RMAN backup recovery and management, see

RMAN overview and architecture

RMAN configuration, Monitoring and Management

Detailed description of RMAN backup

RMAN restoration and recovery

Create and use RMAN catalog

Create RMAN storage script based on catalog

Catalog-based RMAN backup and recovery

RMAN backup path confusion

 

For the Oracle architecture, see

Oracle tablespace and data files

Oracle Password File

Oracle parameter file

Oracle online redo log file)

Oracle Control File)

Oracle archiving logs

Oracle rollback and undo)

Oracle database instance startup and Shutdown Process

Automated Management of Oracle 10g SGA

Oracle instances and Oracle databases (Oracle Architecture)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.