Link to home
Start Free TrialLog in
Avatar of Dynamics_Girl
Dynamics_GirlFlag for Canada

asked on

Shrink Database Log

I am trying to run the following script to shrink down our log file.  

Use AIRT
GO
backup log AIRT with truncate_only
GO
DBCC SHRINKFILE (GPSAIRTLog, EMPTYFILE)

and I receive the following error.

Could not locate file 'GPSAIRTLog' for database 'AIRT' in sys.database_files. The file either does not exist, or was dropped.

I have ran the following script to check the files

select * from sys.database_files

These are my results.......
1      9BB88248-A693-4BA1-BA06-477541ACF1EE      0      ROWS      1      GPSAIRTDat.mdf      D:\GPdata\GPSAIRTDat.mdf      0      ONLINE      353896      -1      20      0      0      0      1      0      NULL      NULL      NULL      NULL      5439000036835400237      4E169688-AE76-41D2-AD6F-F8C991C19F24      2008-11-13 16:22:43.027      NULL      NULL      NULL      NULL      NULL
2      D43F4590-0428-42A8-8F89-8FB46D8E697C      1      LOG      0      GPSAIRTLog.ldf      D:\GPdata\GPSAIRTLog.ldf      0      ONLINE      6330824      268435456      25      0      0      0      1      0      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL

Im stumped.

Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Your logical name includes the .MDF or .LDF -- which is unusual.  Please try:

DBCC SHRINKFILE (GPSAIRTLog.log, EMPTYFILE)

Open in new window

Avatar of Dynamics_Girl

ASKER

No Go
It says

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
I tried this and if gives me the same error

Use AIRT
GO
backup log AIRT with truncate_only
GO
DBCC SHRINKFILE ('GPSAIRTLog.log', EMPTYFILE)
SOLUTION
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Now that  you've successfully shrunk the log file, you might consider reading the following article on how to use periodic log backups to prevent  this from happenign again.....
http://home.hot.rr.com/graye/Articles/SQL_LogMaintenance.htm