Altiris Service stays in "starting" status. Getting: Failed to construct DatabaseContext object. Connection to database failed.
search cancel

Altiris Service stays in "starting" status. Getting: Failed to construct DatabaseContext object. Connection to database failed.

book

Article ID: 372403

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

After upgrading SQL Server to a newer version, you tried to open the SMP Console to verify that you still have access to it.
You noticed that the "Altiris Service" (and other related Altiris services) can't start. Just stays in "starting" status.

The NS logs shows messages like this one:

Task execution engine failed
Failed to construct DatabaseContext object. Connection to database failed.
   [Altiris.NS.Exceptions.DatabaseNotReadyException @ Altiris.NS]
   at Altiris.NS.ContextManagement.AdminDatabaseContext.ThrowDatabaseNotReadyException(String exceptionDetails, Exception innerException)
   at Altiris.Database.DatabaseContext`1.Initialize(Boolean beginTransaction, IsolationLevel isolationLevel)
   at Altiris.Database.DatabaseContext`1.CreateFirstContext(ContextTransactionMode tmode, Nullable`1 isolationLevel, DatabaseContextStack currentStack, Boolean trans)
   at Altiris.Database.DatabaseContext`1.GetContextImpl(ContextTransactionMode tmode, Nullable`1 isolationLevel, Boolean independentContext)
   at Altiris.Database.DatabaseContext`1.GetContext(ContextTransactionMode tmode, Nullable`1 isolationLevel, Boolean independentContext)
   at Altiris.NS.DataAccessLayer.Implementation.Altiris_TaskManagement_DALTaskServer.GetUnmergedMerges()
   at Altiris.TaskManagement.ServerTasks.ServerTaskManager.MergeDatabase()
   at Altiris.TaskManagement.ServerTasks.ServerTaskManager.OnTaskExecutionEngineStart()
   at Altiris.TaskManagement.Common.Execution.Engine.TaskExecutionEngine.TaskExecutionEngineMain()

SQL connection failed.
   [Altiris.NS.Exceptions.DatabaseException @ Altiris.NS]
   at Altiris.NS.Utilities.DbUtils.TryCreateConnection(String costring, Int32 retries, Int32 delay, Int32 add)
   at Altiris.NS.Utilities.DbUtils.CreateConnection(String server, String catalog, String user, String password)
   at Altiris.NS.Utilities.DbUtils.CreateConnection(String configKey)
   at Altiris.NS.ContextManagement.AdminDatabaseContext.OpenDbConnection()
   at Altiris.Database.DatabaseContext`1.Initialize(Boolean beginTransaction, IsolationLevel isolationLevel)

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
   [System.Data.SqlClient.SqlException @ .Net SqlClient Data Provider]
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Altiris.NS.Utilities.DbUtils.TryCreateConnection(String costring, Int32 retries, Int32 delay, Int32 add)

SQL Exception details: code=5

Access is denied
   [System.ComponentModel.Win32Exception @ ]


Exception logged from: 
   at Altiris.DotNetLib.Logging.AtrsLog.ExceptionMessage(String message, Exception exception)
   at Altiris.TaskManagement.Common.Execution.Engine.TaskExecutionEngine.TaskExecutionEngineMain()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


-----------------------------------------------------------------------------------------------------
Date: 7/12/2024 3:55:51 AM, Tick Count: 331640 (00:05:31.6400000), Size: 4.35 KB
Process: AtrsHost (6992), Thread ID: 37, Module: AtrsHost.exe
Priority: 2, Source: ServerTaskManager

Environment

ITMS 8.x

Cause

A Firewall rule was blocking database access

Resolution

Open SIM (Symantec Installation Manager) and see if it actually shows an error connecting to your database after the SQL Server upgrade. Something like this:



"The SQL server, configured during installation, not accessible. Symantec Installation Manager functionality is limited".



If that message is present, try the following:

  1. Under SIM>Configure Settings>Configure Database Settings, try using the SQL server shortname, FQDN, and IP Address.
  2. Try using SA account (or any other valid SQL account) for your SQL Server.
  3. Then, try to load your existing database under the "Use existing" section.
  4. If it fails to load or times out, go back to your SQL Server, open Windows Firewall and disable it.
  5. Try again reloading your existing database from the Database Configuration page.
  6. If it loads your existing database list, close SIM and go back to Services and restart the Altiris Service (and any other that was in "starting" status).

Additional Information

Getting "The SQL server, configured during installation, not accessible. Symantec Installation Manager functionality is limited ( KB 164870 )