Oracle SQL Developer - no ocijdbc12 in java.library.path - oracle

I've a virtual machine, the latest version of Oracle SQL Developer (kit with JDK 8 included - although I installed it separately anyway), and there's a 11G Oracle Database.
My TNS file on my machine does not have the list of all databases, instead it it is as per below (there are multiple databases):
> CONN_DATA = (DESCRIPTION =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP)(HOST = HOSTNAME)(PORT = XXXX))
> )
> (CONNECT_DATA =
> (SERVICE_NAME = Bob)
> ) )
I tried connecting to one of the databases using multiple methods.
If I choose the TNS conn type using the dbname as the connect identifier, I get no ocijdbc12 in
java.library.path. I went to the advanced settings, and manually pointed to my TNS file just in case.
If I choose the Basic connection type, ORCL as
service name (also tried the database as SID), localhost as hostname or the name of my database, it
fails to resolve the connection.
Also tried to use TNS conn type and Network identifier using "CONN_DATA"
I don't have a clue on what to do, similar issues seems to resolve on an environmental variable issue on my machine, but I'm unsure on how to confirm that.

Even though this question is rather old, I had the same issue.
The reason was completely different.
I did not have the network aliases set correctly.
Go to Preferences - Database - Advanced and set the path to TNSNames Directory.

I've solved this issue by using the same path as Gunnar Bernstein.
In SQL Developer "Outils > Préférence > Avancé > Répertoire tnsnames" (yes, i'm French. That' a ;) for french DBA's)
My old tnsnames path was "C:\oracle"
I updated it to the right path "c:\oracle\product\10.2.0\db_1\NETWORK\ADMIN". And, taaataaammmm "Status : success".

the solution is around setting the correct oracle client and tns names directory only
just posting this answer to help others - there might be different directories structure for the same
go to tools --> preference -->database --> advanced
in the lower section
check the box of --> Use oracle client
then click on --> configures
if your oracle client is already installed correctly
you will see client type -->oracle_home
if you don't --> select instant client
mostly client installation directory will be
for oracle 11g
C:\Apps\oracle\Clients\112_64
and
for oracle 12c
C:\Apps\oracle\Clients\12102_64
the _64 represents 64 bit client. if your client is 32 bit --> select _32 folder
then in the tns names directory - put this
C:\Apps\oracle\network\admin
if this is not the tnsnames directory for you --> try to find
find this filename on your computer --> tnsnames.ora

I also found that if you are using a tnsnames.ora file that is on a group drive - if windows "thinks" your not connected to the drives then you will also get this error.
Just open windows explorer and "reconnect" to the group drive and this will resolve the issue.

Resolved :
The SQL Developer was looking for TNS Names file in the location (c:\users<username>). I placed the file at that location and restarted the SQL Developer and it worked.

Related

BizTalk WCF ORA-12154: TNS:could not resolve the connect identifier specified

