Sqlwatchimport.exe download?

I need directions to where I can download sqlwatchimport.exe prebuilt pls?

Hi,

The compiled artifacts are included in GitHub Releases (or pre-releases ie betas), as the version 3.0 has not had any release yet, the application is only available as a source code.

In other words, there is nowhere on GitHub to publish compiled application unless it’s released.

However, it should be easy to build the application in Visual Studio from source code.

Hope this makes sense.

Thanks for your reply. Yes I have successfully compiled it now (struggled initially because I didn’t have the commandline libarary).

May I ask one more question? The documentation is a bit sparse. I understand that I can use it with the Add and Update options to register my SQL instances in the central repository. But what is the mechanism to actually import the data in once I have added my SQL instances?

You just run the SqlWatchImport.exe without any arguments and it will import the data for you.

Awesome. Thank again.

When I run it with the --add option I get this error:

2020-10-10 17:30:18.329 DEBUG Checking if Central Repository is online (Thread: 1)
Invalid column name ‘sql_user’.

It is trying to insert into the table [sqlwatch_config_sql_instance] with column values ‘sql_user’ and ‘sql_secret’ - which don’t exist for that table.

SqlWatch installed version = 2.6
SqlWatchImport installed version = 3.x.2

Thanks

Your database version must match the console app version.

I uninstalled/reinstalled version 3.0.7 of the database. The add option worked without issues. But now I get this error when I run the import:

2020-10-11 09:50:42.043 SQLWATCH Remote Instance Importer
Imports remote SQLWATCH data into the Central Repository
Marcin Gminski 2020, SQLWATCH.IO
Version: 1.1.7588.12313 (2020-10-10 06:50:26)
2020-10-11 09:50:42.043 DEBUG Application Configuration
CentralRepositorySqlInstance : #removed#
CentralRepositorySqlDatabase : DBA_SQLWATCH
CentralRepositorySqlUser :
CentralRepositorySqlSecret :
SqlBulkCopy.EnableStreaming : true
SqlBulkCopy.BatchSize : 4000
SqlBulkCopy.BulkCopyTimeout : 300
EnvironmentToProcess : ALL
FullLoad : false
LogFile : SqlWatchImport.log
MaxLogSizeMB : 10
MaxLogFiles : 10
PrintToLogFile : true
PrintToConsole : true
MinThreads : -1
MaxThreads : 0
MinPoolSize : 0
MaxPoolSize : 0
DumpDataOnError : true
ClientSettingsProvider.ServiceUri : (Thread: 1)
2020-10-11 09:50:42.074 DEBUG Checking if Central Repository is online (Thread: 1)
2020-10-11 09:50:42.230 DEBUG Central Repository SQLWATCH Version: “3.0.7544.33251” (Thread: 1)

Unhandled Exception: System.AggregateException: One or more errors occurred. —> System.Data.SqlClient.SqlException: Invalid object name ‘SQLWATCH.dbo.sqlwatch_config_sql_instance’.

Ok I have resolved the error. Looks like somewhere in the import process it is hard-wired to connect to SQLWATCH database name.

Sounds like a bug.Can you raise an issue on GitHub please?

No worries. I have done that now - #213.

1 Like

Sorry, I answer to myself.
I found the right one.

But now when I try to register the repository, I receive a error and it requests a sqluer and password.
I thought it work with Windows authentication without specifying any login information.
Could you help me ?

Can you describe step by step how you “register” the repo please?

Hello,

I create new database
Deploy SQLWatch to it using dbatools powershell module
On another server\instance, I create a database and deploy SQLWatch to it
Compile your project to obtain the SqlWatchImport.exe
Add server\instance and database in the SqlWatchImport.exe.config
Execute the following command:
.\SqlWatchImport.exe --add -s server\instance -d DBATools (server\instance with server name and instance name of the monitored instance)
But receive the following error
2021-01-07 17:49:43.524 DEBUG Checking if Central Repository is online (Thread: 1)
Invalid column name ‘sql_user’.

I confirm that my AD account is sysadmin on both instance.

I think I found the source of the error.
In SQLWatchimport program, it use the following query to insert the new remote instance settings.

  string query = @"insert into [dbo].[sqlwatch_config_sql_instance]([sql_instance]
  ,[hostname],[sql_port],[sqlwatch_database_name]
  ,[repo_collector_is_active],[sql_user],[sql_secret])
  values(@sql_instance, @hostname, @port, @database, 1, @sql_user, @sql_secret);";

And the table doesn’t contain all needed columns:

SELECT TOP (1000) [sql_instance]
,[hostname]
,[sql_port]
,[sqlwatch_database_name]
,[environment]
,[repo_collector_is_active]
,[linked_server_name]
FROM [DBAToolsCentral].[dbo].[sqlwatch_config_sql_instance]

Do I miss something or deploy a bad version of the solution ?

Thanks in advance

The problem comes from dbatools Install-DbaSqlWatch command.

I try to deploy using the -PreRelease option but it seems it doesn’t deploy a compatible version with SqlWatchImport.exe.

Finally I deploy the solution using sqlpackage et a dacpac build from your sources.
Just have to modify expected collation like you explain in your know issues.

I found one more error. When run .\SqlWatchImport.exe to start import, I obtain the followng error.

Unhandled Exception: System.AggregateException: One or more errors occurred. —> System.Data.SqlClient.SqlException: Invalid object name ‘S
QLWATCH.dbo.sqlwatch_config_sql_instance’.

Looking in the source, I founf that database is hard set in the query:

	public async Task<List<RemoteInstance>> GetRemoteInstancesAsync()
	{
		// Gets the list of remote servers to import data from

		string sql = @"select RemoteSqlInstance = sql_instance
								, Hostname=isnull(hostname,sql_instance) + isnull(','+convert(varchar(10),[sql_port]),'')
								, SqlSecret=isnull([sql_secret],'')
								, SqlUser=isnull([sql_user],'')
								, SqlWatchDatabase = [sqlwatch_database_name]
						**from [SQLWATCH].[dbo].[sqlwatch_config_sql_instance]**
						where repo_collector_is_active = 1";

Hope it will help you if it was not already corrected.

Best regards

You’re installing the wrong version of the database. Dbatools will install the latest release, which right now is 2.6.

The SqlWatchImoort.exe only works with db 3.x which is work in progress and not yet released.

The hard coded database name is already on the tracker https://github.com/marcingminski/sqlwatch/issues/213