Skip to content
Easy2Patch Blog
EN TR
Makale 5 dk okuma

Easy2Patch – Deployment Type Uninstall Command Line Düzeltmesi

Bazı Easy2Patch ortamlarında, **Uninstall Command Line** bilgisi bulunmayan uygulama kayıtlarının oluşturulması veya işlenmesi sırasında veritabanı kaynaklı hata oluşabilir. Sorun, Easy2Patch veritabanındaki `dbo.t_AppDts` tablosunda bulunan `DeploymentTypeUninstallCommandLine` alanının `NULL` değer kabul etmemesinden kaynaklanmaktadır. Bu makalede, ilgili veritabanı alanını `NULL` değer kabul edecek şekilde güncelleyen düzeltmenin nasıl uygulanacağı açıklanmaktadır.

direnc.onen@arksoft.com.tr

Genel Bakış

Bazı Easy2Patch ortamlarında, Uninstall Command Line bilgisi bulunmayan uygulama kayıtlarının oluşturulması veya işlenmesi sırasında veritabanı kaynaklı hata oluşabilir.

Sorun, Easy2Patch veritabanındaki dbo.t_AppDts tablosunda bulunan DeploymentTypeUninstallCommandLine alanının NULL değer kabul etmemesinden kaynaklanmaktadır.

Bu makalede, ilgili veritabanı alanını NULL değer kabul edecek şekilde güncelleyen düzeltmenin nasıl uygulanacağı açıklanmaktadır.


Etkilenen Bileşen

  • Ürün: Easy2Patch
  • Veritabanı: Easy2Patch
  • Tablo: dbo.t_AppDts
  • Alan: DeploymentTypeUninstallCommandLine

Sorun

DeploymentTypeUninstallCommandLine alanının zorunlu olması nedeniyle, kaldırma komutu bulunmayan uygulama kayıtları bazı durumlarda veritabanına kaydedilemeyebilir.

Bu durum, ilgili kayıtların oluşturulması veya işlenmesi sırasında SQL tarafında hata oluşmasına neden olabilir.


Çözüm

Aşağıdaki düzeltme scripti, DeploymentTypeUninstallCommandLine alanını NULL değer kabul edecek şekilde günceller.

Düzeltme:

  • Mevcut uygulama kayıtlarının içeriğini değiştirmez.
  • dbo.t_AppDts tablosunu yeni şema ile yeniden oluşturur.
  • Mevcut kayıtları yeni tabloya aktarır.
  • DeploymentTypeUninstallCommandLine alanının NULL değer kabul etmesini sağlar.

[!IMPORTANT] İşlem sırasında dbo.t_AppDts tablosu yeniden oluşturulduğu için uygulamadan tabloya erişimin kesilmesi önerilir. Düzeltmeyi planlı bir bakım aralığında uygulayın.


Uygulama Öncesi

Düzeltmeyi uygulamadan önce aşağıdaki işlemleri tamamlayın:

  1. Easy2Patch veritabanının güncel ve geri yüklenebilir bir yedeğini alın.
  2. İşlemi mümkünse planlı bir bakım aralığında gerçekleştirin.
  3. Easy2Patch servislerini durdurun.
  4. SQL Server Management Studio üzerinden doğru SQL Server instance'ına bağlandığınızı doğrulayın.
  5. Sorgunun Easy2Patch veritabanında çalıştırılacağını kontrol edin.

Düzeltmenin Uygulanması

  1. Easy2Patch servislerini durdurun.
  2. SQL Server Management Studio'yu açın.
  3. Easy2Patch veritabanının bulunduğu SQL Server instance'ına bağlanın.
  4. Yeni bir sorgu penceresi açın.
  5. Aşağıdaki scripti çalıştırın.
  6. Script başarıyla tamamlandıktan sonra Doğrulama adımlarını uygulayın.
  7. Easy2Patch servislerini yeniden başlatın.

SQL Düzeltme Scripti

USE Easy2Patch
GO

BEGIN TRANSACTION

SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON

COMMIT

BEGIN TRANSACTION
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppDts_CatalogType
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_DeploymentTypeDtIsCustomScript
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_DeploymentTypeScriptLanguage
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_DeploymentTypeExecuteTime
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_DeploymentTypePinOnClient
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_DeploymentTypeEnabled
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_ScriptResultComparisonValue
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_ScriptRunAs32Bit
GO

