Wednesday, May 13, 2020

Lisetner Understanding

Practical  1 


How to start/Stop a Database from Remote login as SysDBA Using Static TNS Entry..

ON RAC1 NODE PLEASE LAUNCH NETMGR

create a listenere NAME LISTERNERPROD

Configure the Listener with static Entry.

LISTENERPROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.example.com)(PORT = 1525))
  )


SID_LIST_LISTENERPROD =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = AUTOD.example.com)
      (ORACLE_HOME = /oracle/DEA/12102)
      (SID_NAME = AUTOD)
    )
  )




Where
LISTENERPROD:- Is the Listener Name which show the HOST NAME,on which port its running.

SID_LIST_LISTENERPROD :- its show the static entry for the SID AUTOD in the listener with service name
AUTOD.example.com

Now lets start the Listener

lsnrctl start LISTENERPROD


[oracle@rac1 admin]$ lsnrctl status LISTENERPROD

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 07:27:51

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.example.com)(PORT=1525)))
STATUS of the LISTENER
------------------------
Alias                     LISTENERPROD
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                01-OCT-2019 07:27:31
Uptime                    0 days 0 hr. 0 min. 21 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/DEA/12102/network/admin/listener.ora
Listener Log File         /oracle/DEA/diag/tnslsnr/rac1/listenerprod/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.example.com)(PORT=1525)))
Services Summary...
Service "AUTOD.example.com" has 1 instance(s).========================================================Its show the Service which we added in the static Listener.
  Instance "AUTOD", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac1 admin]$



Lets Check database status

[oracle@rac1 admin]$ ps -ef|grep pmon
oracle   12071  7707  0 07:28 pts/2    00:00:00 grep --color=auto pmon
oracle   29514     1  0 Sep30 ?        00:00:04 ora_pmon_AUTOD
[oracle@rac1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 1 07:28:56 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select name from v$database;

NAME
---------
AUTOD

SQL>


Database is up and running on Node Rac1.



Lets login from NOde2 Rac2

TNS ENTRY FROM CLINET NODE RAC2:-


PAUTOD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.example.com)(PORT = 1525))
    (CONNECT_DATA =
      #(SERVICE_NAME = AUTOD)
      (SERVICE_NAME = AUTOD.example.com)======================We are using Service Name AUTOD.example.com
    )
  )


Lets Connect .

[oracle@rac2 admin]$ tnsping PAUTOD

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 07:33:23

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

Used parameter files:
/oracle/EEA/12102/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.example.com)(PORT = 1525)) (CONNECT_DATA = (SERVICE_NAME = AUTOD.example.com)))
OK (0 msec)


[oracle@rac2 admin]$ sqlplus sys/abc#123@PAUTOD as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 1 07:34:03 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>SQL> select name from v$database;

NAME
---------
AUTOD

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
lets check on Node RAC1:-

[oracle@rac1 ~]$ ps -ef|grep pmon
oracle   17902  7707  0 07:35 pts/2    00:00:00 grep --color=auto pmon

[oracle@rac1 ~]$ lsnrctl status LISTENERPROD

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 07:35:50

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.example.com)(PORT=1525)))
STATUS of the LISTENER
------------------------
Alias                     LISTENERPROD
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                01-OCT-2019 07:27:31
Uptime                    0 days 0 hr. 8 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/DEA/12102/network/admin/listener.ora
Listener Log File         /oracle/DEA/diag/tnslsnr/rac1/listenerprod/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.example.com)(PORT=1525)))
Services Summary...
Service "AUTOD.example.com" has 1 instance(s).
  Instance "AUTOD", status UNKNOWN, has 1 handler(s) for this service...====================================> Unknown Status Indicate the static Registration of Instance with Listener.
The command completed successfully


READY instance comes from the database having registered itself with the listener This is known as “dynamic registration”.



[oracle@rac1 ~]$ lsnrctl service LISTENERPROD

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 07:35:59

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.example.com)(PORT=1525)))
Services Summary...
Service "AUTOD.example.com" has 1 instance(s).
  Instance "AUTOD", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:2 refused:0
         LOCAL SERVER
The command completed successfully
[oracle@rac1 ~]$


