Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-04-29 : 08:00:24
|
| Giannis S writes "ok...here it goes...i have a database that was delivered by a friend and the database log file is 200 megabytes....the mdf file was 300 megabytes...i executed truncate and shrink database and i managed to reach the size of ldf=160 megabytes and mdf 220 megabytes...i know the procedure of detachment and attachment of the mdf file only etc...i was thinking if there was a script through query analyzer that could help me do the followinga)shrink the ldf file more.....let's say 50 megabytes or so...b)run the script every time i want to truncate and shrink the databasei would really really really appreciate it if you could give me an example on how to work with sp_addschedule......i want to shrink the database through this procedure but every time i tried to use it i get lost with all the parameters... THANK U IN ADVANCE WITH RESPECT.. JOHN E. STRATIGAKIS" |
|
|
iamsoden
Starting Member
1 Post |
Posted - 2003-04-29 : 08:41:58
|
| I know I'm dodging the issue, but it doesn't sound like a big database...it might just be easier to bcp out the tables, drop and recreate the database, then bcp the data back in. Everything is degragged, and you have the database and log the size you want. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-04-29 : 12:27:10
|
| You can run sp_detach_db, then run sp_attach_single_file_db. This will give you a very, very small log file. But keep in mind that when you do sp_detach_db that the database is offline during that process until you reattach. Do a forum search for these two stored procedures for more information, it has been discussed extensively here.Tara |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-04-29 : 12:55:59
|
| Have you thought about what is making the database tlogs grow, how often it grows and if truncating is really going to help you? |
 |
|
|
|
|
|