任务计划程序中的 Oracle 错误
我们有一个 C# 程序,计划在 Windows Server 2003 上的任务计划程序中运行,旨在根据从多个 Oracle 数据库中提取的信息删除文件夹中过时的文件。我可以手动执行该应用程序,一切正常 - 以具有管理权限的我自己身份登录,或以具有用户权限的分配任务用户身份登录。
但是,当任务用户从计算机注销时,应用程序在每个数据库上都会失败,并出现以下两个错误之一:
ORA-12504: TNS:listener 未在 CONNECT_DATA 中指定 SERVICE_NAME
或
ORA-12154: TNS: 无法解析指定的连接标识符。
所有这些数据库都使用连接字符串(从另一个 SQL Server 数据库检索),正如我之前所说,在手动操作时连接和运行得很好。我一直在网上寻找可能适用于这种情况的提示,但尚未找到明确的答案。
有没有人阅读此消息可能知道该问题的答案?任何建议都是非常受欢迎的。
We have a C# program which is scheduled to run in Task Scheduler on Windows Server 2003, designed to delete out-of-date files in a folder based on information drawn from multiple Oracle databases. I can execute the application manually and everything works fine - logged in either as myself with administrative rights, or logged in as the assigned task user which has Users rights.
When the task user is logged off the machine, though, the application fails on each database with one of two errors: either
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
or
ORA-12154: TNS:could not resolve the connect identifier specified.
All of these databases are using a connect string (retrieved from another, SQL Server, database) which, as I stated before, connect and run just fine when operated manually. I have been all over the web looking for tips which might apply to this circumstance and have not come up with a definitive answer.
Is there anyone reading this message who might know the answer to this problem? Any suggestions are most welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的计划任务设置为以什么用户身份执行?您测试的同一用户之一,还是另一个帐户?
无论如何,这听起来不像是权限问题,就像
ORACLE_HOME
< /a> 未设置环境变量。 (看起来您的程序可能正在尝试通过tnsnames.ora
进行连接 文件无法找到。)您可能需要让计划任务首先启动一个设置环境的批处理文件,然后继续调用您的 C# 程序。What user is your scheduled task set to execute as? One of the same users you tested as, or another account?
Regardless, it doesn't sound like a permissions issue, as much as the
ORACLE_HOME
environment variable not being set. (It looks like your program is probably trying to connect through atnsnames.ora
file that can't be found.) You may need to have the scheduled task first launch a batch file that sets the environment, then continues to call your C# program.我有类似的问题,但有一些java应用程序。同样的情况也发生了——手动任务执行没问题,但自动执行总是失败(同一个帐户!)。
请咨询您的管理员(或者您可以自己执行此操作)并将您的 C# 应用程序设置为由管理员帐户执行(仅测试!),或者查看是否有任何其他计划任务并询问它们以查看它们使用哪个 Windows 帐户以及它是如何设置的。我记得我们(我+管理员)必须进行一些实验,但最后他创建了一个新的特权帐户(其他现有帐户的副本)来执行计划任务。
I had similar issues, but with some java app. The same happened - manual task execution was fine, but automated execution always failed (same account!).
Check with your admin (or maybe you can do it yourself) and set your C# app to be executed by the admin account (testing only!) or see whether there are any other scheduled tasks and interrogate them to see which windows account they use and how it's set up. I remember that we (I + admin) had to experiment a bit, but finally he created a new privileged account (a copy of some other existing one) to execute the scheduled task.