You can
create database links to an Autonomous Database from
an Oracle database that is not an Autonomous Database.
For example from an on-premise Oracle database to an Autonomous Database
-
Supported Oracle Database versions for database links where the source is
an Oracle Database and the target is an Autonomous Database instance are: 19.2 (or later), 21 (base release or later).
-
If you are using database links between Autonomous Database and other Oracle Databases,
you might need to apply Patch 33843368 on the Oracle Database that is not an Autonomous Database. This applies to cases where
the Autonomous Database instance is either the
source or the target of the database link.
See My Oracle Support Knowledge Base: Patch Requirement For Database Links
Between ADB-S And Other Oracle Databases(Doc ID 2874244.1) for further
details.
To create database links to an Autonomous Database do the following:
- Download your Autonomous Database wallet. See
Download Client Credentials (Wallets) for more information.
- Upload the wallet to the database instance where you want to create the link to the Autonomous Database.
- 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
- 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.
- 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)))';
Database link created.
- 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: