问题描述
我完全是 Oracle DB 的新手,试图启用 DB 更改通知.
I'm complete newbie to Oracle DB trying to enable DB change notifications.
private void RegisterNotification()
{
const string connstring = "Data Source=ORA_DB;User Id=USER;Password=pass;";
try
{
var connObj = new OracleConnection(connstring);
connObj.Open();
var cmdObj = connObj.CreateCommand();
cmdObj.CommandText = "SELECT * FROM MYTABLE";
var dep = new OracleDependency(cmdObj);
dep.QueryBasedNotification = false;
dep.OnChange += new OnChangeEventHandler(OnNotificationReceived);
cmdObj.ExecuteNonQuery();
connObj.Close();
connObj.Dispose();
connObj = null;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public static void OnNotificationReceived(object src, OracleNotificationEventArgs arg)
{
MessageBox.Show("Table has changed!");
}
我已经执行了GRANT CHANGE NOTIFICATION TO USER;"但是当我既不手动也不以编程方式更改表数据时,没有任何反应.基于查询的通知也不起作用.我想我错过了 Oracle 配置中的某些内容.
I've executed "GRANT CHANGE NOTIFICATION TO USER;" but nothing happens when I change the table data neither manually nor programmatically. Query-based notifications also don't work. I suppose I miss something in Oracle configuration.
我有 Oracle 11.2 标准版.
I have Oracle 11.2 standard edition.
推荐答案
CHANGE NOTIFICATION
权限不适用于最新版本的标准版功能:许可信息
The CHANGE NOTIFICATION
permission is not on the features of the Standard Edition for latest versions :Licensing information
Oracle TimesTen 应用层数据库缓存:
使用 PL/SQL、JDBC、ODBC、ttClasses、OCI 和 Pro*C/C++ 进行数据访问
Data access using PL/SQL, JDBC, ODBC, ttClasses, OCI, and Pro*C/C++
接口用于更改通知的事务日志 API (XLA)
多节点缓存网格
...
SE2:无
EE : Y(额外费用选项)
EE : Y (extra-cost option)
这篇关于ODP.NET 的 Oracle 数据库更改通知不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!