11 July 2010

Connecting Without TNSNames With EZConnect

On my laptop I run two databases, Oracle 10g Release 2 and Oracle 11g Release 2. Next to my regular consulting work, I also give an Oracle Advanced SQL and PL/SQL training called "7Up". This training covers "all" new features since Oracle7.
I tried using VM for having multiple versions of the database, but my laptop would grind to a halt.
Anyway, usually I use SQL*Plus for all my demo's - SQL*Plus Windows that is. As you may know, SQL*Plus Windows vanished from the Oracle 11g database.
Until now I was using SQL*Plus commandline instead, and that was fine.
Last week I received the latest Oracle Magazine (July/August 2010) at home and in it was the AskTom column on connecting without TNSNames.

Just having a single shortcut on my desktop to connect to either the Oracle 10g database or the Oracle 11g database would make it easier to switch databases and show the differences between the two. I like the SQL*Plus Windows a little bit better over the SQL*Plus commandline version, it just feels more natural. I tried using SQL Developer for the demo's, but found zooming in and out to show snippets of SQL too distracting from the actual statement.
Because I probably forget what to use as the connect string, I had to write this down somewhere. And since this is my "Things I got to remember" blog,.. here it is:

SQL> conn alex/alex@//localhost/orcl11
Connected.
SQL>
SQL> select *
2 from v$version
3 /

BANNER
------------------------------------------------------------
Personal Oracle Database 11g Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


This works because I have EZCONNECT in my SQLNet.Ora:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

Credit goes to Tom Kyte, of course.
Links
Oracle Magazine: On Connecting, Pivoting, and Learning New Tricks

No comments:

Post a Comment