|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:47 AM
Points: 5,201,
Visits: 11,151
|
|
what is the recovery model of your database?
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 12:46 PM
Points: 1,493,
Visits: 239
|
|
ScottPletcher (1/10/2012)
Given that this is SQL 2008 (or SQL 2005 at least), you mean: SELECT * FROM test.sys.database_files right? 
Yes of course
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:09 AM
Points: 5,266,
Visits: 11,197
|
|
I would not expect it to give the error you see, but anyway the truncateonly option has no effect when applied to a log shrink
---------------------------------------------------------------------
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 9:47 AM
Points: 5,201,
Visits: 11,151
|
|
when the database is in full recovery model and you delete a log file, it will still list in sys.database_files and sys.master_files. You must take a transaction log backup and the file will be removed from the catalogs mentioned above.
For databases in simple recovery the file will go immediately!
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 7:27 AM
Points: 111,
Visits: 548
|
|
To be safe, you really should run against test.sys.database_files The file name and info matches in sys.database_files, sys.master_files, sys.sysaltfiles and dbo.sysfiles...
what is the recovery model of your database? We are in simple recovery and I ran a checkpoint before attempting to shrink the logs
I would not expect it to give the error you see, but anyway the truncateonly option has no effect when applied to a log shrink I have used this script on other servers and been able to free up log space, what should be used?
It's a puzzle, thanks for all your help so far :)
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:09 AM
Points: 5,266,
Visits: 11,197
|
|
I would not expect it to give the error you see, but anyway the truncateonly option has no effect when applied to a log shrink
I have used this script on other servers and been able to free up log space, what should be used?
the parameter is ignored, so the shrink command defaults to trying to shrink to the default file size (size the file was created). You should specify a target size.
---------------------------------------------------------------------
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 1:00 PM
Points: 2,610,
Visits: 3,119
|
|
jpomfret7 (1/10/2012)
To be safe, you really should run against test.sys.database_files The file name and info matches in sys.database_files, sys.master_files, sys.sysaltfiles and dbo.sysfiles... what is the recovery model of your database? We are in simple recovery and I ran a checkpoint before attempting to shrink the logs I would not expect it to give the error you see, but anyway the truncateonly option has no effect when applied to a log shrink I have used this script on other servers and been able to free up log space, what should be used? It's a puzzle, thanks for all your help so far :)
I just always did this when needed:
USE test DBCC SHRINKFILE(2,20) Since we already know that the fileid is 2, go ahead and try this.
Thanks,
Jared SQL Know-It-All
How to post data/code on a forum to get the best help - Jeff Moden
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 7:27 AM
Points: 111,
Visits: 548
|
|
USE test DBCC SHRINKFILE(2,20) Since we already know that the fileid is 2, go ahead and try this. Hooray!! That worked!
Did some additional testing there must be something weird going on with the file name because using the file id instead of logical name for DBCC SHRINKFILE(2, TRUNCATEONLY) works also.
Still a weird issue but thanks everyone for there help on this!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:09 AM
Points: 5,266,
Visits: 11,197
|
|
Interesting, thanks for posting that back.
Just curious, if you did still use truncateonly (naughty ), what did the file shrink to?
---------------------------------------------------------------------
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 7:27 AM
Points: 111,
Visits: 548
|
|
|
|
|