Tag Archive: litespeed

How to BACKUP LOG WITH TRUNCATE_ONLY in SQL Server 2008

BACKUP LOG WITH TRUNCATE_ONLY is a dangerous command: it empties out the contents of your SQL Server’s transaction log without really backing it up.  Database administrators sometimes run this command right before shrinking their log file with a DBCC SHRINKFILE command, thereby freeing up drive space.

Why ‘truncate_only’ is not a recognized backup option.

I’ve blogged about why backup log with truncate_only is like a bear trap, and I meant it: you shouldn’t be running this command except during extreme emergencies.  When you truncate transaction logs, you lose the ability to recover to a specific point in time.

Microsoft recommends that instead of truncating logs, you switch to simple recovery mode instead.  That way you don’t generate logs you won’t be using, and you won’t incur performance impacts from repeatedly filling and truncating the logs.  You also remove the need to regularly back up the transaction log.  This has plenty of drawbacks – if something goes wrong with your database, your only option will be to restore the previous full backup.  You could lose hours – maybe even days – of data.

Microsoft recognized the problems with TRUNCATE_ONLY and removed this capability completely from SQL Server 2008.  If you try to use this command:

BACKUP LOG AdventureWorks WITH TRUNCATE_ONLY

You get an error:

?Msg 155, Level 15, State 1, Line 1
'TRUNCATE_ONLY' is not a recognized BACKUP option.

The only workaround in SQL Server 2008 is to switch the database’s recovery model to simple as shown in Books Online.  This empties out the transaction log, thereby letting the DBA run a DBCC SHRINKFILE afterwards, then switch the recovery model back to full.

That solution still suffers from most of the same problems as using TRUNCATE_ONLY – the database’s recoverability is compromised.  It’s just as bad of a solution, but unfortunately Microsoft can’t remove that workaround since we do need to put databases into simple recovery mode for other reasons.

Method 1: How to BACKUP LOG WITH TRUNCATE_ONLY in SQL Server 2008

We can fake it by not writing our backup to a real device.  SQL Server lets us use the NUL: location as a backup target, so the following will do a log backup without actually saving the contents anywhere:

BACKUP LOG MyDb TO DISK=’NUL:’

Remember, we’re still not fixing anything here: whatever caused the log file to grow in the first place can happen again and put us right back where we started.

Method 2: Use Quest LiteSpeed to Fake a Log Backup

If you don’t want to switch into simple recovery mode, and if you’re using Quest LiteSpeed for SQL Server, there’s a back door workaround.

Don’t try what you’re about to see at home. We’re what you call experts.  We’ve got years of experience that keeps us safe.  Just like TRUNCATE_ONLY, this solution has a ton of drawbacks and compromises your recoverability.  This should only be done in cases where a log has grown out of control and must be erased or else the system may crash.  In any other situation, you should consider backing up the log with conventional means.

Open a command prompt, go to the folder where the LiteSpeed engine is installed (typically \Program Files\Quest Software\LiteSpeed\Engine) and type:

sqllitespeed.exe -B log -D AdventureWorks -F e:\test.bak --nowrite

The parameters are:

  • -B log = the type of backup we’re doing, database or log.
  • -D AdventureWorks = the name of the database we’re backing up
  • -F e:\test.bak = the name of the file we’re backing up to, except that…
  • –nowrite = don’t actually write the file.

LiteSpeed will make SQL Server think it’s doing a backup, but since LiteSpeed controls what gets written to disk, it just smiles and nods while SQL Server keeps shoving information across.  “Uh-huh, yeah, I got it.  Keep that data comin’.”

Your data is not actually backed up. This is a giant problem.  Don’t leave this script lying around where a junior DBA might see it and reuse it for regular backups.  This should only be used to impress your friends with your useless knowledge of SQL Server, much like I’m doing here.  Well, heck, it’s not even my knowledge – big thanks to David Gugick and James Deen of Quest Software for pointing out this trick.

P.S.: yes, I shouldn’t have even written this technique in public, but there’s a lesson here.  We had some controversy earlier this week about shrinking databases, and I wanted to show how you can convey dangerous information with proper warning labels.  If you don’t explain this stuff, someone can stumble across your instructions in a web search, think it’s completely okay, and do it without understanding the consequences.

And before you shrink your logs, read my thoughts on that too.

Brent Ozar PLF Team

Brent Ozar PLF is a boutique consulting firm focused on understanding your environment and strategy. We partner with you to objectively identify pain points and develop solutions that align to your business goals. Your experience comes first; we share our knowledge and expertise to help you.

More Posts

Follow Me:
TwitterFacebookGoogle PlusYouTube

LiteSpeed for Oracle now available

I don’t usually talk about Quest product stuff here, but there’s one new product out that I wanted to put on your radar.  LiteSpeed, the backup software for SQL Server, is now available for Oracle too.

The product is called LiteSpeed Engine for Oracle (LEO), and like the name indicates, this focuses on the engine itself.  Those Oracle guys are pretty smart: they like scripting all their stuff instead of using pretty point-and-click GUIs like us SQL Server guys.  (That’s the spin you have to use when you talk about Oracle guys – in private, we say things like “they haven’t figured out how to use a mouse yet,” har har ho ho.)  As far as the engine goes, it’s the same stuff you like about LiteSpeed – faster backups, smaller backup files, encryption without overhead, yadda yadda yadda.

It runs on the major *nix flavors like HP-UX, AIX, Solaris, Red Hat and SuSE, but not Windows – yet.  (Dang, okay, now I’m getting jealous. The Oracle guys get all these platform choices.)