I have a BizTalk 2013r2 app with a WCF-Oracle send port running under a 32bit host.
When run in my test environment it works fine. However, on my dev box I get the following error:
"ORA-12154: TNS:could not resolve the connect identifier specified"
The address set on the send port is "oracledb://test_godw_lincoln/" . My understanding is that the ip address and port should be resolved from the local tnsnames.ora file. I have a system environment variable for TNS_ADMIN set correctly:
From a command prompt, if I enter "set tns_admin" then the following is displayed:
TNS_ADMIN=C:\app\biztalk.admin\product\12.1.0\client_1\Network\Admin
If I open the file "C:\app\biztalk.admin\product\12.1.0\client_1\Network\Admin\tnsnames.ora" then I see the following entry:
test_godw_lincoln =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xx.xxx.xx.xx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = gotest)
)
)
(I've substituted the real IP address)
If I open Sql Developer on the same dev vm then I am able to open a connection to the required database using the tnsname entry "test_godw_lincoln":
I realise that Oracle can be addressed from the adaptor without using tnsnames.ora but I understand that if ambient transactions are to be used (the app does make use of them) then the address must be via tnsnames.ora
Any suggestions as to how I can track down the cause of the problem with this particular VM?
Re question from Dmitir - the registry is empty:
Re suggestion from Felix - I am able to create the connection on the same dev server from Visual Studio server explorer:
However, if I try to connect from the "Consume Adapter Service" wizard (add generated items) then I get the ORA-12154 error:
After all this changes, have you restarted your host instances?
Try also to connect without a tnsname, with connection string in this format : host:port/database_name
This came down to a mysterious problem with the tnsnames.ora file. The suggestion from #Hichamveo helped but rather that try my bad tnsnames.ora file on a working environment, I copied the tnsnames file from an environment that worked. I found that the dev VM then started working - so I knew the problem was with the tnsnames.ora file rather than ODAC / ODP.Net assemblies.
I then spent quite some time trying to figure out exactly what was broken with the bad tnsnames file. I used file compare tools and tried a linter at: http://brantwills.github.io/tns-check/ but these showed no problems.

XML DB Login on APEX 4.2

The Issue With XML-DB and Apex:
I just finished the Oracle APEX installation (I'm using Oracle 11g Express Edition and APEX 4.02) i deinstalled the pre-existent version of APEX and installed the 4.20 one, and when I try to connect to the main admin page at:
http://HOST:PORT/apex/apex_admin
I'm getting the annoying XDB login popup. I Installed it on many other Servers but I never get username and pwd for XDB asked.
What I've Done So Far:
Searching on the web I found and tried this idea:
XDB Server Configuration Change
Tried running this command on the database server:
EXEC DBMS_XDB.SETHTTPPORT(0);
Nothing happened, except that I got a 404 page error.
I'm really in need of your help guys...
Thanks in advance y'all!
Oracle Version: Oracle 11g EXPRESS EDITION (XE)
APEX Version: 4.02 (pre-installed)
SOLUTIONS:
There are two solutions, depending on the case you are...
NOTE: Run all the sql scripts connected with "sys as sysdba" to avoid any problem with permission.
You are on my case, deinstalled the pre-installed APEX (4.02) and want to install a brand new version:
Move the existing "apex" dir (you can find it in your $Oracle_Home) to "apex_old" and unzip here the new "apex" directory.
Launch #apexins.sql APEX APEX TEMP /i/ to install Apex (use "APEX" as your tablespaces instead of the default "SYSAUX", to prevent any kinda conflict with the old one).
Once done with the "apexins", run #apex_epg_config.sql [_Directory you unzip Apex_] to reload the image.
If is not already, set the port for APEX launching EXEC DBMS_XDB.SETHTTPPORT(xxxx);
xxxx = stands for the port you want to set, like the default 8080 or another like 7777, 8081, 8082, ecc... Just do NOT choose 1521 (listener port) or 0 (that disable APEX).
Now you have reinstalled APEX and you should be able to access to the "INTERNAL" workspace.
You only want to upgrade your pre-installed APEX version from 4.02 to the latest version:
Move the existing "apex" dir (you can find it in your $Oracle_Home) to "apex_old". Then unzip here the new "apex" directory.
Run #apexins SYSAUX SYSAUX TEMP /i/ to launch the installation/update.
Once finished, launch #apxldimg.sql [_Directory you unzip apex_] to reload the image, it will take a few minutes depending on the machine you are working on.
Now you should be able to access to your INTERNAL workspace.
Hope this could help anyone landing here, looking for a solution to this problem.
Troubleshooting a New Installation of Oracle Application Express (APEX)
EDIT-The situation so far: (In response to recently posted comments)
The OP uninstalled the original instance of APEX using the script apxremov.sql which comes within the apex directory of the Oracle database installation.
This should be ok, provided that you have installed or re-installed some version of APEX in its place. The set up is a more complicated when handling it this way, but with a little patience you should eventually have the same results.
Re-Enable APEX's Broadcast Ports
The command you ran:
EXEC DBMS_XDB.SETHTTPPORT(0);
Just closed access to Apex on your listener to all ports. "0" is used for maintenance mode when upgrading to prevent any users from being connected during maintenance procedures.
The default if you had not changed it is: 8080
You can change it to anything (non-zero of course) by using the same command and selecting a value that doesn't collide with other active port assignments (such as 1521) etc.
In the future, if you don't know what port was assigned, the command:
SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
will jog your memory.
Review the APEX System Configuration
I am referencing the configuration settings from my home system, which is working at this time. These are the specifications:
Host OS: Windows Vista Home Basic
Database: Oracle XE (Express Edition) 11.2.0.2
Apex Installation: 4.20 (Original with XE install)
If you haven't done so in a while, restart your machine to see if any of the services restart properly. Try connecting to Apex through a browser pointing to "localhost:xxxx"
Set your HTTP port to your chosen location.
...Just for comparison, accessing even a working install using the wrong path can get the error you've reported. Such as:
http://localhost:xxxx/some-other/path
Accessing the Oracle Listener Using the Wrong Path
You'll have to check what option you have chosen with your server gateway (there is more than one). Some options: Oracle HTTP Gateway (the most current; I'm using that one), mod/plsql Gateway, etc. This may have an effect on your default, base pathway.
Testing the Oracle Listener Services
Check your listener.ora file under ../server/network/admin/... this is the listener.ora file on a working instance (my home pc):
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Glenn-PC)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
There is also a command-line utility: lsnrctl, which has a few options for checking the status of your "listener". There appears to be three in my install. One on port 1521 for the standard database access, one on port xxxx for what was defined for the XDB service, and another for something called "External Procs". If your settings look the same, lsnrctl has a command called "START" to get all the listener services running again. That might be a good lead for you.
Onward.

ORA-12560:TNS:Protocol adapter error [duplicate]

I Google[d] for this error ORA-12560: TNS:protocol adaptor error but not able to find the actual reason and how to solve this error ?
Can anyone tell me a perfect solution to solve login problem.
Go to the windows machine that hosts the Oracle database server
Go to Start -> Run -> Services.msc in Windows.
Locate OracleService < SID > (here OracleServiceORCL) and click on Start to start the oracle database service (if not already running)
Once it is up and running, from the command prompt run the following:
tnsping < tnsalias >
(tnsalias entry you can find it in tnsnames.ora file)
In my case I didn't have an OracleService (OracleServiceORCL) in Windows Services.msc as described in Bharathi's answer.
I executed this command:
C:\> ORADIM -NEW -SID ORCL
and then the OracleService called OracleServiceORCL just showed up and got started in Services.msc. Really nice.
Source: https://forums.oracle.com/forums/message.jspa?messageID=4044655#4044655
Seems like database is not up. It might be due to restarting machine and the instance is not set to autostart and it so not started munually after starting from services Screen.
Just goto Command prompt
Set Oracle SID
C:>set oracle_sid=ORCL
Now run Net start command.
C:>net start oracleserviceORCL
from command console, if you get this error you can avoid it by typing
c:\> sqlplus /nolog
then you can connect
SQL> conn user/pass #host:port/service
Add to the enviroment vars the following varibale and value to identify the place of the tnsnames.ora file:
TNS_ADMIN
C:\oracle\product\10.2.0\client_1\network\admin
In my case (for OracleExpress) the service was running, but I got this issue when trying to access the database via sqlplus without connection identifier:
sqlplus sys/mypassword as sysdba
To make it work I needed to add the connection identifier (XE for Oracle Express), so following command worked ok:
sqlplus sys/mypassword#XE as sysdba
If you still get ORA-12560, make sure you can ping the XE service. Use:
tnsping XE
And you should get OK message along with full connection string (tnsping command is located in oracle's installation dir: [oracle express installation dir]\app\oracle\product\11.2.0\server\bin). If you can not ping make sure your tnsnames.ora file is reachable for sqlplus. You might need to set TNS_ADMIN environment variable pointing to your ADMIN directory, where the file is located, for example:
TNS_ADMIN=[oracle express installation dir]\app\oracle\product\11.2.0\server\network\ADMIN
After searching alot got a simple way to solve it.
Just follow the steps.
Check status of your listener.
open command prompt and type lsnrctl status
You will get no listener.
Now open listener.ora file which is present in following directory: C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
Open that file and change the host parameter with you computer name
You can get your computer name by right click on My Computer and check you computer name, and replace host parameter with your computer name as follows:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Electron-PC)(PORT = 1521)
)
)
)
So here you can observe HOST = Electron-PC, which is my computer name.
Save the listener.ora file and again return to cammand propt
3.Type the following in command prompt lsnrctl start
This will start the OracleTNSListner.
you can check it in the service by opening services tab of Task Manager. if not started automatically you can start it.
Just this much and you are ready to work again on oracle.
Best of Luck.
Quite often this means that the listener hasn't started. Check the Services panel.
On Windows (as you are) another common cause is that the ORACLE_SID is not defined in the registry. Either edit the registry or set the ORACLE_SID in a CMD box. (Because you want to run sqlplusw.exe I suggest you edit the registry.)
I have solved the problem the easy way. My oracle was running just fine in the past. After I installed MS SQL Server was when I noticed this problem. I just uninstalled MS SQL Server on my machine then the problem was gone. Make sure you restart your computer after that. Now I can connect to Oracle database through SQLPlus again. My guess is that there's some conflict between the two. Hope this helps.
Another possible solution that just worked for me...considering I was using my local login as the dba permissions.
Follow the steps to get to Services. Right click on the instance and go to 'Log On'? (might not be the name but it's one of the tabs containing permissions). Change the settings to use LOCAL.
If none the above work, then try this :
Modify the LISTENER.ora (mine is found in : oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora) ==> add a custom listener that points to your database(SID), example my SID is XZ0301, so :
## Base XZ03001
SID_LIST_LISTENER_XZ03001=(SID_LIST=(SID_DESC=(ORACLE_HOME =
E:\oracle\product\11.2.0\dbhome_1)(SID_NAME= XZ03001)))
LISTENER_XZ03001=(DESCRIPTION_LIST=(ADDRESS=(PROTOCOL =
TCP)(HOST=MyComputerName)(PORT= 1521)))
DIAG_ADR_ENABLED_LISTENER_XZ03001=ON
ADR_BASE_LISTENER_XZ03001=E:\oracle
Restart your machine
For Windows 7, use the following to modify the LISTENER.ora:
- Go to Start > All Programs > Accessories
- Right click Notepad and then click Run as Administrator .
- File>open and navigate to the tnsnames.ora file.
- Make the changes then it should allow you to save
It really has worked on my machine. But instead of OracleServiceORCL I found OracleServiceXE.
Flow the flowing steps :
Edit your listener.ora and tnsnames.ora file in
$Oracle_home\product\11.2.0\client_1\NETWORK\ADMIN location
a. add listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C: [here c is oralce home directory]
b. add in tnsnames.ora file
SCHEMADEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dabase_ip)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SCHEMADEV)
)
)
Open command prompt and type
sqlplus username/passowrd#oracle_connection_alias
Example : username : your_database_username
password : Your_database_password
oracle_connection_alias : SCHEMADEV for above example.
Just to add up, follow the screenshot and choose local account to start if not selected. Then start the service.
You need to tell SQLPlus which database you want to log on to. Host String needs to be either a connection string or an alias configured in your TNSNames.ora file.
ORA-12560: TNS:erro de adaptador de protocolo
set Environment Variables: ORACLE_BASE, ORACLE_HOME, ORACLE_SID
make sure your user is part of ORACLE_GROUP_NAME (Windows)
make sure the file ORACLE_HOME/network/admin/sqlnet.ora is:
SQLNET.AUTHENTICATION_SERVICES = (NTS)
(Windows) Be carefull when you add a new Oracle client: adding a new path to the PATH env. variable can mess things up. The first entry in this variable makes a difference: certify that the sqlplus executable in the ORACLE_HOME (ORACLE_HOME/bin) comes first in the PATH env. variable.
I try 2 option:
You change service OracleService in Service Tab -> Running
Login with cmd command: sqlplus user_name/pass_word#orcl12C
Note: orcle12c -> name of OracleService name run in you laptop
Below fixes can be applied to resolve TNS 12560 error
Get Latest patch for SQL*NET client software
Set $ORACLE_HOME and $PATH variable (should be accessible for System user)
Check permissions on PC client
Check $TNS_ADMIN variable
Check if network has firewall or antivirus issues
Check if windows services Run >> Services.msc has OracleXE or OracleORCL service running
Check below link in case of net tracing error:
http://dba-oracle.com/t_sql_net_tracing.htm
In my case, (ORA-12560: TNS protocol adapter error)Issue cause of database connection issue like database, user name and password.
Once you got the issue. Initially you have to check connection details, after check the oracle service and further more.
I missed some connection details, So only i got TNS protocol adapter error,
I will changed the connection details, It would be working fine.

