dblink故障一例

点击有惊喜


环境:oracle 12.1,一套两节点RAC,两个cdb,要跨cdb从一个cdb中的pdb创建dblink访问另一个cdb中的pdb。
创建完pdb之后,出现如下问题:
e74bcdafd6f70cbd7b15c2b86cbfbfbb379005ad
检查了一下两个节点的tnsnames.ora,并没有发现什么语法问题,但就是连接不上。

下一步,发现两个节点只有一个节点有tnsnames.ora文件,想着是否和单个节点没有tnsnames.ora有关,于是将1节点的tnsnames.ora复制到2节点,再测,仍然有问题。

下一步,想到自己创建一个dblink,在网上翻了翻怎么创建dblink的文章,找到了tom的:
You Asked
how can i create database links to access remote databases. 
please tell me the procedure of creating database links. 

and we said...
You need a tnsnames entry in your tnsnames.ora on the server. If you can: 

sqlplus scott/tiger@some_other_database 

from the machine the server you want to create the database link ON works -- you've gotten the first step done

For example, I can: 

$ sqlplus scott/tiger@ ora8idev  

SQL*Plus: Release 8.1.5.0.0 - Production on Thu Jul 20 09:16:25 2000 
(c) Copyright 1999 Oracle Corporation. All rights reserved. 
Connected to: 
Oracle8i Enterprise Edition Release 8.1.5.0.0 - Production 
With the Partitioning and Java options 
PL/SQL Release 8.1.5.0.0 - Production 
scott@DEV8I.WORLD> 

Once you have that setup, you log into the database (the local database -- the one you want to create the database link in to connect to the OTHER database) and issue the create database link command (see the sql reference manual for complete syntax). For example I can: 

scott@8i> create database link ora8idev 
2 connect to scott 
3 identified by tiger 
4 using 'ora8idev' 
5 / 

Database link created. 

scott@8i> select * from dual@ora8idev; 


scott@8i> 

I do not have to use the connect to and identified by clauses, if I do not, it will use the login and password of the currently connected user to connect to the remote database. 

从tom的回答里,我突然得到一个验证dblink的方法,tom将创建dblink分为两步,首先第一步是在客户端服务器创建tnsnames.ora文件,然后通过本地命名的方式验证是否能够访问远程数据库服务器,如果这一步成功,则接下来可进行创建dblink的操作。也就是说, 本地命名方式成功访问远程数据库服务器是创建dblink成功的必要条件。
如此一来,我可以先测试本地命名是否能成功登录数据库。经过测试,两节点均不能用本地命名方式登录数据库。可见问题基本定位在此。

点击有惊喜


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值