How-to set dispatchers and local_listener

The format of service_name, dispatchers and local_listener are kind of strange. I’d like to blog them for reference.

Set them online:

alter system set service_names = 'SALES,MARKET';
alter system set dispatchers = '(address=(protocol=tcp)(host=db1.oracle.com))(dispatchers=40)(service=SALES)(listener=SALES)',
'(address=(protocol=tcp)(host=db1.oracle.com))(dispatchers=40)(service=MARKET)(listener=MARKET)'
;
alter system set local_listener='(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1600))
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1601))
)';

--if it's too long, you may get ORA-32021: parameter value longer than 255 characters
--You can set it like this:
alter system set local_listener=
'(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1600))',
'(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1601))',
'(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1602))',
'(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1603))'
;
OR still use ADDRESS_LIST
alter system set local_listener=
'(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1600)))',
'(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1601)))',
'(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1602)))',
'(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1603)))'
;

Set them in initial file:

#To set multiple dispatchers, just add them in continuous lines.
dispatchers ='(address=(protocol=tcp)(host=db1.oracle.com))(dispatchers=40)(service=SALES)(listener=SALES)'
dispatchers ='(address=(protocol=tcp)(host=db1.oracle.com))(dispatchers=40)(service=MARKET)(listener=MARKET)'
service_names = 'SALES,MARKET'
local_listener="(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.oracle.com)(PORT=1523)))"

#Another way to set local_listener is to use names in TNSNAMES.ora
local_listener=listener_SALES,listener_MARKET

#In tnsnames.ora,
listener_SALES=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1521)))
listener_MARKET=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1523)))

Note: To let dispatchers works for every service names and register to all listeners, just set it like : dispatchers ='(address=(protocol=tcp)(host=db1.oracle.com))(dispatchers=40)’. Adding listener and service in dispatchers values will override the local_listener/remote_listener and service_names setting. Reference: DISPATCHERS

Advertisements

About Alex Zeng
I would be very happy if this blog can help you. I appreciate every honest comments. Please forgive me if I'm too busy to reply your comments in time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: