SQL: 003 : Cannot open database ‘MainDB_sdx’ requested by the login. The login failed

SQL: 003 : Cannot open database ‘MainDB_sdx’ requested by the login. The login failed

Error Message:

ErrorCode: 61443

Message:
Failed to connect to database 'MainDB_sdx'. (ErrNo:-2147467259
Details:Cannot open database "MainDB_sdx" requested by the login. The login failed.)

Cause: This issue usually occurs when SOHODOX is unable to connect to the SQL Server based MainDB_sdx.

Solution: You have to make sure the SQL Server service is running and the MainDB is accessible in the SQL Server. Follow the steps below to resolve the issue...

Step1: 

Restart the SQL Server service

  1. Go to Control Panel >> Administrative Tools >> Services panel in Windows.
  2. Search for SQL Server (…) service from the Services panel.
  3. Restart the SQL Server service. That’s it!
Now start SOHODOX you should be able to login. If you are not able to login then follow Step 2

Step 2: 

The Microsoft SQL Server must have marked the SOHODOX MainDB_sdx as a Suspect.  To confirm this, follow the below steps… 

Start the Command Prompt as Administrator.

Type...
cd C:\Windows
Press Enter.
Type...
sqlcmd -S .\SDXSQLEXPRESS -Q "SELECT state_desc as Database_status FROM sys.databases where name='MainDB_sdx'"
      where SDXSQLEXPRESS is name of your SQL Server instance. You can replace this with the name of your SQL Server instance.
      If you do not know the name of your SQL Server Instance, please run the following command...
            sqlcmd -Q "Select @@servername" 
      (The result will be displayed in the format 'MACHINE-NAME\INSTANCE-NAME')
      Once you know the instance name, run the above command.

Press Enter.

The state of the database will be displayed. If it is marked are SUSPECT, proceed with to STEP 3:...

Note: If the state of the DB is marked as any other than SUSPECT, please write to support@sohodox.com

Step 3:

Fixing a DB marked as Suspect

Important! Proceed only if you have the latest back-up of the MainDB_sdx

Open Command Prompt Window as Administrator and  run the following commands...

Type...
cd C:\Windows
Press Enter.
Type...
sqlcmd -S .\SDXSQLEXPRESS -Q "EXEC sp_resetstatus [MainDB_sdx];"
Press Enter.
Type...
sqlcmd -S .\SDXSQLEXPRESS -Q "ALTER DATABASE [MainDB_sdx] SET EMERGENCY DBCC CHECKDB([MainDB_sdx])"
Press Enter.
Type...
sqlcmd -S .\SDXSQLEXPRESS -Q "ALTER DATABASE [MainDB_sdx] SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC CHECKDB ([MainDB_sdx],REPAIR_ALLOW_DATA_LOSS)"
Press Enter.
Type...
sqlcmd -S .\SDXSQLEXPRESS -Q "ALTER DATABASE [MainDB_sdx] SET MULTI_USER"

Now start SOHODOX everything should work fine.