Oracle DB链接连接配置文件

时间:2014-05-24 10:31:26

标签: sql oracle oracle11g

我想在oracle中创建分布式数据库并创建快照。我将db放在一个本地网络中的两台笔记本电脑上。我尝试编辑两个配置文件(tnsnames.ora和listener.ora)并使用tnsnames.ora中的别名创建数据库链接。但是如果我尝试运行select参考第二个数据库,oracle抛出Ora-12541:TNS - 没有监听器。你能帮我解决这个问题吗?

我的tnsnames.ora文件:

PC1 ip 192.168.1.100

MIRASCONNECT =  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521))
(CONNECT_DATA =
  (SERVICE_NAME = orl)
)  )

PC2 ip 192.168.1.103

mirassecond =  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
(CONNECT_DATA =
  (SERVICE_NAME = database)
)  )
在listener.ora中的

我试图只编辑sid名称:

PC1:

SID_LIST_LISTENER =  (SID_LIST =
(SID_DESC =
  (SID_NAME = database) (GLOBAL_DBNAME = database)
  (ORACLE_HOME = D:\app\Piotrek\product\11.2.0\dbhome_1)
  (PROGRAM = extproc)
  (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Piotrek\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)  )

PC2:

SID_LIST_LISTENER =   (SID_LIST =
(SID_DESC =
  (SID_NAME = orl) (GLOBAL_DBNAME = orl)
  (ORACLE_HOME = D:\app\Piotrek\product\11.2.0\dbhome_1)
  (PROGRAM = extproc)
  (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Piotrek\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)  )

创建dblink:

CREATE PUBLIC DATABASE LINK MIRAS_CONNECTION CONNECT TO MIREK IDENTIFIED BY pwdmirek USING 'MIRASCONNECT'

我的选择看起来像:

select * from test_table@miras_connection

1 个答案:

答案 0 :(得分:0)

没有听众容易理解。 你没有在192.168.1.103

上开始你的倾听者

尝试

lsnrctl start