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