Skip to Main Content
  • Questions
  • Conntinuing question "Remote Listener Registration"

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Andre.

Asked: December 19, 2000 - 7:26 am UTC

Last updated: March 24, 2011 - 3:18 pm UTC

Version: 8.1.6

Viewed 1000+ times

You Asked

Continuing this question from yesterday:

------------------------------------------------------------

You Asked

In order to achieve connection load balancing, how does remote
connection registration take place ? Could you describe the
steps in the process in which PMON and a local listener become
aware of the remote nodes and intances ?

------------------------------------------------------------
and I said...

PMON is associated with an instance. PMON contacts a listener
and registers itself with that listener, making the listener
aware of the existence and status of that instance.

You configure this by setting up the mts_dispatchers init.ora
parameter. Information contained in this parameter tells PMON
how to contact a given listener.

------------------------------------------------------------

In fact, I read that

MTS_DISPATCHER="(protocol=tcp)(listener=<listener_alias>)"

makes PMON register with a given remote listener.

My question is: Since it seems I can only register remotely using MTS, canĀ“t I register remotely using only dedicated servers. Is MTS necessary ?

Thanks

and Tom said...

It is a function for MTS. When using dedicated severs -- we need something on that machine with the SERVER to spawn the dedicated server. The tnslistener does this for us. If the listener were remote, it would not be able to start the dedicated server, hence the listener must be co-located with the server when using a dedicated server configuration.

Rating

  (15 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Pls Clarify

Anil Pant, December 04, 2003 - 7:00 am UTC

It means even while using dedicated server and if the listener is remote u've to register through and mts_dispatcher.
If listener is not remote then no need of using this parameter.
Am I correct ?

Tom Kyte
December 04, 2003 - 9:49 am UTC

no, it means if

a) the listener is remote, you'll be using shared server (MTS), not dedicated



if you are using shared server, these parameters apply.

if you are using dedicated server only, they do not.

remote_listener with dedicated server

VA, July 07, 2005 - 3:54 pm UTC

You said

"If the listener were remote, it would not be able to start
the dedicated server, hence the listener must be co-located with the server when using a dedicated server configuration"

Please see

</code> http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96580/listener.htm#490372 <code>

It says "Registration to remote listeners, such as in the case of Oracle9i Real Application Clusters, can be configured for shared server or dedicated server environments

If you want PMON to register with a remote listener, configure the REMOTE_LISTENER parameter in the initialization parameter file to locate the remote listener"

That contradicts with what you said above, doesnt it?

The documentation makes it seem like I can do

lsnrctl start on server1

Go to server2 and set

remote_listener='(address=(host=server1)(port=1521))'

and my Oracle clients out there can request a dedicated server connection with the listener on server1 and it somehow spawns a dedicated server process on server2

Is this correct?

Thanks

Tom Kyte
July 07, 2005 - 5:21 pm UTC

it is all about versions too - every question has a version associated with it, 8.1.6 in this case.

remote_listener was new with 9i

and -- it is a redirect, there is still a local listener, the pmon instance registers with its local listner and N other remote listeners, the remote listeners "redirect" a client connection


</code> http://docs.oracle.com/docs/cd/B10501_01/network.920/a96580/advcfg.htm#480290 <code>

so there is still a local listener involved in the spawning of the dedicated server, it is done via a redirect.

hence, there is still a listener co-located with the instance.

Data Guard

VA, July 07, 2005 - 7:14 pm UTC

This is interesting, how would this be used in a Data Guard physical standby configuration during a planned switchover

Would the following work?

Primary:
service_names=primary,standby
log_archive_dest_2='service=standby'
fal_client=standby
fal_server=primary
remote_listener='(address=(protocol=tcp)(host=standby)(port=1521))'

Standby:
service_names=primary,standby
log_archive_dest_2='service=standby'
fal_client=standby
fal_server=primary
remote_listener='(address=(protocol=tcp)(host=primary)(port=1521))'

This way, both instances are registered with both listeners.

So, without changing my pfile/spfile, I can do the DataGuard switchover and things should continue to work, right?

All my 100s of Oracle clients out there would continue to use a tnsnames.ora entry pointing to (host=primary)(service_name=primary) and it would always connect to the listener on the "primary" server and that would either hand off the connection to the local instance (if it is the primary) or redirect it to the other listener if that is the primary. Does that sound right?

But how would the listener know which instance is the real primary instance?

Thanks

Tom Kyte
July 07, 2005 - 7:59 pm UTC

but if the primary failed, would you not assume the listener would go with it? You would/could do this at the tnsnames.ora level (try this host, then this host) or if you used OID to "ldap" this, you can change it there.

but think about it - if the primary fails, your listener there would "go with it" wouldn't it.

Performance

A reader, July 07, 2005 - 7:15 pm UTC

Also, is there a performance impact with using this remote_listener redirect feature vs connecting with the co-located listener directly?

Thanks

Tom Kyte
July 07, 2005 - 7:59 pm UTC

on the connect, you'll have the redirect, yes. 10g R2 will introduce this in the middle tier connection pool (similar concept) which'll be nice as well

Primary failed

