Jump to content

Generic db error: "4060 'Cannot open database "KAV" requested by the login. The login failed.{42000};' LastStatement='ADODB.Connection'" (Advices and Solutions)


Recommended Posts

Tahmeed702
Posted (edited)

Statement: We have a situation in which KSC and SQL services are running normally, however KSC is not opening and returns an error stating that it cannot connect to the database, and when we try to restore the KSC backup using Backup Utility, it fails (screenshot attached). 

 

image.thumb.png.8525d8d79f6caee493d96364815cec38.png

Resolution: We discovered that the Kav database had become corrupted, and KSC was unable to access KAV, maybe owing to an abrupt power cutoff or power loss. We installed SMSS from this link: https://learn.microsoft.com/en-us/ssms/release-notes-20#202

 

We login to the Database Engine and discover that Kav database is suspected or corrupted state. 

image.png.a14d10977bfd2bac8301daabde0c71c2.png



 

Go to Run Query and Execute below command 

 

-- 1. Put the database in Emergency Mode to bypass startup checks

ALTER DATABASE KAV SET EMERGENCY;

GO

 

-- 2. Set to Single User Mode to prevent interference

ALTER DATABASE KAV SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

GO

 

-- 3. Run the Repair (This step may take a few minutes)

DBCC CHECKDB (KAV, REPAIR_ALLOW_DATA_LOSS);

GO

 

-- 4. Return to Multi-User Mode once finished

ALTER DATABASE KAV SET MULTI_USER;

GO

 

Executing the command we may following result 

 

image.thumb.png.77c2b79d457feefa1324d059781e27cf.png

 

Now KSC started and Database is working fine but still we cannot create backup by KSC task or Backup utility , screenshot attached

image.thumb.png.4a1ef68a01e67b7aee90a85845fb9054.png

Run the Final Repair in SSMS

Open SQL Server Management Studio (SSMS) and open a New Query window.

Ensure the database dropdown at the top says master.

Paste and execute the following script:

USE master;

GO

 

-- 1. Lock the database so ONLY this script can access it

ALTER DATABASE KAV SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

GO

-- 2. Run the repair to delete the orphaned LOB data node (Object ID 1362103893)

DBCC CHECKDB ('KAV', REPAIR_ALLOW_DATA_LOSS);

GO

-- 3. Return the database to normal operation

ALTER DATABASE KAV SET MULTI_USER;

GO

 

After running this command, the KSC SERVER communicates properly with KAV, and backup works flawlessly. 


 

Edited by Tahmeed702

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...