Oracle实现跨数据库查询

原文链接: https://blog.csdn.net/m0_38072200/article/details/81126661

1.在当前数据库下查看所有的DBLINK的方法

select * from dba_db_links;     

2.创建

create public database link dbLinkName --(dbLink的名字,任意指定)

                  connect to username identified by password

                  using '(DESCRIPTION =

                            (ADDRESS_LIST =

                              (ADDRESS = (PROTOCOL = TCP)(HOST = IP )(PORT = 1521))--(IP:ORACLE服务器的IP地址)

                            )

                            (CONNECT_DATA =

                              (SERVICE_NAME = SID) --(ORACLE服务器的服务标识)

                            )

                          )';

3.使用

select count(*) from tableName@dbLinkName ;

你可能感兴趣的:(ORACLE)