Oracle's DB Link

Source: Internet
Author: User
Tags connect oracle database

Links between databases are built on database link. To create a DB link, you must first set up the link string on each database server.

1, configure TNS, $ORACLE _home/network/admin/tnsname.ora

10gstandby =

(DESCRIPTION =

(address = (PROTOCOL = TCP) (HOST = hfcc-kf-3068) (PORT = 1522))

(Connect_data =

(SERVER = dedicated)

(service_name = 10gstandby)

2, create a database link,

Create Public database link Db_link_name connect to targetdatabaseusername identified by Targetdatabasepassword using ' Tar Getdatabasesidname ';

Note: Targetdatabasesidname the database connection string defined inside the Tnsnames.ora file on the host where the Oracle database resides.

Sql>create Public Database link DVD connect to system identified by system using ' orcl10g ';

or use:

Create Public database link Link_name

Connect to USER identified by PWD

Using ' (DESCRIPTION =

(Address_list =

(address = (PROTOCOL = TCP) (HOST = 192.168.1.1) (PORT = 1521))

(Connect_data =

(service_name = ORCL)

)';

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

We created a link DVD with the system user and orcl10g database, and we queried the DVD data:

Sql>select * from All_users@dvd;

This allows the local and remote data to be processed as a whole.

3, to establish synonyms, in order to make more transparent about distributed operations, the Oracle database has synonyms for objects synonym

Sql>create synonym syntest for all_users@dvd;

So we can use Syntest to replace the Distributed link operation All_users@dvd with @ symbol;

4, see all the database links:

Sql>select owner,object_name from dba_objects where object_type= ' DATABASE LINK ';

5. View database connection

Sql> Select owner, db_link from Dba_db_links;

Ower Db_link

Public DVD. Regress. Rdbms. DEV. US. Oracle.com

6. Delete database connection

First view the database connection from step 5th to get the name of the Db_link

Sql>drop Public Database link DVD. Regress. Rdbms. DEV. US. Oracle.com

Database connection has been discarded

51cto Blog Oracle Little Bastard

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.