SQL log filling up - how to safely delete/reduce

Emergency! I'm out of space on a critical engagement, but the SQL log is filling up and I don't know how to safely delete or reduce it! Can you help me with a quick fix? It's 12 GB and I don't think I need to roll anything back. Just need the space on my hard drive!

Thanks
JC_LivesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

JC_LivesAuthor Commented:
For example can I run this code safely? Do I really have to fully back up the database? What if I don't need a backup??

DBCC SHRINKFILE(<log_file_name_Log>)
BACKUP LOG <database> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<log_file_name_Log>)

Thanks!
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
Your database is set to full recovery mode which is causing log files to grow.  If you do not need point and time recovery then you could change recovery mode to simple.  If you need full/point and time recovery then you need to perform backup and then truncate the log file.  All you need to do is backup the transaction logs (you do not need to backup the full database).  if there are lots of transactions committed against your database, you could backup the transaction logs multiple times.  Command to backup log is below:

backup log dbname to disk='dbname-log.bak'

Run the dbcc shrinkfile command after this

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
Deepak ChauhanSQL Server DBACommented:
but the SQL log is filling up

This is sql error log file or database log file.

1. If your error log file is growing , you can delete or move the old archived error log file from log folder. After that check which error is filling the error log file.

2. If database Transaction log file is growing.
    First check why database T log file not truncating using this query.
     
select name,recovery_model_desc, log_reuse_wait_desc from sys.databases where log_reuse_wait_desc !='NOTHING'

if log_reuse_wait_desc column showing like 'log backup' , you can take the transaction log backup and shrink the log file.
Vitor MontalvãoMSSQL Senior EngineerCommented:
Did you solve your problem?
Do you have any backup plan that includes transactional log backups?
JC_LivesAuthor Commented:
Thanks so much.
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.