srvctl add listener

Adds a listener to every node in a cluster.

Syntax and Parameters

Use the srvctl add listener command with one of the following syntax models:

To create an Oracle Database listener:

srvctl add listener [-listener listener_name] [-netnum network_number]
  [-oraclehome Oracle_home] -user user_name [-endpoints "[TCP:]port_list[/IPC:key]
  [/NMP:pipe_name][/TCPS:s_port][/SDP:port]"] [-skip]

To create an Oracle ASM listener:

srvctl add listener [-listener listener_name] -asmlistener [-subnet subnet]
 [-endpoints "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port][/SDP:port]"]
 [-skip]

To create a Leaf listener:

srvctl add listener [-listener listener_name] -leaflistener [-subnet subnet]
 [-endpoints "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port][/SDP:port]"]
 [-skip]

To create a SCAN listener, use the srvctl add scan_listener command. To create a management listener (for the CHM repository), use the srvctl add mgmtlsnr command.

Table A-11 srvctl add listener Parameters

Parameter Description
-listener listener_name

Specify a listener name. This parameter is optional.

If you do not specify this parameter, then the name of the listener defaults to LISTENER for a database listener, LISTENER_ASM for an Oracle ASM listener, and LISTENER_LEAF for a Leaf Node listener.

-netnum network_number

The optional network number from which VIPs are obtained. If not specified, the VIPs are obtained from the same default network from which the nodeapps VIP is obtained.

Note: Use this parameter when you add an Oracle Database listener.

-oraclehome oracle_home

Specify an Oracle home for the cluster database. If you do not include this parameter, then SRVCTL uses the Grid home by default.

Note: Use this parameter when you add an Oracle Database listener.

-user user_name

Use this parameter to set the user that will run the listener to a less privileged user. Oracle recommends using this parameter to increase security.

Notes:

  • You must be logged in as root to run this command and specify the -user parameter.

  • Use this parameter when you add an Oracle Database listener.

  • When you use the -user parameter, ensure the following:

    The listener log directory in ORACLE_BASE and the Grid_home/network/admin/user_name directory must both exist on each node before you can use this parameter. Additionally, user_name must have read, write, and execute permission in the directory.

    The ORACLE_HOME/network/admin/endpoints_listener.ora file exists and user_name has read and write permission on it.

    The $ORACLE_BASE/diag/tnslsnr/host_name/lower_case_listener_name directory exists and user_name has read, write, and execute permission on it.

-endpoints "[TCP:]port_list[/IPC:key]
[/NMP:pipe_name][/TCPS:s_port]
[/SDP:port]

Protocol specifications for the listener. port_list is a comma-delimited list of TCP ports or listener endpoints.

If you do not specify the -endpoints parameter for an Oracle Database listener, then SRVCTL searches for a free port between 1521 and 1540.

Note: You can modify this attribute using Online Resource Attribute Modification.

-skip

Indicates you want to skip the checking of ports.

-asmlistener

Specifies the listener type as an Oracle ASM listener. If you do not specify the -listener parameter, then the name of the Oracle ASM listener defaults to LISTENER_ASM.

Note: You can only use this parameter with Oracle Clusterware.

-leaflistener

Specifies the listener type is a Leaf Node listener. If you do not specify the -listener parameter, then the name of the Leaf Node listener defaults to LISTENER_LEAF.

Note: You can only use this parameter with Oracle Clusterware.

-subnet subnet

Specifies the subnet to use for an Oracle ASM or Leaf Node listener.

Note: You can only use this parameter with Oracle Clusterware.

Usage Notes

  • You must run this command as root user on Linux and UNIX platforms when you specify the -user parameter.

Example

The following command adds a listener named listener112 that is listening on ports 1341, 1342, and 1345 and runs from the Oracle home directory on every node in the cluster:

$ srvctl add listener -listener listener112 -endpoints "1341,1342,1345" 
-oraclehome /u01/app/oracle/product/12.1.0/db1