Skip to main content

Database links without TNSNAMES.ora

So, you step a test database on another server, and you don't want to wait for PUPPET1 to push out an update to your managed TNSNAMES.ora file with the database connection information. So how to you create a database link?
The short answer can be summed up like so: "Don't overthink the problem." Normally we create database links like so:

SQL> create database link devdb connect to scott identified by tiger using 'DEVDB'; 

 where DEVDB is an entry in your TNSNAMES.ora file. In the absence of such entries, a close approximation of the TNSNAMES.ora entry so we have this instead:

SQL> create database link devdb connect to scott identified by tiger using '(DESCRIPTION = (ADDRESS= (PROTOCOL=TCP)(HOST=devhost.domain.com)(PORT=1521))(CONNECT_DATA=(SID=DEVDB)))';


1 because you manage TNSNAMES files with a configuration tool, like Puppet, right? RIGHT!

Comments