06/06/2012
by Marlon Ribunal
1 Comment

Getting started with SQL Server on private cloud

I have been invited to a private beta of SQLDirector by ScaleGrid. “SQLDirector is a MS SQL as a Service (SaaS) solution for the private cloud.” It is a software solution for your private cloud or virtualization infrastructure.

SQLDirector makes the deployment of SQL Server on virtual infrastructure quick and easy by bypassing the complexity of configuring virtualized environment with intuitive single-click wizard.

“SQLDirector allows easy one click provisioning, consolidation and virtualization of database instances.”

Each SQL Server instance is deployed to a machine pool that is mapped, in my case, to a VMWare vCenter ResourcePool (vCenter Server 5.0). According to their website, “The ScaleGrid solution works across heterogeneous virtualization platforms like VMware, Microsoft System Center Virtual Machine Manager (SCVMM), Citrix XenServer etc.”

In the beta, I only have two options for my machine pool mapping: System Center Virtual Machine Manager 2012 and VMware vSphere 5.0.

Scale Grid is generous enough to provide me my own machine that I can access via VPN (thanks to Ankit!).

Let me walk you through the the Scale Grid software. I am creating a SQL Server 2012 database in this demo:

Single Click Wizard

Scale Grid Database Wizard

SQL Server Instance (beta only supports New instance)

SQL Director Instance creation

Setting up Authentication

SQL Director Authentication

Database Setup

SQL Director Database Setup

High Availability Setup (not available in beta)

SQL Director provides High Availability

SQL Director Provisioning Steps

Scale Grid SQL Director Provisioning Steps

Machine/Instance Information

Virtual Machine created by Scale Grid

SQL Server Status on SQL Director

SQL Server Status on SQL Director

Accessing The SQL Server On The Private Cloud

Connecting To The Cloud SQL Server on SQL Director

SQL Server On Private Cloud via SQL Director

06/04/2012
by Marlon Ribunal
1 Comment

Review of “Start Here! Learn Microsoft Visual C# 2010”

Disclaimer: I wrote this review as a participant to O’Reilly Blogger Review Program.

Review of "Start Here! Learn Microsoft Visual C# 2010"If you’ve never seen a programming code in your life and want to build a simple program without really trying to learn how to code first, this might just be a good book for you.

If you want to learn programming per se, this is not a good book to start with. You’ll learn to build some simple GUI’s to handle some data and simple data manipulation.

This book introduces you to many aspects of C# Development like LINQ, XML, REST and SOAP, WPF,and Silverlight. It also walks you through tracing and debugging your applications.

Although it covered a little bit of LINQ and Web Services, it doesn’t have anything about database development. I expected it to have some examples on SQL Server. And I think that is the biggest negative of this introductory book.

I doubt that you’ll get a good grasp of C# programming after reading the book but you will get comfortable using the Visual Studio IDE. Majority of the samples are “no-code applications” (drag-n-drop using the built-in controls provided by the IDE).

I recommend this book only if this is the first book you’ll read about programming in .NET/C#. As the title of the book suggests, this is a starter book. If you’ve built GUI’s with some database backend, you don’t need this book.

05/09/2012
by Marlon Ribunal
3 Comments

Your SQL Server database just failed, can you restore the backup?

It’s one thing to be able to backup a database, it’s another thing to be able to restore it into an operational database in case of failure. We can run a simple TSQL to check the validity of a backup file. We can do something like this:

[sql] RESTORE VERIFYONLY FROM DISK = ‘C:\TestDB.bak'[/sql]

It’s easy, right? You don’t have to have some ninja skills to run that statement. Run the verification, and if SQL Server validates the backup, your job here is done. Yes to that, only if you can rely on VERIFYONLY.

Valid doesn’t mean you can restore it

The fact is you can’t rely on VERIFYONLY for real backup verification. It doesn’t guarantee that you can RESTORE the backup although it might report your database backup as VALID. If it reports validity, it’s only guaranteeing that it can READ the backup file, but not necessarily for restoration. “Validity” in this case is a test for whether the backup file is readable or not.

Let’s run an example.

For this example let’s borrow Paul Randal’s corrupt database backup. Let’s pick “Sample 2008 R2 Fatal Corruption Databases”. And that is because I am running a SQL Server 2008 R2 on my laptop.

Let’s verify the CorruptDemoFatalCorruption1.bak backup file and see if SQL Server validates it:

[sql]
RESTORE VERIFYONLY FROM DISK = ‘C:\BackupTest\CorruptDemoFatalCorruption1.bak’
[/sql]

This is what SQL Server found:

RESTORE VERIFYONLY Only checks the validity of backup file but not the copy of the database within that backup file

(For the sake of this example, let’s just ignore the fact that you should be monitoring the health of your databases.)

The best you could do to make sure that you can restore your backup is to actually restore it in a test server. I’m sure you’re going to have some fun doing that on hundred’s of databases.

Third-party backup and restore tool

This is where third-party backup and restore tools can easily help. Let’s take a look at the latest version of Red Gate’s SQL Backup Pro (v.7).

Since we’re talking about validity of a backup for restoration, let’s take a look particularly at one of the new features of SQL Backup Pro v.7 – Automated Backup Verification and Restore. I’ll provide a couple of links at the end of this post if you want to check the demo of the new capabilities of the application. Let’s zoom in to the verification of a backup.

Let’s restore the backup CorruptDemoFatalCorruption1.bak. To check for the data and log files needed for restoration, just do RESTORE FILELISTONLY first.

[sql]
RESTORE FILELISTONLY
FROM DISK = ‘C:\BackupTest\CorruptDemoFatalCorruption1.bak’
[/sql]

Then restore:

[sql]
RESTORE DATABASE CorruptDemoFatalCorruption1
FROM DISK = ‘C:\BackupTest\CorruptDemoFatalCorruption1.bak’
WITH MOVE ‘DemoFatalCorruption1’
TO ‘C:\BackupTest\RestoreTest\Corruption1.mdf’,
MOVE ‘DemoFatalCorruption1_log’
TO ‘C:\BackupTest\RestoreTest\Corruption1.ldf’
[/sql]

We should get a message similar to this:

Restoring a corrupt database backup

Let’s cut to the chase and go straight to the verification process. Like I said, I’ll provide links at the end of this post if you want to check all the features of SQL Backup Pro v7.

For this demonstration, I’ve already created a backup of CorruptDemoFatalCorruption1 in advance using SQL Backup Pro. Suppose we’re not aware of the health  status of the database (we know that it’s a corrupt database).

SQL Server backup using SQL Backup Pro from Red Gate

Now that we have the backup, the next thing we want to do is verify that backup and make sure that we can restore it. We can do the verification by creating a Schedule Restore Job and running it. At step 4 of 7 of the process, we specify verification options for the restored database as shown below:

Verifying SQL Server Backup Restore With SQL Backup Pro v7

When run, SQL Backup Pro v7 provides the Outcome status of the restore. In our case, we know that our database restore will fail, and SQL Backup Pro accurately tells us that:

SQL Backup Pro v7 Failed Verification of a SQL Server Backup

Of course, you can check where the Database Consistency Check failed:

DBCC Results Produced By SQL Backup Pro v7

Grant Fritchey (Blog | @GFritchey) have produced the following resources to demo the new features of SQL Backup Pro v7:

SQL Backup Pro for the Accidental DBA (article)

Introduction To SQL Backup Pro v7 (video)