Thursday, March 2, 2023

Listener and Tnsnames Configuration in ASM(GRID) and DB for Standalone Server

Listener and Tnsnames Configuration in ASM(GRID) and DB for Standalone Server


LISTENER_TNSNAMES_Configuration_Files
 
listener.ora - Server side configuration file 
tnsnames.ora - Client side configuration file

1. Default Grid Listener with 1521 port for ASM and Database

[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle   22943 22790  0 00:38 pts/0    00:00:00 grep --color=auto smon
oracle   29063     1  0 Feb22 ?        00:00:08 asm_smon_+ASM
oracle   29230     1  0 Feb22 ?        00:00:09 ora_smon_TESTDB
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ ps -ef|grep tns
root        22     2  0  2022 ?        00:00:00 [netns]
oracle   22948 22790  0 00:38 pts/0    00:00:00 grep --color=auto tns
oracle   28808     1  0 Feb22 ?        00:00:10 /u01/app/19.0.0.0/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
[oracle@oraclelab2 ~]$


[oracle@oraclelab2 ~]$ cat /u01/app/19.0.0.0/grid/network/admin/listener.ora
#Backup file is  /u01/app/oracle/crsdata/oraclelab2/output/listener.ora.bak.oraclelab2.oracle line added by Agent
# listener.ora Network Configuration File: /u01/app/19.0.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON            # line added by Agent
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 admin]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/tnsnames.ora
TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TESTDB)
    )
  )
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:15:29

Copyright (c) 1991, 2022, 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                22-FEB-2023 10:42:35
Uptime                    7 days 14 hr. 32 min. 54 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DGROUPC" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "TESTDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ sqlplus system/Mallik123@TESTDB

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:15:51 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 02 2023 00:43:15 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL>

2. Default Grid Listener with 1522 custom port for ASM and Database

[oracle@oraclelab2 admin]$ cat /u01/app/19.0.0.0/grid/network/admin/listener.ora
#Backup file is  /u01/app/oracle/crsdata/oraclelab2/output/listener.ora.bak.oraclelab2.oracle line added by Agent
# listener.ora Network Configuration File: /u01/app/19.0.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON            # line added by Agent
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ cat /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/tnsnames.ora
TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TESTDB)
    )
  )

[oracle@oraclelab2 admin]$

oracle@oraclelab2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:33:55 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1521))
remote_listener                      string
SQL>

[oracle@oraclelab2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:29:12

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:28:15
Uptime                    0 days 0 hr. 0 min. 56 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.38.4.179)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DGROUPC" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "TESTDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl config listener -l LISTENER
Name: LISTENER
Type: Database Listener
Home: /u01/app/19.0.0.0/grid
End points: TCP:1521
Listener is enabled.
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ srvctl modify listener -p "TCP:1522"
[oracle@oraclelab2 ~]$ srvctl config listener -l LISTENER
Name: LISTENER
Type: Database Listener
Home: /u01/app/19.0.0.0/grid
End points: TCP:1522
Listener is enabled.
[oracle@oraclelab2 ~]$ 

[oracle@oraclelab2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:35:18

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:28:15
Uptime                    0 days 0 hr. 7 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
The listener supports no services
The command completed successfully
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:36:15 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> alter system set local_listener="(ADDRESS=(PROTOCOL=TCP)(HOST=10.38.4.179)(PORT=1522))" scope=both;

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1522))
remote_listener                      string
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:36:52

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:28:15
Uptime                    0 days 0 hr. 8 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DGROUPC" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [+ASM] ? TESTDB
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:37:21 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string
remote_listener                      string
SQL> alter system set local_listener="(ADDRESS=(PROTOCOL=TCP)(HOST=10.38.4.179)(PORT=1522))" scope=both;

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1522))
remote_listener                      string
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [TESTDB] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:38:19

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:28:15
Uptime                    0 days 0 hr. 10 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DGROUPC" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "TESTDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 admin]$ sqlplus system/Mallik123@TESTDB

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:15:51 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 02 2023 00:43:15 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL>

3. Independent ASM (Grid) Listener and DB Listener 

[oracle@oraclelab2 ~]$ cat /u01/app/19.0.0.0/grid/network/admin/listener.ora
#Backup file is  /u01/app/oracle/crsdata/oraclelab2/output/listener.ora.bak.oraclelab2.oracle line added by Agent
# listener.ora Network Configuration File: /u01/app/19.0.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON            # line added by Agent
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep tns
root        22     2  0  2022 ?        00:00:00 [netns]
oracle   27397     1  0 01:41 ?        00:00:00 /u01/app/19.0.0.0/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
oracle   27532 26187  0 01:43 pts/0    00:00:00 grep --color=auto tns
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:43:28

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:41:17
Uptime                    0 days 0 hr. 2 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DGROUPC" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl config listener -l LISTENER
Name: LISTENER
Type: Database Listener
Home: /u01/app/19.0.0.0/grid
End points: TCP:1521
Listener is enabled.
[oracle@oraclelab2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:44:03 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1521))
remote_listener                      string
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$

