简体   繁体   English

在网络上枚举Oracle数据库

[英]Enumerating Oracle Databases on Network

I know that I can use the following code to enumerate all SQL Server instances on network: 我知道我可以使用以下代码枚举网络上的所有SQL Server实例:

 SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
 DataTable table = instance.GetDataSources(); 

But I was wondering if there was a way of doing this for Oracle Instances as well. 但我想知道是否有办法为Oracle实例执行此操作。 Oracle's ODP.NET (Oracle.DataAccess.Client) supports DataSourceEnuerator, apparently System.Data.OracleClient doesn't though. Oracle的ODP.NET(Oracle.DataAccess.Client)支持DataSourceEnuerator,显然System.Data.OracleClient并不支持。 However the DataSourceEnumerator only enumerates the entries that are found in the local TNSNames.ora file. 但是,DataSourceEnumerator仅枚举在本地TNSNames.ora文件中找到的条目。

What you're seeing is due to the fundamental difference in how SQL Server and Oracle databases announce themselves. 您所看到的是由于SQL Server和Oracle数据库如何宣布自己的根本区别。 SQL Server (at least 2000 and 2005) use the SQL Browser Service to advertise databases available on the network. SQL Server(至少2000和2005)使用SQL浏览器服务来通告网络上可用的数据库。 Oracle, on the other hand, requires you to explicitly enumerate instances available using TNS entries . 另一方面,Oracle要求您使用TNS条目显式枚举可用的实例。

This is an instance of When in Rome , where Oracle is attempting to follow the API. 这是在罗马的一个实例,Oracle试图遵循API。 Unfortunately, without custom code you won't be able to replicate the SQL Server behavior. 遗憾的是,如果没有自定义代码,您将无法复制SQL Server行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM