Deployment Solution

 View Only

Deployment Server 6.9 - A Quick-Start Course, Part 6: SQL Server Recovery Models 

Jul 09, 2010 12:37 PM

To all those expecting to finally start using Deployment Server -my apologies. It's a quick return to Microsoft SQL Server I'm afraid. We need a brief chat about SQL Server's recovery models.

You see, a big gotcha which often catches unsuspecting Deployment Server administrators unaware is the problem of unchecked growth in the transaction logs. This will manifest in odd ways in the Deployment Console -clients not running tasks being the big one. The first impulse when this happens is to assume that it's an Altiris problem, so naturally this is the application you'd focus on. And of course, by attacking the wrong end of the problem you may well end up spending many days in fruitless troubleshooting.

So, pay attention. Ten minutes spent here might save you a lot of time later.

Quick Intro into MS SQL Server

When a new database is created, traditionally the default setting in SQL is for each transaction to be logged to file. This is so that your database can be restored back to any point in time covered by the log. This is nifty, but comes at the cost of your database needing maintenance. Without loving care, these transaction logs can grow and grow, until eventually they become so immense that system stability is compromised and things get weird.

So, let's start with the basics. When you create a database in SQL server, it will have at least two files;

  • <database>.MDF
  • <database>_log.LDF

The first holds the database data. This file is loaded when SQL server starts, and gets updated at each checkpoint1. When a transaction occurs which modifies data, this transaction is appended to the end of the second file, which we call the transaction log.

Backing up the transaction log

The speed at which your transaction log grows will depend on how fast your data changes. In order to stop the log from growing excessively, you have to back it up and then remove from it all the transactions that have now been successfully stored in the backup file.

Backing up the transaction log is a standard database management task, and is required for point-in-time disaster recovery.

MS SQL Database Recovery Models

The recover models for MS SQL are:

  1. Simple
    Effectively no transaction log, so database restores only possible using previous full database backups
  2. Full
    Point-in-time recovery possible using last full backup and transaction log
  3. Bulked-Logged
    Just as in the full logged case, the transaction log allows full point-in-time recovery in conjunction with last full backup. This mode provides more efficient logging for databases targeted by bulk updates. This can happen for example when SQL Servers undergo a nightly bulk update as part of a synchronisation process, and in this case you might temporarily switch the database recovery mode to bulk-logged for the duration of the sync.

The simple recovery mode is interesting. Every time the database synchronises with the data file on the disk (the checkpoint) it truncates the transaction log without a backup. This means that should you lose your data file, you have no idea of what transactions occurred since your last database backup. In short, your disaster recovery plan is to return your database to the time of your last backup.

The full and bulk-logged models allow for a growing transaction log. As all transactions are recorded you can restore you database from your last backup, and roll on the subsequent transactions from the log.

SQL Server 2008 Default Recovery Model

The default recovery model Microsoft uses for databases has recently changed with the advent of SQL Server 2008. In SQL 2000 and SQL 2005, the default recovery model was bulk-logged. In SQL 2008 however it's changed to simple.

This sounds terrible -the default is now not to log transactions?? Yep, and the reasoning is actually sound -most people installing SQL Server won't be doing it because they are SQL administrators, they'll be doing it because another application requires it. In such scenarios, you want SQL to install with its most stable, minimum-overhead configuration. As unchecked transaction log growth is such a problem, Microsoft have changed their default recovery model with the release SQL 2008 to work around the issue.

In the case where a SQL Server administrator is installing the product, they'll know all about recovery models and will change the model if necessary, putting the maintenance plans in place as required.

Since SQL 2000 I have personally always recommended that Altiris Administrators change the recovery model from bulk-logged to simple because,

  1. No chance of the transaction log ever growing too large and bringing your database/server down.
  2. Transaction logs can be quite big. Keeping backups can use quite a lot of disk space.
  3. The data in the eXpress SQL database is not rapidly changing. Restoring the database solely to the previous night's backup is rarely an issue

So, to my mind the simple recovery model is completely adequate.

Confirming Your Database Recovery Model

  1. Open up SQL Server Management Studio (available for both SQL 2005 and SQL 2008)
  2. Login at the authentication dialog
  3. In the Object Explorer navigation folder, right-click the express database and select 'Properties'
  4. Under the 'Options' page, ensure that the recovery mode is configured as Simple.

  5. Click 'OK' and exit SQL Server Management Studio

Why should I backup my database?

Backing up the database is critical on a production server. We all know it is, so why don't we all do it? Here's a list of good reasons to backup your database just in case you are not yet convinced. I've divided these reasons into two sections for clarity.