The product managers are really encouraging us to learn Oracle so that we can have better conversations about the product.  This ties into my blog earlier about learning different database platforms, heh.  I’m torn – I’d love to take this opportunity to learn more about Oracle, but Microsoft has so many cool things coming too.  Only so many hours in the day!

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Webcast: Painless Schema Upgrades (and Downgrades)

On Thursday, I’m doing a Quest Pain of the Week webcast with Michael Lato, SQLServerPedia’s T-SQL Coding Techniques Editor, to talk about handling application upgrades.  When your developers and your third party vendors come to you with new apps that need database changes, you need to make sure their changes get applied smoothly, verify that things work right, and be able to roll back database objects when things go wrong.

If you haven’t attended a Pain of the Week webcast before, here’s how they work: the first 30-45 minutes, we talk about how to handle the week’s problem from a purely native point of view.  No third party tools, no add-ons, just tips and tricks.  Then a Questie (in this case, me) talks for 10-20 minutes about what Quest brings to the table to make it easier, and finally we take your questions.

These have been pretty popular because it’s basically free training, plus you get to watch a Quest tool demo without having to sit through a sales call to see the good stuff, plus you get to ask your ugliest SQL questions to guys like Michael with a lot of experience.

In this week’s webcast, my portion of the webcast will cover how to do object-level recovery with Quest LiteSpeed 5.  One of the slick things about LiteSpeed’s object-level recovery is that it works against native file backups too, plus it works against transaction logs, so you can restore right up to the moment the table was dropped or the bad update statement ran.  I’ll even demo how to run queries against your backup files, so you can quickly see what a table or object looked like before the upgrade – and maybe avoid a restore altogether.

If you’re interested, sign up for the webcast.  If the time doesn’t work for you, we’ll have a recorded version available in a week or so.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Webcast – What’s New in LiteSpeed 5.0

I try not to do much marketing stuff on my personal blog, but when we do user group meetings, DBAs seem to be really interested in this particular topic.  If you’re interested, here’s a webcast on What’s New in LiteSpeed 5.0.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

LiteSpeed v5.0 is out!

Presto chango, version five.

This one was in the oven long before I arrived at Quest back in May, and I’ve been using it for the last couple of months.  Some of the big improvements are the ability to query backup files just like databases, the Backup Analyzer that automatically tests a bunch of compression & encryption methods for the best match on your server, much easier log shipping, the ability to read transaction logs to generate undo & redo scripts for transactions, and an all-new user interface from the ground up.

When I was working with the documentation team to tweak the v5 readme file, I had to pinch myself – I couldn’t believe I was actually working for Quest, actually a part of the team that makes this cool stuff.  As a DBA, this is about the best job you can have.  I’m really lucky.

I could just go on and on, but I won’t – for more info, hit the official Quest LiteSpeed v5.0 site.  If you have questions about 5.0, the best place to ask is on the Quest SQL Server Forums.

And now, if you’ll excuse me, I’m emailing back and forth with the LiteSpeed head honcho about what we should include in v5.1.  Time to go pinch myself again….

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Quest LiteSpeed isn’t right for everybody

Sean McCown at Infoworld wrote a blog post today that said some negative things about Quest and LiteSpeed, and I had to respond. He’s switched away from using LiteSpeed, and he had an interesting set of reasons.

“I just don’t need the centralized repository in my lab, and I do enough demos that having native SQL syntax for my backups is worth something to me.”

Everybody has different needs.

Sean and I would totally agree that labs have a different set of needs than a typical enterprise or datacenter.

In fact, if I was just doing a lot of demos like Sean, and if I wanted native SQL syntax for my backups, I wouldn’t even use a third party product at all: I’d use SQL Server 2008′s new backup compression to make my life really easy. That way, you can stay purely native, and that makes for really easy demos.

Quest LiteSpeed, on the other hand, isn’t targeted just at labs and demos. It’s targeted at DBAs who need enterprise-ready backup solutions, complex needs like log shipping, centralized reporting, log reading with undo & redo for transactions, and so on. Not everybody needs the advanced features that LiteSpeed provides, and Sean doesn’t. We would both agree that LiteSpeed is not the right product for his lab.

“Even knowing any of the devs is hard these days, and getting anyone to make any changes is next to impossible.”

At smaller companies, especially startups with a minimum of customers, developers can work directly with end users. For better or worse, Quest has a lot of customers, and I’d like to think that’s because Quest has fantastic products. (It’s a pretty good problem to have.) Our product managers coordinate feature requests across all of our enterprise customers, large and small, which helps our developers focus on what they need to do: develop great software.

Just this week, in fact, Quest Software hosted a SQL Server Customer Advisory Board at the offices in Aliso Viejo. We flew out a dozen customers for two days of meetings about our road maps, upcoming features, and asking for their input on where we go next. I wish we could bring every Quest customer out there for the same input, but on the other hand, Steve Ballmer isn’t flying me up to Seattle anytime soon to ask me what SQL Server needs to do next.

We’re in a feature freeze for our new LiteSpeed v5.0. The management tools have been rewritten from the ground up, and I’m really impressed. But there comes a point where you have to stop adding new features and just focus on testing the code, and that’s where we’re at now. Heck, I have a long list of things I want to add, but even I can’t sneak ‘em in – and I work for Quest! I’m already excited about the features I’m trying to cram into v5.1.

“Now, with the team being more corporate….”

If your main criteria for a backup product is easy access to the guy who wrote it, then Quest LiteSpeed is not the product for you.

Just a couple of months ago when I was a DBA instead of a Quest employee, though, that was not my main criteria for software selection. My main criteria included a global 24×7 support organization with experience across database technologies, a large QA team dedicated to testing mission-critical backup software on every possible platform and a product with an unbelievably strong track record. The fact that Quest was Microsoft’s 2007 Global ISV Partner of the Year again this year is proof that sometimes bigger is better.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube