In this article I’ll describe how to create to remote Oracle database, because there are no clear description for that. There are two ways to achieve it: throught link, i.e. you will be able to execute query like select * from table@db or directly connecting to remote database with sqlplus command sqlplus l/p@db.

This article is for Windows Server 2012, but it could works with other Windows versions and with Linux, if you could locate files on your own.

Note: even if you want to create link @db for SQL you should follow both steps, because links are using SID from tnsnames.ora.

Step 1 — create sqlplus connection

First of all you’ll need to create record in your tnsnames.ora located in PathToOracle\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN and you should add connection string:

Host could be localhost or ip address of the remote database. Now you just type sqlplus l/p@db... and recieve error ORA-12638.

You should open file sqlnet.ora in the same directory as tnsnames and comment line: #SQLNET.AUTHENTICATION_SERVICES= (NTS). This fix error for me, but this error could be caused be many reasons.

Step 2 — Creating link

But I need to connect to database and its tables from sql console of the IDEA or SQL Developer, but I’ve recievening error ORA-02019. After some googling I found that I should create link. It’s obvious for expirienced Oracle SQL developers, but I’m not DBA and have low expirience, so I’ve forgot about it.

Following command in sqlplus will cteate link:

If you’ve done mistake, then you could drop link using following:

If you create link using public keyword then you should delete it using it too. I don't know why so strict policy for commands, but I took it for granted.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store