ORA-12514: TNS:listener does not currently know of service requested in connect

i have converted non rac db to RAC. Refer this doc if you want to know how

https://dbatracker.com/2020/06/22/convert-single-instance-db-to-rac-db-using-rconfig-admin-managed/

Now the issue is i am able to tnsping the database but when trying to connect through scan listener i am getting this error

this is the tns entry which is using scan

I don’t need to use TNS entry because connection request will be catered through scan listener. but for demo i am showing how a application will connect

dup5 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = myrac-scan)(PORT = 1527))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = dup5)
    )
  )
C:\Users\smudgal>sqlplus sys/oracle@dup5 as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 22 11:20:38 2020

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

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

when i check my scan listener status nothing retured for dup5. that means somehow dup5 service is not registered with scan

[oracle@myrac05 admin]$ lsnrctl status LISTENER_SCAN2|grep - dup5

let’s check at database

SQL> sho parameter remote_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      myrac-scan:1527                                        

so we are pointing to scan listener but then why service is not known to scan listener.

lets check scan config

[oracle@myrac05 sampleXMLs]$ srvctl config scan
SCAN name: myrac-scan, Network: 1/192.168.43.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /myrac-scan/192.168.43.105
SCAN VIP name: scan2, IP: /myrac-scan/192.168.43.106
SCAN VIP name: scan3, IP: /myrac-scan/192.168.43.107

workaround for this issue

we will set remote listener to use ip address of scan(all three). Note that our scan listener is running on port 1527, so we are doing this modification

SQL>  alter system set remote_listener='' scope=both sid='*';

System altered.

SQL> alter system set remote_listener='(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST=192.168.43.105
)(PORT=1527))(ADDRESS=(PROTOCOL=TCPS)(HOST=192.168.43.106)(PORT=1527))(ADDRESS=(PROTOCOL=TCPS)(HOST=192.168.43.107)(PORT=1527)))'  scope=both sid='*';
System altered.
SQL> alter system register;

System altered.

now check again. you will be able to see the service dup5 registered with scan listener

[oracle@myrac05 admin]$ lsnrctl status LISTENER_SCAN2|grep -i dup5
Service "dup5" has 2 instance(s).
  Instance "dup5_1", status READY, has 1 handler(s) for this service...
  Instance "dup5_2", status READY, has 1 handler(s) for this service...

now you should be able to connect

C:\Users\smudgal>sqlplus sys/oracle@dup5 as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 22 11:25:56 2020

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters and Automatic Storage Management options

SQL>