Query data between two oracleusers

Source: Internet
Author: User

For example, there are two users in oracle, sysdb and hellodb, and table hello under sysdb. There is a baby table in hellodb. Now I want to use the hellodb User table baby in oracle user sysdb. select * from baby @ link_hellodb www.2cto.com ====================== generally, imp exp is used to back up and import data to the database. However, in some cases, it is necessary to obtain data from two databases flexibly. Here I use the dblink method of or1c.. First, the listener tnsnames. ora file can be connected to the database where you want to create dblink remotely. -- Create dblink MANAGER as the remote database Username password as the remote database password, orcl as the listener connection name www.2cto.com SQL code 1. create database link DDD. REGRESS. RDBMS. DEV. US. ORACLE. COM 2. connect to MANAGER identified by password 3. using 'orcl '; create database link DDD. REGRESS. RDBMS. DEV. US. ORACLE. COM connect to MANAGER identified by password using 'orcl '; in this way, you can connect to the orcl database to obtain the data of each table flexibly. Both databases have tb_demo tables. This is the table to be inserted. The SQL statement for querying data is the same as that for local databases, but @ DDD is added later. REGRESS. RDBMS. DEV. US. ORACLE. COM is equivalent to the remote database connected by dblink. SQL code 1. insert into tb_demo 2. SELECT * FROM tb_demo@DDD.REGRESS.RDBMS.DEV.US.ORACLE.COM 3. where iyear = 2011 4. and imonth = 8 and flag = 0

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.