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 2000 Forums
 SQL Server Administration (2000)
 Shrink databases

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-23 : 09:09:09
Sid writes "Hi,

Large number of databases are created every week and therefore we ran into out space problem on SQL Server.

Most of the time we shrink the databases to release good amount of space.

Questions:

1. Can I automate this process by writing a stored procedure?

2. If someone can help me in writing the stored procedure, I need to implement the following

> If the size of the ldf (log file) > 1 mb AND
> no one is using the database THEN
> I want to shrink the database.

Please help,

Thanks,

sz
sziaud@care2.com"

MuadDBA

628 Posts

Posted - 2004-02-23 : 09:54:57
Hi,

Approximately how many databases are being created each week, and why is there a need to create so many instead of just seting up a few and then letting people connect to them?

Anyhow, there is a database option for auto-shrink, have you looked into it? You could certainly automate it, but I am not sure what you mean by "no one is using the database." If you mean no one is connected, that is not too tough, but if you mean no one has updated it in x days, that is a little more complex.

If you don't do transactional backups on them, you could set your recovery model to "simple" so that the transaction log doesn't grow as much.
Go to Top of Page
   

- Advertisement -