Oracle如何实现跨库查询

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

select * from dba_db_links;     

2.创建

create public database link dblink(自己随便起)

                  connect to 用户名 identified by 密码

                  using '(DESCRIPTION =

                            (ADDRESS_LIST =

                              (ADDRESS = (PROTOCOL = TCP)(HOST = 要连接的数据库所在服务器的IP地址)(PORT = 1521))

                            )

                            (CONNECT_DATA =

                              (SERVICE_NAME = 要连接的数据库的在本地的服务名(即要连接的数据库的SID))

                            )

                          )';

3.使用

select * from tablename@dblink;

4.删除

drop public database link dblink;

 

 

遇到一个问题,待解救.

[SQL]select * from dba_db_links
[Err] ORA-00942: table or view does not exist

 

参考:

https://blog.csdn.net/junfeng120125/article/details/7249321

https://blog.csdn.net/x11819130/article/details/79421261
 

 

你可能感兴趣的:(Orcale)