Dvoituron.Tools.SqlTraceGenerator
1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global Dvoituron.Tools.SqlTraceGenerator --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Dvoituron.Tools.SqlTraceGenerator --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Dvoituron.Tools.SqlTraceGenerator&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Dvoituron.Tools.SqlTraceGenerator --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SQL Server Trace Script Generator
Generate a SQL Script with triggers to trace data changes in 'Traces' tables.
After installation, use SqlTraceGenerator --config=[config_file.json] --output=[script.sql] --maxdays=[99]
Arguments:
--config Configuration json file (see format below).
If not set, use appsettings.json located in current folder.
--output Generated SQL file to execute.
Existing file will be overwritten.
--maxdays Maximum days recorded for each traces
when a new trace is saved.
In your application, call this SQL method to trace the user: EXEC sp_set_session_context 'user_id', 'denis'
Sample:
SqlTraceGenerator --config=myconfig.json --output=myscript.sql
myconfig.json
{
"ConnectionString": "Server=MyServer;Database=MyDatabase;",
"Output": "scripts.sql",
"Generate": {
"Triggers": true,
"Tables": true
},
"Purge": {
"MaximumDays": 365
},
"Include": [
"dbo.mytable1.*",
"dbo.mytable2.myname",
],
"Exclude": [
"dbo.mytable1.id",
],
}
After data changes, the [Traces].[dbo_mytable1] contains:
__Operation __TransactionId __Updated __UpdatedBy EMPNO ENAME
U 147658 2019-07-12 16:21:51 system 7369 Smith
U 148709 2019-07-12 16:21:56 system 7369 Denis
U 148977 2019-07-12 16:21:58 system 7369 Christophe
U 149224 2019-07-12 16:22:00 system 7369 Richard
Install
dotnet tool install Dvoituron.Tools.SqlTraceGenerator -g
Uninstall
dotnet tool uninstall Dvoituron.Tools.SqlTraceGenerator -g
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.2 is compatible. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.