tnsping ping fails, even though I can successfully connect to database

In trying to establish connectivity from my workstation (actually, am seeing the same behavior on both WinXP32 and Win764 workstations) to an Oracle server, the first thing I always try is a tnsping. When I do so, this is what I get:
> C:\>tnsping MYDBNAME
>
> TNS Ping Utility for 32-bit Windows:
> Version 10.2.0.1.0 - Production on
> 25-JAN-2 011 15:03:35
>
> Copyright (c) 1997, 2005, Oracle. All
> rights reserved.
>
> Message 3511 not found; No message
> file for product=NETWORK,
> facility=TNSMessage 3512 not found;
> No message file for product=NETWORK,
> facility=TNSAttempting to contact
> (DESCRIPTION = (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP) (HOST =
> thisismyservername.com)(PORT = 1577)))
> (CONNECT_DATA = (SID = MYDBNAME)))
> Message 3509 not found; No message
> file for product=NETWORK, facility=TNS
So, as you can see, it is properly detecting my tnsnames file, and picks up the correct server address and port for the specified database, but the tnsping fails with 3511 and 3509 errors.
The strange part is, using sqlplus or Toad, from the same workstation, I can connect to that very same database successfully.
Can anyone explain what is happening here?
FWIW:
The ORACLE_HOME system environment variable (and any other oracle environment variables) is not set.
Update
The ORACLE_HOME environment variable does not necessarily HAVE to be set, it seems to depend per machine somehow. My particular issue was: Oracle 10g has/had a known defect in that tnsping.exe simply didn't work. There is a patch
I believe this can happen when your ORACLE_HOME environment variable is not set properly. tnsping is still available from the PATH, but it can't find its message files. What does echo %ORACLE_HOME% show, and where is the Oracle client actually installed?
This wouldn't necessarily have any effect on access from Toad as it doesn't need to access ORACLE_HOME directly; you may have given a full connection string, or it may be able to pick up a service name if TNS_ADMIN is set.
Edit
You might also have several Oracle products that are interfering with each other. If so try going to Start->All programs->Oracle Installation Products->Home Selector and picking the one that is related to the tnsping you're executing. (Actually this is for the 9i client; I think for 10g you might need to use the universal installer, changing via Installed Products->Environment, but can't check).
In addition to setting the ORACLE_HOME variable you should also make sure that the c:\orant\bin; entry comes before any other path entries to other oracle clients you may have installed.

