Question : database file shrink error

I have a database on MS SQL server 2005 with 32 GB mdf file and 6 GB ldf file, I have job that shrink the log file every day but now I am trying to shrink the data file after i have removed some big tables used for archieving.
the available space for allocation is around 27 GB but when running the shrink query it gives me an error as following:
the query :
DBCC SHRINKDATABASE(dbName, 1, TRUNCATEONLY)

BACKUP LOG dbName WITH TRUNCATE_ONLY
DBCC SHRINKFILE(dbName_Log, 1)

the error i got:
Msg 3140, Level 16, State 3, Line 1
Could not adjust the space allocation for file dbName_Data'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

(1 row(s) affected)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

and the size of the mdf file still the same 32 GB after this process !!!

could anybody help???

Answer : database file shrink error

This command is wrong 'DBCC SHRINKFILE(dbName_Log, 1)' The number 1 should be desired MB the file should be after the schrink operation.
You can use this for both mdf and ldf files.

so use 'DBCC SHRINKFILE(dbName, DesiredSizeForMDFFileInMB)'
and
'DBCC SHRINKFILE(dbName_Log, DesiredSizeForLDFFileInMB)'

//Marten
Random Solutions  
 
programming4us programming4us