ALTER TABLE dbo.t_AppDts
    DROP CONSTRAINT DF_t_AppsDt_IsDeleted
GO

CREATE TABLE dbo.Tmp_t_AppDts
(
    Id uniqueidentifier NOT NULL,
    AppType int NOT NULL,
    DeploymentTypeTitle nvarchar(256) NOT NULL,
    DeploymentTypeTechnology nvarchar(256) NOT NULL,
    DeploymentTypeDescription nvarchar(256) NULL,
    DeploymentTypeLanguage nvarchar(5) NOT NULL,
    DeploymentTypeContentFolder nvarchar(256) NULL,
    DeploymentTypeUninstallContentFolder nvarchar(256) NULL,
    DeploymentTypeUninstallContentSetting int NOT NULL,
    DeploymentTypeInstallCommandLine nvarchar(256) NOT NULL,
    DeploymentTypeUninstallCommandLine nvarchar(256) NULL,
    DeploymentTypeRepairCommandLine nvarchar(256) NULL,
    DeploymentTypeDetectionScript nvarchar(MAX) NOT NULL,
    DeploymentTypeDtScriptJson nvarchar(MAX) NOT NULL,
    DeploymentTypeDtIsCustomScript int NOT NULL,
    DeploymentTypeScriptLanguage int NOT NULL,
    DeploymentTypeProcessInfoName nvarchar(256) NULL,
    DeploymentTypeRequiresUserInteraction int NOT NULL,
    DeploymentTypeRequiresLogOn int NULL,
    DeploymentTypeUserInteractionMode int NOT NULL,
    DeploymentTypePostExecutionBehavior int NOT NULL,
    DeploymentTypeExecutionContext int NOT NULL,
    DeploymentTypeMachineInstall int NOT NULL,
    DeploymentTypeMaxExecuteTime int NOT NULL,
    DeploymentTypeExecuteTime int NOT NULL,
    DeploymentTypeSlowContentHandlingMode int NOT NULL,
    DeploymentTypeFallbackToUnprotectedDP int NOT NULL,
    DeploymentTypePinOnClient int NOT NULL,
    DeploymentTypeEnabled int NOT NULL,
    ScriptResultComparisonValue nvarchar(50) NOT NULL,
    ScriptRunAs32Bit bit NOT NULL,
    CreatedAt datetime NULL,
    ModifiedAt datetime NULL,
    CreatedBy uniqueidentifier NULL,
    ModifiedBy uniqueidentifier NULL,
    IsDeleted int NOT NULL
) ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE dbo.Tmp_t_AppDts
    SET (LOCK_ESCALATION = TABLE)
GO

DECLARE @v sql_variant
SET @v = N'1catalog, 2CustomCatalog,3CustomInjection'

EXECUTE sp_addextendedproperty
    N'MS_Description',
    @v,
    N'SCHEMA',
    N'dbo',
    N'TABLE',
    N'Tmp_t_AppDts',
    N'COLUMN',
    N'AppType'
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppDts_CatalogType DEFAULT ((1)) FOR AppType
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_DeploymentTypeDtIsCustomScript DEFAULT ((0))
    FOR DeploymentTypeDtIsCustomScript
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_DeploymentTypeScriptLanguage DEFAULT ((0))
    FOR DeploymentTypeScriptLanguage
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_DeploymentTypeExecuteTime DEFAULT ((5))
    FOR DeploymentTypeExecuteTime
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_DeploymentTypePinOnClient DEFAULT ((0))
    FOR DeploymentTypePinOnClient
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_DeploymentTypeEnabled DEFAULT ((1))
    FOR DeploymentTypeEnabled
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_ScriptResultComparisonValue DEFAULT (N'NeedUpdate')
    FOR ScriptResultComparisonValue
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_ScriptRunAs32Bit DEFAULT ((0))
    FOR ScriptRunAs32Bit
GO

ALTER TABLE dbo.Tmp_t_AppDts ADD CONSTRAINT
    DF_t_AppsDt_IsDeleted DEFAULT ((0))
    FOR IsDeleted
GO

