oracle 如何在两个oracle实例之间创建数据库链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13267218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create a DB link between two oracle instances
提问by Arunkumar
How to create a DB link between two Oracle instances. Let's say A and B are two instances. I want to access the data in instance B from the instance A.
如何在两个 Oracle 实例之间创建数据库链接。假设 A 和 B 是两个实例。我想从实例 A 访问实例 B 中的数据。
回答by anandchaugule
If you want to access the data in instance B from the instance A. Then this is the query, you can edit your respective credential.
如果您想从实例 A 访问实例 B 中的数据。那么这就是查询,您可以编辑各自的凭据。
CREATE DATABASE LINK dblink_passport
CONNECT TO xxusernamexx IDENTIFIED BY xxpasswordxx
USING
'(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=xxipaddrxx / xxhostxx )
(PORT=xxportxx))
(CONNECT_DATA=
(SID=xxsidxx)))';
After executing this query access table
执行此查询访问表后
SELECT * FROM tablename@dblink_passport;
You can perform any operation DML, DDL, DQL
您可以执行任何操作 DML、DDL、DQL
回答by daywalker_ora
as a simple example:
作为一个简单的例子:
CREATE DATABASE LINK _dblink_name_ CONNECT TO _username_ IDENTIFIED BY _passwd_ USING '$_ORACLE_SID_'
for more info: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm
更多信息:http: //docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm
回答by ChandraBhan Singh
Creation of DB Link
创建数据库链接
CREATE DATABASE LINK dblinkname
CONNECT TO $usename
IDENTIFIED BY $password
USING '$sid';
(Note: sid is being passed between single quotes above. )
(注意:sid 在上面的单引号之间传递。)
Example Queries for above DB Link
上述数据库链接的示例查询
select * from tableA@dblinkname;
insert into tableA(select * from tableA@dblinkname);
回答by ARGStackOvaFlo
After creating the DB link, if the two instances are present in two different databases, then you need to setup a TNS entry on the A machine so that it resolve B. check out here
创建数据库链接后,如果两个实例存在于两个不同的数据库中,那么您需要在 A 机器上设置一个 TNS 条目,以便它解析 B。请查看这里
回答by Talha Ansar
Create database link NAME connect to USERNAME identified by PASSWORD using 'SID';
创建数据库链接 NAME 连接到使用“SID”的 PASSWORD 标识的 USERNAME;
Specify SHARED to use a single network connection to create a public database link that can be shared among multiple users. If you specify SHARED, you must also specify the dblink_authentication clause.
指定 SHARED 以使用单个网络连接创建可在多个用户之间共享的公共数据库链接。如果指定 SHARED,则还必须指定 dblink_authentication 子句。
Specify PUBLIC to create a public database link available to all users. If you omit this clause, the database link is private and is available only to you.
指定 PUBLIC 以创建可供所有用户使用的公共数据库链接。如果省略此子句,则数据库链接是私有的,仅供您使用。