Dblink for data table access between different users

Source: Internet
Author: User

1, Dblink

1, create DBLINK, if you create a DBLINK under User A, the name is Test_dblink; To operate the table data under the GCFR_33 user, etc.,

Then the SQL to query the table data will be added Dblink. The following is the statement that creates the Dblink:

--droppublicdatabase  link test_dblink; --  Createpublicdatabaseto '  (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = ORCL)))';

2, if gcfr_33 This user has gcfr_t_vch this table, but a user does not have, want to directly access GCFR_T_VCH, then the query statement as follows:

Select COUNT (*) from [email protected]_dblink;

2. Synonym synonym

1, the creation of synonyms, for the above Dblink, can create a corresponding synonym, so that at the time of the query can be directly select 1 from the synonym on the line, the SQL statement is as follows:

Create or Replace synonym Test_synonm    for Gcfr_t_vch@TEST_DBLINK;

2, the creation of synonyms and then query Gcfr_t_vch table, it is very simple

Select *  from Test_synonm;

A cursory description, followed by further additions

Dblink for data table access between different users

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.