从SQL Server审核文件中清除日志

时间:2021-01-25 10:35:52

Is it possible to Clear SQL Server Audit File logs. I want to delete old logs by date but can't find a way to delete it both from interface and sql Query.

是否可以清除SQL Server审核文件日志。我想按日期删除旧日志,但无法从界面和SQL查询中找到删除它的方法。

从SQL Server审核文件中清除日志

1 个解决方案

#1


0  

Yes, it is.

是的。

By sys.server_audits select old names via create_date column.

通过sys.server_audits,通过create_date列选择旧名称。

Then loop the names and delete them by using the next code for deleting:

然后循环名称并使用下一个删除代码删除它们:

ALTER SERVER AUDIT [Audit_name] WITH (STATE = OFF)
GO
USE [master]
GO
DROP SERVER AUDIT [Audit_name]
GO

#1


0  

Yes, it is.

是的。

By sys.server_audits select old names via create_date column.

通过sys.server_audits,通过create_date列选择旧名称。

Then loop the names and delete them by using the next code for deleting:

然后循环名称并使用下一个删除代码删除它们:

ALTER SERVER AUDIT [Audit_name] WITH (STATE = OFF)
GO
USE [master]
GO
DROP SERVER AUDIT [Audit_name]
GO