1

I am developing an app and have a working connection to a Oracle Database using a Connection String like this:

"Data Source=(DESCRIPTION=(ADDRESS=(COMMUNITY=tcpcomm)(PROTOCOL=TCP)(HOST=mydatabasehost.myserver.com)(PORT=1529))(CONNECT_DATA=(SERVICE_NAME=code123.myserver.com))); User Id=user;Password=123456;";

I checked and I can also connect to this database using Oracle SQL Developer on my laptop.

Now I am trying to connect to an Oracle Database using Azure Logic Apps Oracle Connector.
Azure Logic Apps Connector But it requires:

serverhost:port/sid

I tried only serverhost:port but it also does not connect, gives this an error like this:

Test connection failed. Details: Oracle: ORA-12154: TNS:could not resolve the connect identifier specified inner exception: Oracle: ORA-12154: TNS:could not resolve the connect identifier specified clientRequestId:

I tried these 3 queries:

select distinct sid from v$mystat;
select * from global_name;
select value from v$parameter where name='service_names';

But none of the returned values worked locally when I select SID.
Oracle SQL Developer
I get

Invalid Username/password; logon denied

On Logic Apps this error appear: Failed to create connection for connection id

'/providers/Microsoft.PowerApps/apis/shared_oracle/connections/shared-oracle-....'. Encountered internal server error from Data Transfer Service. The tracking Id is '...'.

Locally, if I use the SERVICE_NAME then it works. But in order to use the Logic Apps connector I need the SID.

I checked the On-premises data gateway Network ports test and it says: On-premisses data gateway

How can I find out the SID by typing a SQL Query into my existing Oracle Connection on Oracle SQL Developer? Or how can I connect from Azure Logic Apps using the SERVICE_NAME?

Is it possible that the server is not accepting connections using the SID, and only accepts connections using the Service Name?

3
  • 1
    serverhost:port/sid is technically 'wrong'. This 'easy connect' syntax is serverhost:port/service_name. It doesn't work with (now obsolete) SIDs, so avoid being distracted by answers about SIDs! Jul 9, 2021 at 23:52
  • WHen I try serverhost:port/service_name then the error is Failed to create connection for connection id '/providers/Microsoft.PowerApps/apis/shared_oracle/connections/shared-oracle-...'. Encountered internal server error from Data Transfer Service. The tracking Id is ...
    – Tony
    Jul 9, 2021 at 23:58
  • Is the target database a pluggable database (PDB)?
    – pmdba
    Jul 10, 2021 at 3:19

3 Answers 3

2

My first answer was lame. You are getting this error:

ORA-12154: TNS:could not resolve the connect identifier

So, it is trying to look up your server in a tnsnames.ora file rather than use host, port, sid or service name. It could be that there is another option that lets you type all that in. Or you may need to install an oracle client and setup a tnsnames.ora entry for your target server.

tnsnames.ora entry would look something like this:

MYSERVER=
(DESCRIPTION=(ADDRESS=(COMMUNITY=tcpcomm)(PROTOCOL=TCP) 
(HOST=mydatabasehost.myserver.com)(PORT=1529))(CONNECT_DATA= 
(SERVICE_NAME=code123.myserver.com)))

Bobby

6
  • Is it possible that the server is configured to not accepting connections using the SID, and only accepts connections using the Service Name?
    – Tony
    Jul 9, 2021 at 23:18
  • It is unlikely. There are some funky ways things can be setup but most likely the issue is that Azure Logic Apps Oracle Connector expects you to have an Oracle client installed and the host, port, sid/service_name in the tnsnames.ora file. Jul 9, 2021 at 23:22
  • 1
    learn.microsoft.com/en-us/azure/connectors/… - the docs say to enter a server port and sid so I don't know. It also says to install a client. ORA-12154 usually means it cannot find a service name in a tnsnames.ora file. Jul 9, 2021 at 23:25
  • Hey, I did not pay attention to that information: Install the Oracle Client on the machine where you installed the on-premises data gateway. Be sure to install the 64-bit Oracle Data Provider for .NET from Oracle: 64-bit ODAC 12c Release 4 (12.1.0.2.4) for Windows x64
    – Tony
    Jul 9, 2021 at 23:45
  • 1
    The tnsnames.ora file goes in $ORACLE_HOME/network/admin usually. Jul 12, 2021 at 21:28
1

You can find the SID by querying the v$thread view in the existing Oracle SQL Developer connection:

If ORACLE_SID = DB_SID

SQL> select instance from v$thread;
INSTANCE
----------------
DB_SID

More info on DB_NAME and ORACLE_SID here

4
  • When I run this query, it returns ORA-00942: a tabela ou view não existe 00942. 00000 - "table or view does not exist"
    – Tony
    Jul 9, 2021 at 23:12
  • 1
    select instance_name from v$instance; would give you the sid. Jul 9, 2021 at 23:15
  • I ran that and when I use that instance name on the Oracle SQL Developer SID field with the login and password (that works with Service Name) it gives ORA-01017: invalid username/password; logon denied
    – Tony
    Jul 9, 2021 at 23:42
  • If you are getting ORA-01017 it means you are connecting to some database but the user and password you tried to login with do not work. Jul 12, 2021 at 21:27
1

You can query the Oracle SID with the query

SELECT sys_context('userenv','db_name') FROM DUAL;

It is accessible by every user, you don't need special privileges to use it.

1
  • I tried this, then used the value on the SID field, tried to connect and got this: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    – Tony
    Jul 11, 2021 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.