Lets Start a database using a  startup command from Node2  Rac2:-

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@rac2 admin]$ sqlplus sys/abc#123@PAUTOD as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 1 07:37:16 2019

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1644167168 bytes
Fixed Size                  2925024 bytes
Variable Size            1056968224 bytes
Database Buffers          570425344 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
SQL> select name from v$database;

NAME
---------
AUTOD

SQL> !hostname
rac2.example.com

SQL>

Practical 2 

Service Name , DB_NAME, DB_DOMAIN,INSTANCE,GLOBAL_DBNAME

Lets work on Service Name Parameter.

1) remove or  rename to .bkp the LISENER.ORA file.

[oracle@rac1 admin]$ mv listener.ora listener.ora_123


2) [oracle@rac1 admin]$ lsnrctl start

[oracle@rac1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 08:09:01

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                01-OCT-2019 08:08:39
Uptime                    0 days 0 hr. 0 min. 22 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/DEA/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.example.com)(PORT=1521)))
Services Summary...
Service "AUTODXDB" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
Service "AUTOD_north" has 1 instance(s).----------------------------------------------------------> its showing  due to Unique DB parameter SQL> show parameter    unique NAME       TYPE        VALUE
------------------------------------ ----------- -----------------------------                                                                                    db_unique_name     string      AUTOD_north

  Instance "AUTOD", status READY, has 1 handler(s) for this service...
Service "AUTOD_north_DGB" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...=================================Its Instance Name
The command completed successfully



Here we are see three service.
1)AUTODXDB---------------------------> Internal oracle service
2)AUTOD_north -----------------------> This is due to Data guard Broker service & Data-guard Parameter.
3)AUTOD_north_DGB-----------------------> This is due to Data guard Broker service & Data-guard parameter.


After Doing all this below step i have removed my OLD DG setup

alter system reset db_unique_name scope=spfile;
alter system reset log_archive_config scope=both;
ALTER SYSTEM SET DG_BROKER_START=FALSE SCOPE=BOTH;
show parameter DG_BROKER_START
select name , value from v\$parameter where name like '%dg_broker%';


Now let see the Listener Status & which Service its showing.

[oracle@rac1 STANDBY]$ lsnrctl status LISTENER

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 08:34:44

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                01-OCT-2019 08:08:39
Uptime                    0 days 0 hr. 26 min. 4 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/DEA/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.example.com)(PORT=1521)))
Services Summary...
Service "AUTOD" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
Service "AUTODXDB" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac1 STANDBY]$

Servive Name.
1)AUTOD
2)AUTOXDB.

Both This service name were Drives from DB_NAME parameter AUTOD.------------Always you see this service with Basics Listener entry.(dynamic registration”)
This are the default service were registered dynamically with listener because its using default Port 1521.
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      AUTOD
SQL>  show parameter service_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string                                                ==================================>No service Name Defined
SQL> show parameter DB_DOMAIN

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_domain                            string                                                ===================================>No DB_NAME defined
SQL>  show parameter DB_NAME

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      AUTOD



lets add a simple service PROD_SALE.
SQL> alter system set service_names='PROD_SALE' scope=both;

System altered.

Check Listener status.
SQL> !ps -ef|grep tns
root        22     2  0 Sep29 ?        00:00:00 [netns]
oracle   12383  9789  0 08:41 pts/2    00:00:00 /bin/bash -c ps -ef|grep tns
oracle   12385 12383  0 08:41 pts/2    00:00:00 grep tns
oracle   13376     1  0 08:08 ?        00:00:00 /oracle/DEA/12102/bin/tnslsnr LISTENER -inherit

SQL> !lsnrctl status LISTENER

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 01-OCT-2019 08:41:10

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                01-OCT-2019 08:08:39
Uptime                    0 days 0 hr. 32 min. 31 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/DEA/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.example.com)(PORT=1521)))
Services Summary...
Service "AUTOD" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
Service "AUTODXDB" has 1 instance(s).
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
Service "PROD_SALE" has 1 instance(s). ========================================================Its created one more service & trhough which user/Client can connnect to the database.
  Instance "AUTOD", status READY, has 1 handler(s) for this service...
The command completed successfully

No comments:

Post a Comment