Transaction Log too big - Need to free some space

Hello,
I need to free up some space at our server, and I noticed that one database's transaction log is getting too big - the database is 1GB and the transaction log 7GB! I have read through the inet for soloutions like shrink, truncate, etc but i got a bit confused. So I need a more structured step approach of what I should do.

Also I want to know if truncating or shrinking the transaction log will cause loss on its data... moreover the server is lacking resources so i need to do whatever overnight (scheduled job)

Thank you
takis_1234Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

billy21Commented:
USE MASTER
exec sp_helpdb DBNAME
BACKUP LOG DBNAME TO DISK = 'C:\DBNAME.bak' with init
DBCC SHRINKDATABASE ('DBNAME')
BACKUP LOG DBNAME TO DISK = 'C:\DBNAME_log.bak' with init
DBCC SHRINKDATABASE ('DBNAME')
exec sp_helpdb DBNAME

Repalce DBNAME with the name of your database.  Backing up the log also truncates it.  Backing up twice frees even more space for some reason.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wael_tahonCommented:
I solved this problem in the past two weeks

check
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21190334.html
0
takis_1234Author Commented:
if something goes wrong, will i be able to roll back to the original status of the transaction log from these backups without any loss?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

takis_1234Author Commented:
...also the sql server is preferable not to be restarted
0
billy21Commented:
There is no need to restart the SQL Server.  If something goes wrong you can restore the backups.  In the above example the 2 backups overwrite each other.
0
billy21Commented:
>In the above example the 2 backups overwrite each other

Ignore that they don't overwrite each other.  Just make sure you're using two different filenames for each of the two backups.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.