Issue with SQL server updates, missing xprepl.dll

Idol 1 Reputation point
2024-10-22T21:10:50.89+00:00

SQL server 2019 could not normally be upgraded with any CU or Security update.

settings: SQL server 2019 with AlwaysOn and CDC.

Main steps from logs:

  • Database 'master' is upgrading script 'repl_upgrade.sql' from level 251662630 to level 251662635.
  • Could not load the DLL xprepl.dll, or one of the DLLs it references. Reason: 2(The system cannot find the file specified.).
  • The failed batch of t-sql statements : set nocount on declare @script_status int
        ,@repl_script_key nvarchar(277)
    
        ,@repl_script_value nvarchar(8)
    
        ,@retcode int
    
        ,@repl_installed int
    
    -- this script will be run regardless of whether replication is installed -- check to see if replication is installed before proceeding execute master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',
                                     N'SOFTWARE\Microsoft\MSSQLServer\Replication',
    
                                     N'IsInstalled',
    
                                     @repl_installed OUTPUT,
    
                                     N'no_output'
    
    select @repl_installed = isnull(@repl_installed, 0) if @repl_installed = 0 and not exists(select * from sys.databases where is_cdc_enabled = 1) begin
    raiserror(N'Neither Replication feature is installed nor CDC is enabled. Upgrade scripts will not be run.', 10, 1)
    
    return
    
    end select @repl_script_key = N'SOFTWARE\Microsoft\MSSQLServer\Replication\Setup'
        ,@repl_script_value = N'Upgraded'
    
    -- Set script upgrade status to 0 set @script_status = 0 if @repl_installed != 0 begin
    execute @retcode = master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE',
    
                                                       @repl_script_key,
    
                                                       @repl_script_value,
    
                                                       N'REG_DWORD',
    
                                                       @script_status
    
    end begin try
    raiserror(N'Executing sp_vupgrade_replication.', 10, 1)
    
    exec @retcode = sys.sp_vupgrade_replication
    
    if @retcode != 0 or @@error != 0
    
    begin
    
        set @script_status = 0
    
    end
    
    else
    
    begin
    
        set @script_status = 1
    
        raiserror(N'sp_vupgrade_replication executed successfully', 10, 1)
    
    end
    
    end try begin catch
    -- re-raise the error non-fatally
    
    declare @error_msg nvarchar(2048)
    
    select @error_msg = ERROR_MESS...
    
  • Script level upgrade for database 'master' failed because upgrade step 'repl_upgrade.sql' encountered error 35262, state 4, severity 10. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
  • Attempting to copy article resolvers from SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL15.MSSQLSERVER\Replication\ArticleResolver

It looks like xprepl.dll is missing but there is the exact error as on CU6 for SQL2022 (2442348).

The standard way to repair does not work.

The SQL servers are upgraded after several restarts, but all Extended Events have been recreated from scratch and lost previous data.

Anyway, it does not look normal. Any ideas how to fix it?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,492 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.