Hi,
I have enabled audit on SQL server 2022 with given scripts but got no error in SQL Server logs.
You may try following to investigate:
The error code 32 typically indicates that the file is being used by another process, which is why it cannot be deleted. Here are a few steps you can take to resolve this issue:
- Check for Open Handles: Ensure that no other process is using the .sqlaudit file. You can use tools like Process Explorer to identify which process might be holding the file open.
- SQL Server Permissions: Verify that SQL Server has the necessary permissions to delete the file. Sometimes, insufficient permissions can cause this issue.
- Audit Configuration: Review your SQL Server audit configuration. If you have set a maximum number of files without enabling rollover, SQL Server might not be able to delete old files. Consider using the MAX_ROLLOVER_FILES option instead of MAX_FILES1.
- Manual Deletion: If the file is not in use and permissions are correct, try manually deleting the file after stopping the SQL Server service temporarily.
If these steps don’t resolve the issue, you might need to look into more specific configurations or potential bugs related to your SQL Server version2.