[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [+ASM] ? TESTDB
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$ cd /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/
[oracle@oraclelab2 admin]$ vi listener.ora
[oracle@oraclelab2 admin]$ cat listener.ora
LISTENER_TESTDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1522))
    )
  )
[oracle@oraclelab2 admin]$ lsnrctl start LISTENER_TESTDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:46:19

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oraclelab2/listener_testdb/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_TESTDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:46:19
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener_testdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
The listener supports no services
The command completed successfully
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:46:40 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> alter system set local_listener="(ADDRESS=(PROTOCOL=TCP)(HOST=10.38.4.179)(PORT=1522))" scope=both;

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1522))
remote_listener                      string
SQL>
[oracle@oraclelab2 admin]$ lsnrctl status LISTENER_TESTDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:47:39

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_TESTDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:46:19
Uptime                    0 days 0 hr. 1 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener_testdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
Services Summary...
Service "TESTDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin
[oracle@oraclelab2 admin]$ cat tnsnames.ora
TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TESTDB)
    )
  )

[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ sqlplus system/Mallik123@TESTDB

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:48:27 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 02 2023 01:15:51 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL>

4. Register Independent DB Listener with HAS 

[oracle@oraclelab2 admin]$ ps -ef|grep tns
root        22     2  0  2022 ?        00:00:00 [netns]
oracle   27397     1  0 01:41 ?        00:00:00 /u01/app/19.0.0.0/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
oracle   27763     1  0 01:46 ?        00:00:00 /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tnslsnr LISTENER_TESTDB -inherit
oracle   28128 26187  0 01:50 pts/0    00:00:00 grep --color=auto tns
[oracle@oraclelab2 admin]$ cat listener.ora
LISTENER_TESTDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab2.localdomain.com)(PORT = 1522))
    )
  )
[oracle@oraclelab2 admin]$ lsnrctl stop LISTENER_TESTDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:51:19

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
The command completed successfully
[oracle@oraclelab2 admin]$ srvctl add listener -l LISTENER_TESTDB -p 1522 -o /u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab2 admin]$ srvctl config listener -l LISTENER_TESTDB
Name: LISTENER_TESTDB
Type: Database Listener
Home: /u01/app/oracle/product/19.0.0.0/dbhome_1
End points: TCP:1522
Listener is enabled.
[oracle@oraclelab2 admin]$ srvctl status listener -l LISTENER_TESTDB
Listener LISTENER_TESTDB is enabled
Listener LISTENER_TESTDB is not running
[oracle@oraclelab2 admin]$ srvctl start listener -l LISTENER_TESTDB
[oracle@oraclelab2 admin]$ srvctl status listener -l LISTENER_TESTDB
Listener LISTENER_TESTDB is enabled
Listener LISTENER_TESTDB is running on node(s): oraclelab2
[oracle@oraclelab2 admin]$ lsnrctl status LISTENER_TESTDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-MAR-2023 01:52:19

Copyright (c) 1991, 2022, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_TESTDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-MAR-2023 01:51:58
Uptime                    0 days 0 hr. 0 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab2/listener_testdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab2.localdomain.com)(PORT=1522)))
Services Summary...
Service "TESTDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB" has 1 instance(s).
  Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab2 admin]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:52:29 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
forward_listener                     string
listener_networks                    string
local_listener                       string      (ADDRESS=(PROTOCOL=TCP)(HOST=1
                                                 0.38.4.179)(PORT=1522))
remote_listener                      string
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 admin]$ sqlplus system/Mallik123@TESTDB

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 2 01:52:45 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 02 2023 01:48:27 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 admin]$

[oracle@oraclelab2 admin]$ . oraenv
ORACLE_SID = [TESTDB] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 admin]$
[oracle@oraclelab2 admin]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       oraclelab2               STABLE
ora.DGROUPC.dg
               ONLINE  ONLINE       oraclelab2               STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       oraclelab2               STABLE
ora.LISTENER_TESTDB.lsnr
               ONLINE  ONLINE       oraclelab2               STABLE
ora.OCR.dg
               ONLINE  ONLINE       oraclelab2               STABLE
ora.RECO.dg
               ONLINE  ONLINE       oraclelab2               STABLE
ora.asm
               ONLINE  ONLINE       oraclelab2               Started,STABLE
ora.ons
               OFFLINE OFFLINE      oraclelab2               STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       oraclelab2               STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       oraclelab2               STABLE
ora.testdb.db
      1        ONLINE  ONLINE       oraclelab2               Open,HOME=/u01/app/o
                                                             racle/product/19.0.0
                                                             .0/dbhome_1,STABLE
--------------------------------------------------------------------------------
[oracle@oraclelab2 admin]$

Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...