How to check if a client can access an Oracle database (Linux)

Configurare noua (How To)

Situatie

As a Database Administrator you usually have to check if a client can access an Oracle database.

Solutie

Pasi de urmat

Check if the the listener is available or not

Syntax :

#> lsnrctl status

 Output :

[oracle@host ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-JAN-2021 07:57:28
Copyright (c) 1991, 2019, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                08-JAN-2021 07:57:20
Uptime                    0 days 0 hr. 0 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/BP1/diag/tnslsnr/host/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))
Services Summary...
Service "BP1" has 1 instance(s).
  Instance "BP1", status READY, has 1 handler(s) for this service...
The command completed successfully

If no listener is started then you have to make sure is configured and started.

Syntax :

#> lsnrctl start
#> ps -ef | grep tns

(*) this will show the OS process

Output :

[oracle@host ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-JAN-2021 07:57:18
Copyright (c) 1991, 2019, Oracle.  All rights reserved.
Starting /oracle/BP1/19/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Log messages written to /oracle/BP1/diag/tnslsnr/host/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                08-JAN-2021 07:57:20
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/BP1/diag/tnslsnr/host/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))
The listener supports no services
The command completed successfully

[oracle@host ~]$ ps -ef | grep tns
oracle    4637     1  0 07:57 ?        00:00:00 /oracle/BP1/19/bin/tnslsnr LISTENER -inherit

Perform a tnsping from remote site (client site):

Syntax :

#> tnsping SID

Output :

 [oracle@client_host]$ tnsping BP1

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 08-JAN-2021 14:03:01
Copyright (c) 1997, 2020, Oracle.  All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias


Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = host)))

OK (10 msec)

Tip solutie

Permanent

Voteaza

(21 din 43 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?