Database Connection Using SQLPLUS Without tnsnames.ora from Command Line

_____________________________________________________________________________________________________________________

Here is the method to connect to the oracle database using sqlplus without configuring the TNSNAMES from the OS prompt.
Syntax:  sqlplus username/password@Host_name:Listener_port/database_Service_name
Where you must know the username and password for the database.
You can use following options to find out the hostname, Listener port and database service name


SQL> select host_name from v$instance;

HOST_NAME
------------------------------
ora01test.bcndualgate.net

SQL> show parameter service

NAME                                 TYPE                             VALUE
------------------------------------ -------------------------------- -------
service_names                        string                           TEST

$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 23-MAR-2017 05:35:27
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora01test.bcndualgate.net)(PORT=1521)))
$ sqlplus sthomas/tiger123@ora01test.bcndualgate.net:1521/TEST

SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 23 05:37:01 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show user

USER is "STHOMAS"

_____________________________________________________________________________________________________________________

0 comments:

Post a Comment

 

acehints.com Copyright 2011-17 All Rights Reserved | Site Map | Contact | Disclaimer | Google