.
What are the steps to create dblink? Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.8 Information in this document applies to any platform
Solution Steps to create dblink: 1)If you are creating public dblink, you will need a user with the following permissions: create public database link drop public database link If you are creating dblink, you will need a user with the following permission: create database link 2) Check the value of global_names If the value of the GLOBAL_NAMES initialization parameter is TRUE, then the database link must have the same name as the database to which it connects. Please note: global_names is required to be TRUE for replication. SQL> set linesize 121 SQL> col name format a30 SQL> col value format a30 SQL> SELECT name, value FROM gv$parameter WHERE name ='global_names'; 3) Determine database global name: The GLOBAL_NAME is made up of the db_name and the db_domain, and the first element (before the first . in a global name is treated as the 'db_name' and the rest of the global_name is treated as the 'db_domain'. To find db_domain and db_name: SQL> set linesize 121 SQL> col name format a30 SQL> col value format a30 SQL> SELECT name, value FROM gv$parameter WHERE name IN ('db_name', 'db_domain'); If db_domain is not set, it defaults to REGRESS.RDBMS.DEV.US.ORACLE, Please refer to below note
for more information: Note 578668.1 When Creating A Database Using DBCA, GLOBAL_NAME Includes The Domain Suffix REGRESS.RDBMS.DEV.US.ORACLE.COM By Default To find global_Name: SQL> col value$ format a40 SQL> col comment$ format a40 SQL> SELECT * FROM props$ WHERE name LIKE '%GLOBAL%'; If you want you can change it using: ALTER DATABASE RENAME GLOBAL_NAME TO ; SQL> SELECT * FROM props$ WHERE name LIKE '%GLOBAL%'; 3) Create the database link: SQL> CREATE [SHARED] [PUBLIC] DATABASE LINK CONNECT TO CURRENT_USER USING '<service_name>'; Please note that: * The single quotes around the service name are mandatory * The service name used above must be in the TNSNAMES.ORA file on the server. If it does not exist you can create one like below: connection_link = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ) ) ) 4) Make sure that the database link is created: SQL> set linesize 121 SQL> col db_link format a20 SQL> col username format a20 SQL> col password format a20
SQL> col host format a20 SQL> SELECT * FROM user_db_links; 5) Make sure that the database link woks fine: