Wednesday, April 02, 2025

Could not find the Database Engine startup handle. Error code: 0x851A0019

Installing SQL Server 2022 on Azure Virtual machine I have encountered an issue

Action required:
Use the following information to resolve the error, uninstall this feature, and then run the setup process again.


Feature failure reason:
An error occurred during the setup process of the feature.


Error details:
§ Error installing SQL Server Database Engine Services Instance Features

Could not find the Database Engine startup handle.
Error code: 0x851A0019



Solution:

Run cmd  prompt on this below command check Drive sectorinfo

C:\Fsutil fsinfo sectorinfo E:


Make sure to have 512 bytes to 4096 bytes allocated for the Drive which master.mdf file is installed



Friday, March 21, 2025

Shrining Database Transaction Log file is not working Transaction Log file size from 42 GB to 100MB

It is interesting to fix one of major database issue which causing a problem to reduce Transaction Log file size from 42 GB to 100MB.

Database file (MDF) 760MB

Database Log file (LDF) 42GB


 -- STEP 1

DBCC Shrinkfile ('Adventuredb_Log', 100)

GO

-- not working above statement as we expected

I took database backup followed by Transaction Log backup then again tried not working neither T-SQL nor SSMS.

What a day

 DBCC Shrinkfile ('Adventuredb_Log', 100)

GO


 -- STEP 2

  DBCC OPENTRAN()

Transaction information for database 'Adventuredb'.

Replicated Transaction Information:

        Oldest distributed LSN     : (0:0:0)

        Oldest non-distributed LSN : (73283:414:1)

DBCC execution completed. If DBCC printed error messages, contact your system administrator.


-- STEP 3

select log_reuse_wait_desc,* from sys.databases  where name = 'Adventuredb'

log_reuse_wait_desc 

REPLICATION


EXEC sp_removedbreplication  'Adventuredb' 

--Commands completed successfully.


select log_reuse_wait_desc from sys.databases where name = 'Adventuredb'

log_reuse_wait_desc

NOTHING

Finally i have managed shrink the log file to 100MB


Monday, February 17, 2025

Monday, January 06, 2025

Scripting All Agent Jobs Using SQL Server Management Studio

You have to Press the F7 key so the Object Explorer Details window appears like below. Select jobs you want to scripts and Right click to Generate scripts.