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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 database shrink

Author  Topic 

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 05:18:27
hi.

currently i have a database on simple recovery model and a schedule grows the db to 1gb every time the space available get less then 100 mb, so there is always free space,

but now i have another problem, sql auto shrink is on to allow the log file to be shrunk but the db also shrinks at the same time, is it possible to only shrink the log file and not the db through sql and not using the (backup log)

thanks
GP

Carat
Yak Posting Veteran

92 Posts

Posted - 2008-10-09 : 05:49:43
You can schedule a job where you use dbcc shrinkfile.
Go to Top of Page

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 05:53:29
yes thanks, i did add it to the script i created,
i just thought sql could do it on its own.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 08:19:45
You don't have to worry about Log file growth if you are in simple Recovery Model.It truncates inactive log.
Go to Top of Page

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 08:51:35
thank you so much, sodeep,

where can i get the info regrading this?
Go to Top of Page

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 08:54:10
hi,

i just tested it on a local DB and it doesn't work, using sql 2005 std edition
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 08:55:32
quote:
Originally posted by gavis

thank you so much, sodeep,

where can i get the info regrading this?


In books online.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 08:55:52
quote:
Originally posted by gavis

hi,

i just tested it on a local DB and it doesn't work, using sql 2005 std edition



what did you test?
Go to Top of Page

Carat
Yak Posting Veteran

92 Posts

Posted - 2008-10-09 : 09:39:48
When you use the Simple recovery model it will indeed truncate the inactive log. But if your log file is for example 1GB en it grows to 10GB, your log file will stay at 10GB and it will not automatically shrink back to 1GB.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 09:43:33
quote:
Originally posted by Carat

When you use the Simple recovery model it will indeed truncate the inactive log. But if your log file is for example 1GB en it grows to 10GB, your log file will stay at 10GB and it will not automatically shrink back to 1GB.



I didn't say that.You should shrink it but not regularly with job.
Go to Top of Page

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 09:54:02
is there any other way beside a job and physical entering a script,
Go to Top of Page

gavis
Starting Member

39 Posts

Posted - 2008-10-09 : 10:10:31
and is there a way to disable a auto shrink via a script?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 10:15:19
quote:
Originally posted by gavis

and is there a way to disable a auto shrink via a script?




Right click Database - Properties- Make False for AutoShrink
or
Sp_dboption "Databasename",'Auto Shrink','False'
Go to Top of Page
   

- Advertisement -