VA, July 07, 2005 - 8:21 pm UTC

Thats why I clarified that I am talking about a planned switchover operation where I intentionally want to switch the roles of the primary and standby databases. In this case, every thing would be up and running, I just want to swap the roles. Thats what the switchover feature is for, right?

Would my configuration work for this?

Regarding performance, what I wanted to know was is there a performance impact due to the redirect? How does it work exactly? The remote listener accepts the connection, realizes that the service request is for some other host, redirects the request there and that listener proceeds to spawn the dedicated server connection. How expensive is all this compared to directly connecting to the co-located listener?

Thanks

Tom Kyte
July 07, 2005 - 8:30 pm UTC

right, but you said

<quote>
All my 100s of Oracle clients out there would continue to use a tnsnames.ora
entry pointing to (host=primary)(service_name=primary) and it would always
connect to the listener on the "primary" server and that would either hand off
the connection to the local instance (if it is the primary) or redirect it to
the other listener if that is the primary.
</quote>

the premise is PRIMARY JUST BLEW UP.

if all of your clients are pointing to the listener on primary, so what? they will never find that listener will they. It is quite dead.

is a redirect slower than a non-redirect? that should be "obvious", yes, it has to be by definition.

see the link above, there is a 4 step picture, client connects to listener on A, listener on A says "no no, wait, goto B", client connects to B, B spawns dedicated server.

Primary NOT failed

VA, July 07, 2005 - 8:35 pm UTC

Why do you keep saying "the premise is PRIMARY JUST BLEW UP". That is not the premise. This is not a failover, its a planned switchover.

Both the machines are up, both the listeners are up, the roles of the 2 databases are swapped, thats all.

Would my configuration work as seamlessly as I am hoping it will?

Thanks

Tom Kyte
July 07, 2005 - 8:41 pm UTC

sorry, saw data guard and figured "failover"

anyway -- let me ask you, if your clients are configured this way, what happens when a failover ACTUALLY DOES happen? forget the switchover (it'll probably work, you'd want to test and test it but "no reason it would not"). I'm thinking "failover", you have a standby but might not be able to effectively use it!

and most people switchover to patch the OS, do hardware upgrade, some sort of planned "we are going to fix the machine" (so I guess I read over switchover and made it failover because most switchovers include turning off the original primary AND in the event of failover -- the primary is dead. You haven't fixed the real problem so I cannot imagine applying this technique)

Failover vs. switchover

VA, July 07, 2005 - 8:50 pm UTC

The reason we would do this kind of switchover would be to simply "exercise" our Disaster Recovery procedures, not just for Oracle but the entire IT infrastructure of which Oracle is just a part. Lets say some crucial Windows servers in the environment failed and we need to switchover parts of the IT server farm (including Oracle) to a remote site. In this case, the scenario I outlined would kick in.

In case of a real failure of the primary server, we would simply modify our internal DNS to make "primary" resolve to the IP address of the standby server. So, no tnsnames.ora changes would be needed, the (host=primary) would seamlessly go to the standby server and since the standby instance has been failed over to primary using the apppriate DataGuard procedures, everything would work seamlessly. Make sense?

Thanks

Tom Kyte
July 08, 2005 - 7:24 am UTC

right, but do you understand my point:

this would be a futile setup as you would not have in place on the clients the necessary setup to failover. dns changes take time to propagate. There is a technique you can use (connect time failover) right now -- that would work with your switchover AS WELL AS your true failover.

eg: while in theory this might work, why? there is a better way.

Connect time failover

VA, July 09, 2005 - 11:03 am UTC

What "better way" are you referring to? Connect time failover?

Lets see how that would work in both my scenarios

The documentation says CTF is configured by using the following tnsnames.ora entry

primary=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=off)
(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=primary)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=standby)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=primary)))

1. Switchover: Both databases/listeners are up. I follow DataGuard procedures to switch the roles of the 2 databases.

Now what? My clients are still going to try to connect to "primary" as per the tnsnames.ora above since that listener is up. But the database on that server is now in MOUNTED mode doing managed recovery. So my clients would get the error "database not open".

Also, how would Data Guard's log transport work from the new primary (former standby) to the old primary (current standby)? What log_archive_dest_2 should the new primary specify?

2. Failover: Here, the primary site goes down, database, listener, everything is unavailable. I follow DataGuard failover procedures and bring up the standby as ny mew primary. Connect-time failover would kick in as per the above TNSNAMES entry and all my clients would seamlessly connect to the new primary.

Say it takes me a week to fix whatever hardware/software problems caused the old primary to go down. Now I want to make it the primary again. I would need to backup/restore the new primary back to the newly fixed primary server, put it back in the DataGuard configuration as a standby, then follow DG switchover procedures to make this my primary. Now clients would find the primary listener again and life is back to normal. Sounds ok?

So I guess my only issue is my switchover scenario in (1) above where I have a lot of unanswered questions. Any thoughts?

Thanks

Tom Kyte
July 09, 2005 - 12:00 pm UTC

1) switchover, the secondary listener need not be up and running on port 1521 of that machine at all.

You can run the data guard listener on yet another port entirely.



