RMAN-04005:ORA-01017: when making target connection using RMAN

Today While I was doing RMAN duplication, I faced this error when trying to make TARGET connection using RMAN. I am on 11gR2.

Following command resulted in error

rman target hi_dba/upgrade123@target

Recovery Manager: Release 11.2.0.3.0 – Production on Mon Jun 29 12:08:02 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied

I tried creating a new user, granted SYSDBA privilege  and even recreated password file and tried using SYS. It still showed same error. My remote_login_passwordfile value was EXCLUSIVE and I have copied password file to AUXILIARY instance home.

The target was a RAC database and SERVICE_NAME I used in TNS resolution can be registered in any of the RAC node. I created a new TNS alias adding INSTANCE_NAME so that connection goes to only one instance. It can also work with ORACLE_SID instead of adding INSTANCE_NAME.

Following TNS alias did the trick.

TARGET =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = abc.co.uk)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
  (INSTANCE_NAME = SALES1)
(SERVICE_NAME = SALES)
)
)

Conclusion : Either use a service name which will be in only one node or use INSTANCE_NAME or ORACLE_SID in your name resolution.