Oracle (0x80004005)ORA-12154: TNS:could not resolve the connect identifier

I'm trying to connect to an oracle db from an ASP classic application, however I keep running into the ORA-12154 error.
TNSNAMES.ORA is configured properly
DBSOURCE.A.B.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = C.D.B.com)(PORT = 1231))
)
(CONNECT_DATA =
(SERVICE_NAME = DBSOURCE)
)
)
I can TNSPING
C:\Documents and Settings\USERID.A>tnsping DBSOURCE
TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 09-MAR-2
011 09:12:31
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = C.D.B.com)(PORT = 1231))) (CONNECT_DATA = (SERVIC
E_NAME = DBSOURCE)))
OK (30 msec)
I can create an ODBC connection and I've tested the connection which is successful.
I can connect to the oracle db through toad.
I've checked my sqlnet.ora file
NAMES.DEFAULT_DOMAIN = A.B.com
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I've also checked that the TNSNAMES.ORA as one of my system paths.
I can connect to the DB with SQLPLUS
Here is the code that throws the error
dim CnnStr
Set Cnn = Server.CreateObject("ADODB.Connection")
CnnStr="Provider=MSDAORA.1;Password=pass;User ID=user;Data Source=DBSOURCE"
Cnn.Open CnnStr
I am running windows XP Pro 32bit SP3
I've tested this on a co-workers machine and the asp app has no issues, am I missing a configuration somewhere or did I mess up my config?
Thanks for the help everyone!
It seems all the settings have been checked but here is my suggestions for some trouble shooting:
How about restrictions on the account IIS is running under? Does it have the file permissions to read the TNSNAMES? Have you tried to give the user more rights. Even run IIS with Local As System Account? Remember to put it back the way it was.
You are sure there is not 3rd party app such anti virus or firewall that could influence / block access. (Disable them to test but do not forget to re-enable :)
(What did you finally do to solve it?)
"this works on a co-worker machine but
not mine."
ORA-12154 is usually a configuration issue, and it would certainly seem to be so in your case. The short answer is to compare your machine with your colleague's one and figure out what the difference is.
Things to check include:
the TNANAMES.ORA file
the SQLNET.ORA file
the LISTENER.ORA file (if you're using a local database)
Do you have multiple Oracle homes? Check that IIS doesn't point to the other ORA_HOME (and thereby not finding your tnsnames.ora entry).
I'm not very familiar with IIS configuration, so I would test this by adding the TNS entry to all tnsnames.ora on my PC.
If you are running a 64-bit OS and oracle 10 try installing all the patches for oracle.
Something similar happened to me, SQL plus and all else worked, except my .NET program.
I was running a .Net program out of the "Program files (x86)" folder. Installing patches fixed it.
The likely problem is the lack of read permission upon the Oracle directories by the User IIS is running-as.
As #Derick says, temporarily set the permissions wide-open on the $ORACLE_HOME directory (Everyone = Full Control), restart IIS, and test. When that works, give the IIS User read permission against that directory.
You can also confirm this issue using Process Monitor from Microsoft SysInternals, and seeing the failure message during the CreateFile(...) API call to open the DLLs or read the TNSNAMES.ORA file. Given the way temporary files work when selecting through cursors, you may also need to give the IIS user write permissions into some directories.
Try setting the value of the environment variable TNS_ADMIN on the machine with the problem to /network/admin (or wherever your tnsnames.ora file lives) and see if that helps.
I had the similar problem and found a simple solution. You don't have to modify any config files. Hope this can help you:
CREATE DATABASE LINK server2_db
CONNECT TO dbuser IDENTIFIED BY pwd USING
'(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server_2)(PORT = port_num))
)
(CONNECT_DATA =
(SERVICE_NAME = server2_db)
)
)';
The solution is from here:http://oraclequirks.blogspot.com/2008/11/ora-12154-tnscould-not-resolve-service.html

Resources