Get the App
SLTechnology News&Howtos  ›  Database  › 

Example of oracle method for creating dblink

Shulou Source: shulou.com Published: 2022-06-01 03:05:58 10月02日 Update

1. Application scenarios:

There are two databases, one is nc650115, the other is nc56, and now you want to connect to nc56 in nc650115 through dblink.

two。 First check in nc650115 to see if you have permission to create dblink. Execute in nc650115

Select * from user_sys_privs where privilege like upper ('% DATABASE LINK%')

Permissions are displayed as follows

Do not have permission to authorize in sys

Grant CREATE PUBLIC DATABASE LINK,DROP PUBLIC DATABASE LINK to nc650115

3. Create a dblink under nc650115.

Create public database link NC65DBLINK connect to nc56 identified by nc56 using'(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.17.254) (PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = orcl)'

Where NC65DBLINK is the name of dblink

Connect to requires the user name of the connection, identified by password

HOST= requires ip to connect to the database

SERVICE_NAME= database instance

Check to see if the creation is successful

Select * from dba_db_links;select owner,object_name from dba_objects where object_type='DATABASE LINK';-- query time is long

4. Action:

Query the data in nc56

Select * from crm_bd_building@NC65DBLINK

Delete dblink

Drop public database link NC65DBLINK

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Tags: Data database permissions query success two content name scenario instance password that is time user name user name learning help application support method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Huawei macOS Xiaomi MySQL