Friday, October 17, 2014

Recovering from "database is being taken offline and cannot be opened" on Domino Server

Today in the morning many users cannot access the Domino Server because they get the error message "database is being taken offline and cannot be opened". In the Server tasks we see that the DBMT task hangs on a database. Our Domino admin has restarted the server to solve the problem with no success. The databases which are not accessible have a xxx.tmp file with the exact same size as the nsf file. We have tried to remove the xxx.tmp file, but the databases are still offline. Even the normal procedures to recover from database corruption like "compact, fixup, updall" did not help to solve this problem.

So i dig deeper and found out that there is a C API to bring databases offline and online again. I am not a C expert, but fortunately it is possible to call this API from lotus script. I wrote a small agent in a test database on the server which executes the API on the databases which are not accessible. For example:

Option Public
Option Declare

Declare Private Function NSFBringDatabaseOnline Lib "nnotes" Alias "NSFBringDatabaseOnline" (  ByVal dbPath As String, ByVal Z As Long) As Integer
Sub Initialize
 Call NSFBringDatabaseOnline("mail/hugo.nsf",0)
 Call NSFBringDatabaseOnline("mail/heinz.nsf",0)
 Call NSFBringDatabaseOnline("db/crm.nsf",0)
End Sub

Be sure that you have checked the option that the agent is allowed to run restricted operations.

Agent settings to recover from database is being taken offline and cannot bei opened

 Then run this agent on the server with tell amgr run "agent.nsf" 'agent'. Replace "agent.nsf" and "agent" with the names you have chosen for your agent.

P.S. If you like it please share it on your favorite social network.

1 comment:

  1. Nice finding. Thanks. It solved my issue with a couple of databases also.