2) same thing again, the listener on the standby that became the primary would "stop", you would not use 1521 anymore.




Connect time failover

A reader, July 09, 2005 - 11:13 am UTC

primary=
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=off)
(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=primary)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=standby)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=primary)))

How long does the SQLNet client layer wait for a response from the (host=primary)'s listener before connecting to (host=standby)'s listener? 1 second, 2 seconds? What determines this?

If primary goes down (as per my failover scenario above), wouldnt this timeout (always try primary then failver to standy) affect performance of my client applications?

Also, even when everything is up and running on the primary, suppose there is a network hiccup that causes the connection to primary listener to take longer than whatever timeout CTF expects? Wouldnt that cause a "false" alarm and make my clients connect to the standby database and get the "database not open" error?

Thanks

Tom Kyte
July 09, 2005 - 12:01 pm UTC

if no one is at home, it is fairly instantaneous.

do what you will ultimately.


(last paragraph, they would get "connection failed" instead of "database not open", in both cases, they get "no where")

Thanks

A reader, July 09, 2005 - 1:09 pm UTC

Thanks a lot for your comments, I never thought of using a different port number for a listener exclusively for Data Guard purposes. I guess I would need a listener.ora file which I dont currently have because I am using the default LISTENER and dynamic instance registration, but thats ok.

But it would be a much more flexible solution, not require DNS changes and use Oracle's connect-time failover feature.

Thanks again.

2 listeners?

A reader, July 09, 2005 - 4:28 pm UTC

Hm, wait a minute. So I would have 2 listeners on each server, a) default LISTENER at port 1521
b) dg_listener at port 1522

How would the instance register with both listeners? When the instance starts up, PMON would register with the default listener at port 1521. What would make it register with the 1522 listener?

Thanks

Tom Kyte
July 10, 2005 - 9:12 am UTC

why is the instance registering with both.

Both

A reader, July 10, 2005 - 9:47 am UTC

Well, you said earlier

"You can run the data guard listener on yet another port entirely"

I took that to mean I run my regular listener on 1521, this is the one all my clients connect to. I take this down to activate my planned switchover. But I still need a listener for DataGuard log transport/apply services.

Tom Kyte
July 10, 2005 - 11:07 am UTC

yes, but why would the instance register with both listeners -- since both need never be running simultaneously


to do the switchover, you are "making a major fundementable change in your environemnt"

there are database shutdowns and restarts. perhaps different init.ora's.

and static registration exists, for remote administration in fact it is "demanded" (so you can startup remotely for example)

11gR2 RAC and remote_listener,

A reader, March 23, 2011 - 3:06 pm UTC

In a multi-node 11gR2 RAC box, the remote_listener value suggested by oracle is scanname.example.com:1521. This works fine. However, we have a "Site to Site" enviroment and replication between these two sites are done at SAN level. The cluster and the SCAN name (IPs) are all different on the other site. If a database failover to the other site, the value of remote_listener will also be copied over (it doesn't change to the SCAN name the other cluster has). Later, when an application tries to connect to the other site, they get TNS connectivity issue.

How to resolve this issue?

Thanks,


Tom Kyte
March 23, 2011 - 3:32 pm UTC

not sure what to say here - you are doing disk level replication (totally inefficient for a database by the way - all we need to do is send the redo stream, not every block that was modified - if you used data guard - you'd probably do 1/7th or 1/8th the network traffic you are doing now... and you own data guard already with enterprise edition - something to look into)

You'll have to script your fail over to change everything that needs be changed.

Follow up,

A reader, March 24, 2011 - 1:45 pm UTC

Thanks. Regarding Listener challenges, our team came up with an option by defining a tns entry (we just named as SCAN_LISTENER) and used that as the value in REMOTE_LISTENER value. The SCAN_LISTENER entry in the server tnsnames.ora file are different (but this is ok for now).

About your other suggestion of using DG, we are very keen on zero data loss. Can DG promise that? We do have data guard on some servers but the databases are not mission critical. Also about the network traffic, can we measure how much bandwidth data guard is taking to move redo files through the network?

Thanks,

Tom Kyte
March 24, 2011 - 3:18 pm UTC

About your other suggestion of using DG, we are very keen on zero data loss.
Can DG promise that?


Yes.

http://docs.oracle.com/docs/cd/E11882_01/server.112/e17157/architectures.htm#HAOVW222


Also about the network traffic, can we measure how
much bandwidth data guard is taking to move redo files through the networ


we don't move redo files, lgwr simultaneously writes redo locally and remotely. You would measure the network traffic using any tool you wanted at the OS level, or you can use enterprise manager to see the network traffic as well.


Think about this though - disk based mirroring has to mirror all writes. If you insert a row into a table you will:

o modify an 8k table block
o modify say 3 8k index blocks (assume 3 indices)
o modify at least an 8k undo block
o write to probably two online redo logs
o which ultimately become archives

And the disk based mirroring would mirror all of that

As opposed to just sending the redo over the network - a single stream of redo.

Follow up,

A reader, March 28, 2011 - 2:20 pm UTC

Thank you. The example you have provided about the number of blocks is outstanding. It answered lot of my subconscious question as well.