Sometimes new things that are really useful show up in new versions and you can miss it if you’r not paying close attention. EZ Connect Plus is one such feature for me. You may think it is not new and that it has been there for a long time. You’d be correct EZ Connect is not new, but the Plus moniker is.
In version 19 that was added. I never noticed and then I was looking for how to connect multiple users to the same database with a wallet and I stumbled on a blog by Franck Pachot that talked about one way to do it. While reading it I went “Wait… What… ???” as it indicated “Oracle 19c extends the EZCONNECT syntax”. Truth be told I had looked over that section a few times before it dawned on me “19 c extends”. Has anything else changed? So I put the breaks on what I was doing and shifted over to reading up on this.
Of course my first search on it turned up another blog by Franck. It is four year sold as as far as I can tell as valid today as the day it was written. So consider it additional reading.
The problem with EZ Connect has been that it does not cover more complex scenarios. The syntax supported by standard EZ Connect looks like this.
As you can see this allows just one host to be named, filling it out to the max would look like this.
Pretty good but it is of little help to specify you primary and secondary database in a data guard setup so the same connect string finds the primary database no matter which host it is currently located on. The EZ Connect Plus syntax is updated to this.
Note, this is new fro 19c.
You can now specify protocol, same as you can in a normal connect descriptor. In addition you can add several hosts separated by comma. You can also supply port for each of them or if it is the same on all of the just put it after the last host. There is also an option to add parameters, those go to the DESCRIPTION level in the connect descriptor.
Extending the example used before could look like this.
Now the service/pdb pdb_svc_1 is requested on host1 and host2. If found it is what we connect to. Typical data guard setup is to start the service only one the database that is primary. Thus we connect to the primary database on the host where it currently is primary.
Giving tnsping an EZ Connect URL it will respond with the connect descriptor it translates it into. It can often be a good way to resolve issues when your EZ connect does not work as you expected it to.
As one last hint I’d like to add one feature this leads to that I found a long time ago while still not realizing all these other features. It was a solution where they could not set TNS_ADMIN to specify where the tnsnames.ora was located. But using a TNS-alias was and adding a parameter to it works.
Being able to specify where the tns-file is located is pretty convenient in many cases and in some it is the only option.