When I attempt to optimize a database, I keep receiving the below error message in my error logs despite that I've shrink the data and log files:
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1105: [Microsoft][ODBC SQL Server Driver][SQL Server]Could not allocate space for object 'AUDIT_LOG' in database 'MOEDMS' because the 'PRIMARY' filegroup is full.
The primary data file size is 99mb of 150mb allocated. The log file size is 29mb of 200mb allocated. The file sizes are restricted. This is not by choice, but what the customer wants.
The code I used to shrink the log and data files is below with the results in the attachment. The first result is the log file.
USE MASTER
BACKUP LOG MOEDMS WITH TRUNCATE_ONLY
GO
USE MOEDMS
DBCC SHRINKFILE (MOEDMS_Log, 1)
GO
USE MOEDMS
DBCC SHRINKFILE (MOEDMS, 1)
GO
Why am I receiving this error and how can I fix? Thanks.
Start Free Trial