Search This Blog

Total Pageviews

Sunday, 26 January 2025

Oracle tnsping and connection testing

tnsping '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))(CONNECT_DATA=(SID=oem)))' 10


tnsping '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))(CONNECT_DATA=(SID=oem)(SERVICE_NAME= empdbrepos)))' 10

tnsping '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.1.197)(Port=1521))(CONNECT_DATA=(SERVICE_NAME= empdbrepos)))' 10


=======
tnsping '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.1.197)(Port=1521))(CONNECT_DATA=(SID=oem)(SERVICE_NAME= empdbrepos)))' 10

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 26-JAN-2025 11:49:54

Copyright (c) 1997, 2024, Oracle.  All rights reserved.

Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.1.197)(Port=1521))(CONNECT_DATA=(SID=oem)(SERVICE_NAME= empdbrepos)))
OK (0 msec)
OK (0 msec)
OK (10 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
=========


connection test via sqlplus 


for i in {1..2} ; do sqlplus -L -s sys/sys@//192.168.1.197/empdbrepos as sysdba <<< 'select name,open_mode,instance_name from v$instance , v$database;'; done


for i in {1..2} ; do sqlplus -L -s sys/sys@//192.168.1.197/empdbrepos as sysdba <<< 'select DUMMY from dual;'; done

D
-
X


D
-
X


=====

SQL> grant dba to anuj identified by vihaan123 ;


Grant succeeded.


sqlplus 'anuj/vihaan123@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))(CONNECT_DATA=(SID=oem)(SERVICE_NAME= empdbrepos)))'


[oracle@ORAOEM admin]$ sqlplus 'anuj/vihaan123@empdbrepos'


======

while true do for i in {1..2} ; do sqlplus -L -s sys/sys@//192.168.1.197/empdbrepos as sysdba <<< 'select name,open_mode,instance_name from v$instance , v$database;'; done done



while true
do
  for i in {1..2} ; do sqlplus -L -s sys/sys@//192.168.1.197/empdbrepos as sysdba <<< 'select name,open_mode,instance_name from v$instance , v$database;'; done
  sleep 5
done

No comments:

Oracle DBA

anuj blog Archive