Having an issue with opening a database on another server. We have several servers, both local and cloud based. We have an scheduled agent that is to update documents in various databases on various servers.
The issue is with databases on a cloud server. The database does not open. It appears to be set (Is NOT Nothing) but testing with the .isOpen method shows that it is not set.
The code can open databases on other servers (either cloud or local) but not this one server. The database replica can be open on other servers. Attempting to open other databases on the same cloud server also fails.
And the kicker, if we run the agent manually, it successfully opens the database on the server. But if scheduled, it fails.
Based on the above I am thinking it some sort of setting on the server, but the security settings appear to be the same as other cloud servers where the agent is successful in opening the database.
We have tinkered with the run on behalf values, but still no joy.
We have tried moving the scheduled agent to the affected server and it works, however, we need the agent to run from a central server.
When you run manually, you run as the user. If the user can hit the server, then it’s there and alive. If the code runs on the server and the db isn’t there, then either the servers can’t see each other or there’s a problem with the ACL.
Sorry, but no clue how to troubleshoot the problem.
Sounds like the “cloud” server does not have the “local” server in the Trusted Servers field in its Server document. Server-based agents cannot open databases on other servers without this permission.
I.e., if the agent runs on ServerA, and the database resides on ServerD, then you need to open up names.nsf on ServerD, go to the server document for ServerD, go to the Security tab, go to the Server Access section, and check the Trusted Servers field. Either add ServerA directly to that field, or add it to a group that is already listed there. If you add it to an existing group, I think you can get away without restarting the server, but if you add it directly I think it will be required.
You said: “the kicker, if we run the agent manually, it successfully opens the database on the server. But if scheduled, it fails.”
What do you mean by ‘run the agent manually’? Are you saying that it works if you do a ‘tell amgr run’ command?
Also, how are you opening the database? There are a couple of different ways. Can you show us the relevant lines of code? (In particular, are you using OpenByReplicaID()?)
Apologies for delay, but was off work for a period.
When i say manually, i mean from the agent list, right click > Run. I’m not trying to manually trigger using amgr.
The code sample :
If (wmsDbSA Is Nothing) Then
Set wmsDbSA= GetBestPracticeDb(SERVER_NAME_SA, WMS_FILE_PATH_SA)
If ( wmsDbSA Is Nothing ) Then
errorMsg = "Could not open the WMS SA database. Please contact your Lotus Notes administrator for assistance."
Goto Problem
End If
End If
If ( wmsRecordIDLookUpViewSA Is Nothing ) Then
Set wmsRecordIDLookUpViewSA = wmsDBSA.GetView( "RecordIDLookupClick" ) '**** errors on this line,
If ( wmsRecordIdLookupViewSA Is Nothing ) Then
errorMsg = "Could not locate the Record Id Lookup view in the WMS SA database. Please contact your Lotus Notes administrator for assistance."
Goto Problem
End If
Else
Call wmsRecordIdLookupViewSA.Refresh
End If
The error occurs at the GetView command.
If we test the database with .IsOpen, it fails the test.
The same code works for other databases on other servers.
The same code works for this databases on other servers.