Partial installation and Error with Install-DbaSqlWatch

SQL 2019, not sure if this needs to be asked over on dbatools but here goes. I’m a sysadmin at the windows and instance level. I’m including the command and output below. Any ideas?

Install-DbaSqlWatch -SqlInstance $Server -Database SQLWATCH
WARNING: [13:20:30][Publish-DbaDacPackage] Deployment failed | Could not deploy package.
Error SQL72014: .Net SqlClient Data Provider: Msg -2, Level 11, State 0, Line 0 Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Error SQL72045: Script execution error. The executed script:
BEGIN TRANSACTION;

MERGE INTO dbo.sqlwatch_config_sql_instance
AS target
USING (SELECT @@SERVERNAME AS [servername],
0 AS [repo_collector_is_active]) AS source ON target.sql_instance = source.[servername]
WHEN NOT MATCHED THEN INSERT (sql_instance, [repo_collector_is_active]) VALUES (source.[servername], source.[repo_collector_is_active]);

MERGE INTO [dbo].[sqlwatch_meta_server]
AS target
USING (SELECT CONVERT (sysname, SERVERPROPERTY(‘ComputerNamePhysicalNetBIOS’)) AS [physical_name],
CONVERT (sysname, @@SERVERNAME) AS [servername],
CONVERT (sysname, @@SERVICENAME) AS [service_name],
CONVERT (VARCHAR (50), local_net_address) AS [local_net_address],
CONVERT (VARCHAR (50), local_tcp_port) AS [local_tcp_port],
DATEDIFF(mi, GETUTCDATE(), GETDATE()) AS [utc_offset_minutes],
@@VERSION AS [sql_version]
FROM sys.dm_exec_connections
WHERE session_id = @@spid) AS source ON target.[se

ComputerName : $Server (NOT THE REAL NAME)
InstanceName : MSSQLSERVER
SqlInstance : $Server (NOT THE REAL NAME)
Database : SQLWATCH
Status : (Failed)

Hi,

This looks like a lock issue. Have you tried just re-running the install?

yea, I tried it twice. I didn’t want to try to do it outside of dbatools but I guess I may have to try that.

I do not think this is a dbatools issue, the deployment is handled by DacFX.
Have you got database audits enabled? There used to be a bug in SQL Server that was causing infinite lock via DACPAC deployments when Audits were enabled.

No.
This is a 2019 box without SSDT installed.
I just tried it on a 2016 server with SSDT installed and it worked.

I ran it with -EnableException to get more info:

PS C:\Windows\system32> Install-DbaSqlWatch -SqlInstance $Server -EnableException
Remove-Item : Cannot remove item C:\Users\myUser\AppData\Roaming\PowerShell\dbatools\4.3\SQLWATCH 4.3.0.23725 20210721131116\CommandLine.dll: Access to the path
‘C:\Users\myUser\AppData\Roaming\PowerShell\dbatools\4.3\SQLWATCH 4.3.0.23725 20210721131116\CommandLine.dll’ is denied.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:1029 char:29

  • … Remove-Item -LiteralPath $currentArchiveEntryFileInfo.Ful …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : PermissionDenied: (C:\Users\jacrid…CommandLine.dll:FileInfo) [Remove-Item], UnauthorizedAccessException
    • FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
      Remove-Item : Cannot remove item C:\Users\myUser\AppData\Roaming\PowerShell\dbatools\4.3\SQLWATCH 4.3.0.23725 20210721131116\SqlWatchDatabase.dll: Access to the path
      ‘C:\Users\myUser\AppData\Roaming\PowerShell\dbatools\4.3\SQLWATCH 4.3.0.23725 20210721131116\SqlWatchDatabase.dll’ is denied.
      At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:1029 char:29
  • … Remove-Item -LiteralPath $currentArchiveEntryFileInfo.Ful …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : PermissionDenied: (C:\Users\MyUser…tchDatabase.dll:FileInfo) [Remove-Item], UnauthorizedAccessException
    • FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand

When I try to manually remove those items (with nothing else open) it says the folder or a file is open in another program. Still looking.

Update: On the 2019 server, I signed out and renamed that folder and it worked. Seems odd to me.

Ok, so can you try installing without dbatools, just to exclude it is actually dbatools causing it:

The installer from the zip worked fine, but so did the second attempt with dbatools.

Thanks for trying to assist.

1 Like