Just a quick tip to solve a common issue that is catching people out.
The EZconnect syntax is a great way of connecting to the database without all the rigmarole of setting up and maintaining a tnsnames.ora file. You just nominate the host, service, and optionally the port and away you go.
SQL> connect scott/tiger@//localhost:1519/pdb1 Connected.
Of course, we don't want to be providing the password on the command line so what happens in SQL*Plus when we leave it out?
SQL> connect scott@//localhost:1519/pdb1 SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]] where ::= [/][@] ::= [][/][@]
There's an easy fix though. Just add some quotes and you're good to go!
SQL> connect scott@'//localhost:1519/pdb1' Enter password: ****** Connected.
This seems to be a SQL*Plus oddity. SQLcl handles this just fine.
SQL> show version Oracle SQLDeveloper Command-Line (SQLcl) version: 21.2.2.0 build: 21.2.2.223.0914 SQL> connect scott@//localhost:1519/pdb1 Password? (**********?) ***** Connected.
Enjoy!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.