Oracle Learning (15): Distributed Database

Source: Internet
Author: User
Tags dname


--The independence of distributed database: the independence of distributed data means that the user doesn't have to care about how the data is segmented and stored, just care about what data he needs. --Local operation sql> sqlplus scott/tiger--remote operation sql> sqlplus scott/[email protected]:1521/orcl--distributed Operation Sql>-- Create a database link L2 (requires permissions);sql>--REMOTEORCL service naming (configured in Net Manager): Configure the Connection protocol, hostname (IP address), port number, and so on for the database that is connected to the remote server, sql> the CREATE database Link L2 Connect to Scott identified by Tiger using ' REMOTEORCL '; Sql>--Execute query in distributed database Sql> select Ename,dname 2 from dept, [email protected]--query EMP table 3 via database link L2 where emp.dept No=dept.deptno; Sql>--creating synonyms for [email protected] sql> create synonym remoteemp for [email protected]; Sql>--Querying with synonyms sql> select Ename,dname 2 from dept, remoteemp--using synonyms 3 where remoteemp.deptno=dept.deptno;creat E View Empasselect * FROM [email protected]--links to Shanghai Unionselect * from [email protected]; --Links to Beijing select * from EMP; --The database query from Shanghai and Beijing--the cross-boundary point update of distributed database: snapshot; trigger;--Snapshot: Defines an asynchronous copy of the Snapshot Maintenance relationship table (created on the backup side)--a table that refreshes the replica for a specified time after the primary table has been modified, but frequently queries tables create Snapshot emp--Create snapshot refresh start with sysdate--first update next next_day (sysdate, ' Monday ')--Next Update time as SELECT * FROM [email protected];--update-trigger (created on primary database) Sql>--  Synchronous updating of data with triggers (the following code implements only the pay Update trigger) sql> Create or replace trigger Syncsal 2 after update 3 on EMP 4 for each row 5  Begin 6 Update remoteemp set sal=:new.sal where Empno=:new.empno;  7 8 End; 9/


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.