IF EXISTS (SELECT * FROM dbo.t_AppDts)
    EXEC('
        INSERT INTO dbo.Tmp_t_AppDts
        (
            Id,
            AppType,
            DeploymentTypeTitle,
            DeploymentTypeTechnology,
            DeploymentTypeDescription,
            DeploymentTypeLanguage,
            DeploymentTypeContentFolder,
            DeploymentTypeUninstallContentFolder,
            DeploymentTypeUninstallContentSetting,
            DeploymentTypeInstallCommandLine,
            DeploymentTypeUninstallCommandLine,
            DeploymentTypeRepairCommandLine,
            DeploymentTypeDetectionScript,
            DeploymentTypeDtScriptJson,
            DeploymentTypeDtIsCustomScript,
            DeploymentTypeScriptLanguage,
            DeploymentTypeProcessInfoName,
            DeploymentTypeRequiresUserInteraction,
            DeploymentTypeRequiresLogOn,
            DeploymentTypeUserInteractionMode,
            DeploymentTypePostExecutionBehavior,
            DeploymentTypeExecutionContext,
            DeploymentTypeMachineInstall,
            DeploymentTypeMaxExecuteTime,
            DeploymentTypeExecuteTime,
            DeploymentTypeSlowContentHandlingMode,
            DeploymentTypeFallbackToUnprotectedDP,
            DeploymentTypePinOnClient,
            DeploymentTypeEnabled,
            ScriptResultComparisonValue,
            ScriptRunAs32Bit,
            CreatedAt,
            ModifiedAt,
            CreatedBy,
            ModifiedBy,
            IsDeleted
        )
        SELECT
            Id,
            AppType,
            DeploymentTypeTitle,
            DeploymentTypeTechnology,
            DeploymentTypeDescription,
            DeploymentTypeLanguage,
            DeploymentTypeContentFolder,
            DeploymentTypeUninstallContentFolder,
            DeploymentTypeUninstallContentSetting,
            DeploymentTypeInstallCommandLine,
            DeploymentTypeUninstallCommandLine,
            DeploymentTypeRepairCommandLine,
            DeploymentTypeDetectionScript,
            DeploymentTypeDtScriptJson,
            DeploymentTypeDtIsCustomScript,
            DeploymentTypeScriptLanguage,
            DeploymentTypeProcessInfoName,
            DeploymentTypeRequiresUserInteraction,
            DeploymentTypeRequiresLogOn,
            DeploymentTypeUserInteractionMode,
            DeploymentTypePostExecutionBehavior,
            DeploymentTypeExecutionContext,
            DeploymentTypeMachineInstall,
            DeploymentTypeMaxExecuteTime,
            DeploymentTypeExecuteTime,
            DeploymentTypeSlowContentHandlingMode,
            DeploymentTypeFallbackToUnprotectedDP,
            DeploymentTypePinOnClient,
            DeploymentTypeEnabled,
            ScriptResultComparisonValue,
            ScriptRunAs32Bit,
            CreatedAt,
            ModifiedAt,
            CreatedBy,
            ModifiedBy,
            IsDeleted
        FROM dbo.t_AppDts WITH (HOLDLOCK TABLOCKX)
    ')
GO

DROP TABLE dbo.t_AppDts
GO

EXECUTE sp_rename
    N'dbo.Tmp_t_AppDts',
    N't_AppDts',
    'OBJECT'
GO

ALTER TABLE dbo.t_AppDts ADD CONSTRAINT
    PK_t_AppsDt PRIMARY KEY CLUSTERED
    (
        Id
    )
    WITH
    (
        PAD_INDEX = OFF,
        FILLFACTOR = 90,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON
    )
    ON [PRIMARY]
GO

COMMIT

Doğrulama

Script başarıyla tamamlandıktan sonra aşağıdaki sorguyu çalıştırın:

SELECT
    c.name,
    c.is_nullable
FROM sys.columns AS c
WHERE c.object_id = OBJECT_ID('dbo.t_AppDts')
  AND c.name = 'DeploymentTypeUninstallCommandLine';

Beklenen sonuç:

Alan Beklenen Değer
DeploymentTypeUninstallCommandLine is_nullable = 1

is_nullable değerinin 1 olması, ilgili alanın artık NULL değer kabul ettiğini ve düzeltmenin başarıyla uygulandığını gösterir.

Doğrulama tamamlandıktan sonra Easy2Patch servislerini yeniden başlatın ve ilgili işlemi tekrar deneyin.


Destek

Düzeltmenin uygulanması sırasında herhangi bir sorunla karşılaşmanız durumunda Easy2Patch destek ekibi ile iletişime geçebilirsiniz.