Solved

Trunicate Transaction Login in SQL 2008

Posted on 2014-02-09
6
266 Views
Last Modified: 2014-02-25
My SQL 2008 doesn't backup for a long time and the Log file partition is full.

After backing up the transaction log, the size is still remain the same. What else can I do to free up the space in the transaction log file ?

Tks
0
Comment
Question by:AXISHK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:Tony303
ID: 39846640
I'd shrink the Database,
Then check the log file size.

To stop this happening again,
I'd do a full backup of the DB, then institute an hourly log backup.

Generally, a daily full backup and hourly log backups will suffice.

T
0
 

Author Comment

by:AXISHK
ID: 39846697
The log will be automatically expanded. How to truncate it to a smaller size ?
0
 
LVL 12

Expert Comment

by:Tony303
ID: 39846705
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:AXISHK
ID: 39848944
Is there a sample script that I can reference to backup the database and Log onto a portable HDD.

- I need to backup the database and transaction log onto a portable device.
- truncate the transaction log
- shrink the log file

To test my understanding, backup transaction log with truncate will only remove the committed transaction but it can't resize the physical size of the log. I need to issue DBCC to shrink the transaction log (eg. resize it to 10Mb in the following case).

DBCC SHRINKFILE (<LogName>, 10240) WITH NO_INFOMSGS

What's the difference if I only issue DBCC SHRINKFILE((<LogName>) ?

Can we shrink the database ? If yes, under what situation ? Tks again.
0
 
LVL 12

Accepted Solution

by:
Tony303 earned 500 total points
ID: 39849135
Hi,

I may run out of time on all these questions in 1 post...
But here goes...

I need to backup the database and transaction log onto a portable device.

I'd use the SQL Server Management Studio Maintenance Plans, create a new plan using the wizard and choose the Backup Database Task.
Once you have made the selections, there is a "View T-SQL" button.
This will show all the SQL needed to execute what you have created in the Wizard.

For each DB selected you'd see something like this....
BACKUP DATABASE [YourDB] TO  DISK = N'\\yourbakackupPath\YourDBName_backup_2014_02_11_161719_3854038.bak' WITH NOFORMAT, NOINIT,  NAME = N'YourDBName_backup_2014_02_11_161719_3854038', SKIP, REWIND, NOUNLOAD,  STATS = 10
GO

Open in new window


Ditto process for a .trn file backup, routine. Look at doing a new Maintenance Task wizard and go from there.

portable device

OK, Yes, I have the exact situation on a legacy machine and no internal disk space that I have to keep running for a few more months yet. So, the external drive is connected to the usb port on the machine that is hosting SQL. This drive has been made visible to the computer, I am not 100% sure how the engineers rigged it, but I am referencing it via a UNC path using an ip number.

So my path looks more like this

DISK = N'\\192.168.10.10\
Rather than this... I wrote above...
DISK = N'\\yourbakackupPath

Be aware backup up over USB is slow, real slow.

T
0
 

Author Closing Comment

by:AXISHK
ID: 39887693
Tks
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question