We have a legacy code which connectes to Oracle DB using SQLPLUS command:
sqlplus "$USERNAME/$PASSWORD@//$HOST:$PORT/$SERVICE_NAME"
Values of variables USERNAME, PASSWORD, HOST, PORT and SERVICE_NAME are configured using external properties file. This code works when we have the DB with the service name. In our case DB has default serice:
SYS_CONTEXT('USERENV','SERVICE_NAME')
-------------------------------------
SYS$USERS
DB has only the SID:
SYS_CONTEXT('USERENV','SID')
----------------------------
521
Is there any way to connect to Oracle DB using default service name? e.g.
sqlplus "$USERNAME/$PASSWORD@//$HOST:$PORT/SYS$USERS"
It fails with error: ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
WE also tried with SID as:
sqlplus "$USERNAME/$PASSWORD@//$HOST:$PORT/521"
It fails with error:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
There is no scope to change code of this legacy app or change DB to add service names. Please let me know if there is any to resolve this issue.