Create Database Links from Other Databases to Autonomous Database

You can create database links from another Oracle Database to an Autonomous Database.

To create database links to a database do the following:

  1. Download your Autonomous Database wallet. See Download Client Credentials (Wallets) for more information.
  2. Upload the wallet to the database instance where you want to create the link to the Autonomous Database.
  3. Unzip the Autonomous Database wallet:

    Note:

    The wallet file, along with the Database user ID and password provide access to data in your Autonomous Database. Store wallet files in a secure location. Share wallet files only with authorized users.
    [oracle@sys1 ~]$ cd/u01/targetwallet
    [oracle@sys1 targetwallet]$ unzip Wallet_name1.zip
            Archive: Wallet_name1.zip  
              inflating: cwallet.sso
              inflating: tnsnames.ora    
              inflating: truststore.jks            
              inflating: ojdbc.properties          
              inflating: sqlnet.ora
              inflating: ewallet.p12
              inflating: keystore.jks
    
  4. Set GLOBAL_NAMES to FALSE.
    SQL> ALTER SYSTEM SET GLOBAL_NAMES = FALSE;
     
    System altered.
    
    SQL> SHOW PARAMETER GLOBAL_NAMES
    NAME                     TYPE        VALUE
    ----------------------   ----------- -----------
    global_names             boolean     FALSE
    

    Set GLOBAL_NAMES to FALSE to use a database link name without checking that the name is different than the remote database name.When GLOBAL_NAMES, is set to TRUE, the database requires the database link to have the same name as the database to which it connects. See GLOBAL_NAMES for more information.

  5. Create the database link to the target Autonomous Database. Note that the security path includes my_wallet_directory; the path where you unzip the Autonomous Database wallet.
    CREATE DATABASE LINK ADBLINK 
       CONNECT TO NAME1 IDENTIFIED BY ************ 
       USING
    '(description=(retry_count=20)(retry_delay=3)
         (address=(protocol=tcps)(port=1522)(host=example1.oraclecloud.com))     
         (connect_data=(service_name=example2_high.adb.oraclecloud.com))     
         (security=(my_wallet_directory=/u01/targetwallet)
            (ssl_server_dn_match=true)
            (ssl_server_cert_dn="CN=example2.oraclecloud.com,OU=Oracle
              BMCS US,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))';
    
    Database link created.
  6. Use the database link you created to access data on the target database (your Autonomous Database instance in this case):

    For example:

    SELECT * FROM employees@ADBLINK;
    

To list the database links, use the ALL_DB_LINKS view. See ALL_DB_LINKS for more information.

For additional information, see: