[英]Auditing in a SQL Server Docker Container
I'm currently using a SQL Server docker container, setup according to the following: Run the SQL Server 2017 container image on Docker on Linux, Mac, or Windows . 我当前正在使用SQL Server docker容器,请按照以下步骤进行设置: 在Linux,Mac或Windows的Docker上运行SQL Server 2017容器映像 。
I'm unfamiliar with Auditing within SQL Server, but all the documentation I can find for it appear to be using SSMS to configure the process. 我不熟悉SQL Server中的审核,但是我能找到的所有文档似乎都在使用SSMS来配置过程。 I am unable to use SSMS in my particular context. 我无法在特定环境下使用SSMS。
Is there a way to setup SQL Server Auditing within the SQL Server docker container? 有没有办法在SQL Server docker容器中设置SQL Server审核?
There are ways to connect your sqlserver from outside using SSMS..like i mentioned in this answer: Connect to Remote MSSQL db from Linux Docker container 有多种方法可以使用SSMS从外部连接您的sqlserver。如我在此答案中提到的那样: 从Linux Docker容器连接到远程MSSQL db
This link has SSMS equivalent scripts for auditing.. 该链接具有用于审核的SSMS等效脚本。
first you need to try creating server level audit on 首先,您需要尝试在以下服务器上创建服务器级别的审核
USE master ;
GO
-- Create the server audit.
CREATE SERVER AUDIT Payrole_Security_Audit
TO FILE ( FILEPATH =
linux file path) ;
GO
-- Enable the server audit.
ALTER SERVER AUDIT Payrole_Security_Audit
WITH (STATE = ON) ;
then you could individual databases as well or server level events as well.Below is one small example for database level audit 那么您也可以单个数据库或服务器级别的事件。下面是数据库级别审核的一个小示例
USE AdventureWorks2012 ;
GO
-- Create the database audit specification.
CREATE DATABASE AUDIT SPECIFICATION Audit_Pay_Tables
FOR SERVER AUDIT Payrole_Security_Audit
ADD (SELECT , INSERT
ON HumanResources.EmployeePayHistory BY dbo )
WITH (STATE = ON) ;
GO
you can run above scripts through sqlcmd,my answer i mentioned has more details on how to do this 您可以通过sqlcmd运行以上脚本,我提到的答案有更多有关如何执行此操作的详细信息
further i think VSCODE is more flexible to run ssms scripts than sqlcmd.you can download it for free and configure mssql extension 此外,我认为VSCODE比sqlcmd更灵活地运行ssms脚本。您可以免费下载它并配置mssql扩展
You can create a SQL script to setup SQL Server audit and audit specification and then execute it with the sqlcmd command usint the -i option. 您可以创建一个SQL脚本来设置SQL Server审核和审核规范 ,然后使用sqlcmd命令usint -i选项执行该脚本。
You can use the LOGbinder SQL Audit Policy Wizard to help you creating the script. 您可以使用LOGbinder SQL审核策略向导来帮助您创建脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.