I have a SQL 2005 server which has not really been maitained by our DBA. I have now taken over the task to trying to get this SQL server is as good of a shape as possible before we eventually migrate it.
My question arises in regards to the log files and probably has several parts to it, so I will try and break it down to what I already know and whats the best way to go about finding a solution.
Problem: I have several databases, some range from 256 Megs and others are at 2 GIGS. Each of these databases however have a ridicoulously large log file. The 256 mb file is around 30 GB and the 2 GB db is around 135 GB.
Now initially before my coworker had left, he had setup the agent for SQL Server in backup exec, to first run the DB backups followed by logs to truncate them. Because of the size of the log files, these backups are taking notoriously long. Now upon investigation, at first I was very initially confused w/ the defintion of truncating and shrink. I now think i understand the difference, where truncating does not nessarily reduce file space but keeps a record of the transactions that are passed / old since the last full db backup. Shrinking physically reduces the file by removing the free space from the log file.
Now I can easily solve my problem by running the shrink command on the dbs, but before I went ahead and did that, I did a bit of research and am now aware that SHRINKING is a big no, or at least that's what a number of people say. It removes the contingous filing structure of a db, causes a need for indexes to be rebuilt and overall creates a general performance hit. Not to mention that as soon as the db is required to grow again, it will and it shall.
So my question are:
How do I shrink my .ldf files w/out using the shrink command and suffering a performance penalty?
Do you guys recommend backing up my db's with SQL Agent from backupexec or maintenance plans?
How do i guage the maximum file size growth for my DB?
Can I set alerts when my db is near the maximum file size?
How do i reindex dbs and defragment db's so they are always performing optimally?
Thanks for all the help. BTW this is my first dive in SQL or any form of DB's so please excuse the confusion.