Database Connection Using SQLPLUS Without tnsnames.ora from Command Line


The Eucharistic Miracles of the World
Here is the method to connect to the oracle database using sqlplus without configuring the TNSNAMES from the OS prompt. 

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



Website Stats


Post a Comment


Oracle (580) General (60) Unix (47) Script (41) Blog (23) OCI (3) SQL* Loader (3) Datapump (2) Software (1)
DBA Tips Copyright 2011-21 All Rights Reserved | Site Map | Contact | Disclaimer