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;


SQL> show parameter service

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

$ lsnrctl status

LSNRCTL for Linux: Version - Production on 23-MAR-2017 05:35:27
Listening Endpoints Summary...
$ sqlplus sthomas/

SQL*Plus: Release 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 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show user




Post a Comment Copyright 2011-17 All Rights Reserved | Site Map | Contact | Disclaimer | Google