I leave it to you to discern into which of the above categories most database restores emerge from. The point I'm trying to make here is that a robust database backup strategy is essential, and as it happens the maintenance plan designer and wizards are pretty intuitive. So please backup your databases, especially if you are a tinkerer by nature, like pubs, and occasionally work in the evening.....

Why Shouldn't SQL Express be used in Production?

It might surprise you that the overriding reason for avoiding the SQL Server Express editions in production environments is not performance. Yes, it's true that SQL Express can only utilise a single CPU and 1GB of RAM, but for Deployment Server this isn't a huge problem (assuming nothing else is on-box). The problem with the Express Editions stems from the deliberate omission of the SQL Server agent, and consequently the lost ability to build and execute database maintenance plans2.

So, keep the Express editions to your test & development machines. As soon as your servers hit production buy your SQL licenses and put decent maintenance plans in place.

Footnotes:

1 At a checkpoint, the database in memory is flushed back to the data file on the hard disk. This ensures the data file remains current.

2 Yes, you can get around this with T-SQL scripts and windows scheduled tasks, but I'd rather on the whole that you didn't.

Return to Index

Read Part 7: Deployment Server 6.9 - A Quick-Start Course, Part 7: The Deployment Console

Statistics
0 Favorited
0 Views
3 Files
0 Shares
0 Downloads
Attachment(s)
jpg file
ds6-6-1.jpg   21 KB   1 version
Uploaded - Feb 25, 2020
jpg file
ds6-6-2.jpg   64 KB   1 version
Uploaded - Feb 25, 2020
jpg file
ds6-6-3.jpg   83 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Jul 15, 2010 05:57 AM

Hi Ian
As I have said before I only disagree with the comment that SQL Express 2005/ 2008 cannot be used in production. Apart from this you guide is very good for someone who just starting with DS.
 
The point I was trying to bring across that when someone is implementing Deployment Solution he/she needs to consider all the options and different scenarios for the DS use.
I totally agree that for the development environment SQL Express is a way to go,
but for production is a matter of the careful and thoughtful consideration of all the contributing factors in the particular environment one will be implementing the deployment server.
 
I’m just trying to share my own experience with the solution as I still remember how frustrating it can be when you are implementing a new product.

Jul 15, 2010 04:51 AM

Hi Andrey,

Hey -I agree technically there is no issue with SQL Express on a standalone DS box. My opinion however is that for people starting out with Deployment Server (remember this is a training course) is that they should not use SQL Express outside of the dev environment.

Personally, I use SQL Express extensively and have lots of T-SQL scripts to ensure that the backup and maintenance operations are performed.  However, the full versions of SQL releases from the DS admin the headache of having to delve into T-SQL just to give your server a production footing, and also makes the server more manageable by other people.

And of course there are many out there (like you) who have such confidence with both SQL and  DS that business operations will not be marginalised by using SQL Express. And that's brilliant. Its just not the way I recommend those new to the product  to go.
 

Jul 14, 2010 11:12 AM


Hi Ian
I disagree with the comment that SQL Express 2005/ 2008 cannot be used in production.
It depends on:

  • how many clients you will manage by your deployment  server
  • will you use it just for the initial machine build or for day to day software deployment  as well
  • is the cost of full SQL license acceptable to you/ your business
 
It’s true that SQL Express 2005 does not have a lot of maintenance/ recovery tools.
But do you really need it?
You can still manually dump logs and shrink DB manually if needs to, but well configured Deployment Server’ DB is very small.
 
Lets assume that you use your DS for the initial deployment only and SQL Express is installed locally. On a one sad day your DS has died and you need to build a new one or resurrect a dead one.
From experience I will tell that it is much faster and easier to build a new server with the same name and IP address.
Obviously you have lost all the history about when you imaged your PCs, but do you really need it.
As long as you back up the following:

  • Express share
  • Your custom images and packages
  • You jobs and tasks
  • And of course document the whole installation process and any changes you have done since the original installation
You will be fine.

I have done and it takes about 2 working days to build a server from scratch, install Deployment Server, configure it and import all your tasks.
All your existing PCs will connect back, but if you had several custom PC groups they will not be there, just in the route of the PCs tree.
 
What I am saying is that when you implementing Deployment Server you need to decide how are you going to use it and do you really need that expensive SQL license.
 
Last note: DB installed locally to Deployment Server machine will result in a more stable solution, because connective loss to the remote DB usually results in the Deployment Server hanging.

Related Entries and Links

No Related Resource entered.