In this post, I am showing that how we can connect to the
Oracle Database which is running in remote machine using sqlplus.
If we are not
changing the sqlnet.ora file, we get the below error while trying connect remote
database server from command prompt
ERROR: ORA-12638: Credential retrieval failed
Edit the sqlnet.ora file (path: $ORACLE_HOME/network/admin) and
change the below entry from
SQLNET.AUTHENTICATION_SERVICES = (NTS)
To
SQLNET.AUTHENTICATION_SERVICES
= (NONE)
Option 1 : Edit tnsnames.ora file
a.
Edit the tnsnames.ora file
(path: $ORACLE_HOME/network/admin) and add the below entries to make the
command with simple string.
<SID>
=
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)(HOST = <hostname
of remote server>)(PORT = <port>))
(CONNECT_DATA =
(SERVER =
DEDICATED)
(SERVICE_NAME = <service name>)
)
)
Example are given below,
GFIFMWDB
=
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)(HOST = DESKTOP-627VPAN)(PORT
= 1521))
(CONNECT_DATA =
(SERVER =
DEDICATED)
(SERVICE_NAME = gfifmwdb)
)
)
b.
Execute the below command
sqlplus "SYS/Welcome1@GFIFMWDB AS SYSDBA"
c.
We can see that sqlplus is
connected to the remote DBs server
Option 2 : Without editing tnsnames.ora file
a.
Execute below command by
providing all the remote server information in the command
sqlplus
"sys/Welcome1@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=DESKTOP-627VPAN)(Port=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=GFIFMWDB)))"
as sysdba
b.
We can see that sqlplus is
connected to the remote DBs server
No comments:
Post a Comment