I am trying to create a db link by giving this command
CREATE DATABASE LINK dblink
CONNECT TO qqitsmrep_read IDENTIFIED BY etl#t0pread
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=pldbitsr0031vm.bmwgroup.net)(PORT=1708))
(CONNECT_DATA=(SERVICE_NAME=ITSM Reporting))
)';
but not sure the service name is correct or not and also when i test the db link i get the below error
The connection looks like this
SQL Developer connection says that
Host is pldbdco0024vm.bmwgroup.net, but you used pldbitsr0031vm.bmwgroup.net
DCODB is SID, while you used Service Name which doesn't seem to be correct
Port is 1595, while you used 1708
Basically, you should check what TNSNAMES.ORA says (or ask your DBA).
Try
CREATE DATABASE LINK dblink
CONNECT TO qqitsmrep_read IDENTIFIED BY etl#t0pread
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=pldbdco0024vm.bmwgroup.net)(PORT=1595))
(CONNECT_DATA=(SID=dcodb))
)';
Related
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.
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.
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:
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?
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
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
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.
I am unable to create a user in oracle 19c and test the connectivity. Please see the steps that i had followed in the image link.
You need to use a connection string that points to the container that you created the user in. If you don’t have an entry in your tnsnames.ora already then create one for your orclpdb PDB (there’ll be a default service with the same name as your container name), then refer to it in your connection command.
Currently I am trying to understand how can two databases communicate to each other (for instance: get data from one to another).
Detailed description
I have two Oracle databases, one on Windows and latter on Oracle VirtualBox. On Windows DB I have one user (PAI) with single table called TESTME. On VirtualBox, only user (PAI_VB) was created. Now, I want to display the content of the TESTME table from SQL Developer from VB.
I have done
I want to display table TESTME using LINK statement:
CREATE DATABASE LINK LINK_TO_PAI
CONNECT TO PAI IDENTIFIED BY PAI
USING 'DESCRIPTION = (ADDRESS=(PROTOCOL=TCP)(HOST=myIP)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=XE))';
Note: data from 'DESCRIPTION' section were taken from tnsname.ora file on Windows.
Having that, via following query I will manage to display table:
SELECT * FROM PAI.TESTME#LINK_TO_PAI;
Unfortunately, it does not work.
Error from console
ORA-12154: TNS:could not resolve the connect identifier specified
12154. 00000 - "TNS:could not resolve the connect identifier specified"
*Cause: A connection to a database or other service was requested using
a connect identifier, and the connect identifier specified could not
be resolved into a connect descriptor using one of the naming methods
configured. For example, if the type of connect identifier used was a
net service name then the net service name could not be found in a
naming method repository, or the repository could not be
located or reached.
*Action:
- If you are using local naming (TNSNAMES.ORA file):
- Make sure that "TNSNAMES" is listed as one of the values of the
NAMES.DIRECTORY_PATH parameter in the Oracle Net profile
Questions
Could you please propose solution to my problem (I know that in *Action section there is a hint but still I cannot solve it).
Maybe, you could introduce me another way to make communication between two databases possible.
EDIT
I managed to connect from my VB machine to one on Win10 via SQLDeveloper and SQLPlus. Unfortunately, using Oracle LINK I can not access data from database.
SOLVED !!
I managed to solve my issue. The problem laid in LINK. Since following part:
'DESCRIPTION = (ADDRESS=(PROTOCOL=TCP)(HOST=myIP)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=XE))'
was inside tnsnames.ora file i should define my link as follows:
CREATE DATABASE LINK LINK_TO_PAI
CONNECT TO PAI IDENTIFIED BY PAI
USING 'xe';
After that minor change, I was able to freely us LINK in my example. Cheers :)
Here's what you need to have for a working database link:
Network connectivity between the two hosts.
Oracle Listener process running on the host you want to connect to.
Correct TNS entry while creating the link.
Correct username and password to connect to the remote database.
The TNS-12154 error you're getting means the database running on the virtual host can't get to XE's listener using the description you gave it.
Make sure you're using the correct IP address when trying to connect to your Windows host from your virtual machine.
Run tnsping from your virtual environment to see if it can get to the Windows host listener.
tnsping 'DESCRIPTION = (ADDRESS=(PROTOCOL=TCP)(HOST=your_windows_host_ip_from_step_1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE))'
or just tnsping XE if you have the TNS entry stored as XE in tnsnames.ora file on your virtual machine.
See also: Oracle documentation — Testing Connections.
Once you get OK response from tnsping try connecting to XE with sqlplus (sqlplus PAI/PAI#XE) or via SQL Developer running on the virtual host. If you can connect that way your database link should also work with the same TNS entry.
This is a tricky part of oracle because there are a number of diverent ways to make a connection.
I suggest that you begin to make sure that you have a tnsnames.ora file both on windows and in your virtualbox environment. What os are you running in VirtualBox by the way?
In both tnsnames.ora files both databases should be named. Easiest to make them identical.
Then connect with sql*plus from windows to your database in VirtualBox and from VirtualBox to your database on Windows.
Just to make sure your network and tns config are OK.
If this works recreate your db-link with the servce alias from tnsnames after using. This should work.
I am currently accessing/connecting to a remote database through VPN and I have no issues querying on the remote database. I want to create a db-link to connect my local db to the remote database in order to join certain tables. Sadly, I am getting error ORA-12545.
This is my db-link code:
CREATE DATABASE LINK DB_LINK
CONNECT TO REMOTE_USER_NAME
IDENTIFIED BY PASSWORD
USING '(DESCRIPTION=(CONNECT_DATA=(SID=test_SID))(ADDRESS=(PROTOCOL=TCP)(HOST=HOST_NAME.com)(PORT=1521)))'
I don't have an Oracle client installed on my machine so I am using the full description. There are no issue accessing both our db and the remote db without an Oracle client installed so I assume this is not the problem.
My ping to the remote address returned TTL expired in transit even though the VPN is connected. This seems a bit weird but I am not entirely sure if this is the problem.
I must be missing a crucial step. Any advice is appreciated.
I need to connect to a remote Oracle database using SQL Developer. I tried to create a new connection and I would like to know what exactly is A SID? Is it a parameter I need to check in my Oracle database?
SID (System ID) is the name of the database you are connecting to. A server can host multiple databases, so you need to specify the name.
See also: http://www.orafaq.com/wiki/ORACLE_SID
You can get it like this, once you're connected, but given the situation, that might not be very helpful. :D
select sys_context('userenv', 'instance_name') from dual
SID = Instance name as defined at instance creation on the database server.
On the database server, check the tnsnames.ora file:
SERVICE_NAME=
or
SID=