My SQL Server 2016 database will save audit log into physical files into folder E:SQL Login Audit
.
I use a SQL query to insert those audit log file contents into a table called AuditLog
:
INSERT INTO AuditLog
SELECT
event_time,
sequence_number,
action_id,
server_principal_name,
server_instance_name,
database_name,
schema_name,
object_name,
statement
FROM
sys.fn_get_audit_file('E:SQL Login AuditFINPRD*.*', DEFAULT, DEFAULT)
WHERE
event_time > FORMAT(DATEADD(day, -1, getdate()), 'yyyyMMdd')
AND action_id <> 'LGIF'
AND [statement] NOT LIKE '%sys.spt_columns_view%'
But for the past month, this SQL query failed.
The error message is:
There is insufficient system memory in resource pool ‘internal’ to run this query
And I found the SELECT
works – it takes about 10 minutes to show the query result. But if I add the INSERT
, it will fail with the mentioned error message.
I re-started the database & server but it’s still the same. Below is the database’s memory settings. Does anyone know what the root cause is?
8