Friday, September 21, 2012

Quick and dirty SQL 2008 R2 SP2 Slipstreaming

So I've been working to automate SQL 2008 R2 installation.  When I realized I kept getting updates after the install, I decided to find a way to speed that up. 

I found a script to slipstream SP1 on Fran's blog here:

Quick way to create a SQL Server 2008 R2 installer with integrated SP1 (Slipstream)

But it was dealing with SP1.  So, a quick "replace" in Notepad++, and hey presto, it works for SP2 as well.  here's the batch file:

 @ECHO OFF
  
 ::File Verification
  
 IF NOT EXIST "C:\SQLServer2008R2_SP2\" GOTO ERROR
  
 IF NOT EXIST "C:\SQLServer2008R2SP2-KB2630458-x86-ENU.exe" GOTO ERROR
  
 IF NOT EXIST "C:\SQLServer2008R2SP2-KB2630458-x64-ENU.exe" GOTO ERROR
  
 IF NOT EXIST "C:\SQLServer2008R2SP2-KB2630458-IA64-ENU.exe" GOTO ERROR
  
 ::Extract each of the SQL Server 2008 R2 SP1 packages to C:\SQLServer2008R2_SP2\SP
  
 ECHO Extracting SP files to C:\SQLServer2008R2_SP2\SP...
  
 start /wait C:\SQLServer2008R2SP2-KB2630458-x86-ENU.exe /x:C:\SQLServer2008R2_SP2\SP
  
 ECHO Extract of SQLServer2008R2SP2-KB2630458-x86-ENU.exe Completed
  
 start /wait C:\SQLServer2008R2SP2-KB2630458-x64-ENU.exe /x:C:\SQLServer2008R2_SP2\SP
  
 ECHO Extract of SQLServer2008R2SP2-KB2630458-x64-ENU.exe Completed
  
 start /wait C:\SQLServer2008R2SP2-KB2630458-IA64-ENU.exe /x:C:\SQLServer2008R2_SP2\SP
  
 ECHO Extract of SQLServer2008R2SP2-KB2630458-IA64-ENU.exe Completed
  
 ECHO.
  
 ::Copy Setup.exe from the SP extracted location to the original source media location
  
 ECHO Copying Setup.exe to C:\SQLServer2008R2_SP2
  
 start /wait robocopy C:\SQLServer2008R2_SP2\SP C:\SQLServer2008R2_SP2 Setup.exe
  
 ECHO Setup.exe copied
  
 ECHO.
  
 ::Copy all files, not the folders, except the Microsoft.SQL.Chainer.PackageData.dll, in C:\SQLServer2008R2_SP2\SP\<architecture> to C:\SQLServer2008R2_SP2\<architecture> to update the original files
  
 ECHO Copying files to C:\SQLServer2008R2_SP2\
  
 start /wait robocopy C:\SQLServer2008R2_SP2\SP\x86 C:\SQLServer2008R2_SP2\x86 /XF Microsoft.SQL.Chainer.PackageData.dll
  
 ECHO Files from C:\SQLServer2008R2_SP2\SP\x86 copied
  
 start /wait robocopy C:\SQLServer2008R2_SP2\SP\x64 C:\SQLServer2008R2_SP2\x64 /XF Microsoft.SQL.Chainer.PackageData.dll
  
 ECHO Files from C:\SQLServer2008R2_SP2\SP\x64 copied
  
 start /wait robocopy C:\SQLServer2008R2_SP2\SP\ia64 C:\SQLServer2008R2_SP2\ia64 /XF Microsoft.SQL.Chainer.PackageData.dll
  
 ECHO Files from C:\SQLServer2008R2_SP2\SP\ia64 copied
  
 ECHO.
  
 ::Create or modify DefaultSetup.ini
  
 IF NOT EXIST "C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini" GOTO CREATEINI
  
 ECHO Modifying DefaultSetup.ini
  
 TYPE C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini > C:\SQLServer2008R2_SP2\x86\Temp_DefaultSetup.ini
  
 ECHO PCUSOURCE=".\SP" >> C:\SQLServer2008R2_SP2\x86\Temp_DefaultSetup.ini
  
 DEL C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini
  
 REN C:\SQLServer2008R2_SP2\x86\Temp_DefaultSetup.ini DefaultSetup.ini
  
 ECHO.
  
 GOTO COPYINI
  
 :CREATEINI
  
 ECHO Creating or modifying DefaultSetup.ini
  
 ECHO ;SQLSERVER2008 R2 Configuration File > C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini
  
 ECHO [SQLSERVER2008] >> C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini
  
 ECHO PCUSOURCE=".\SP" >> C:\SQLServer2008R2_SP2\x86\DefaultSetup.ini
  
 ECHO.
  
 :COPYINI
  
 ::Copy DefaultSetup.ini from x86 to x64 and ia64 folders
  
 ECHO Copying DefaultSetup.ini from x86 to x64 and ia64 folders
  
 start /wait robocopy C:\SQLServer2008R2_SP2\x86 C:\SQLServer2008R2_SP2\x64 DefaultSetup.ini
  
 start /wait robocopy C:\SQLServer2008R2_SP2\x86 C:\SQLServer2008R2_SP2\ia64 DefaultSetup.ini
  
 ECHO.
  
 ECHO ==============================================================================
  
 ECHO OPERATION COMPLETED
  
 ECHO Use C:\SQLServer2008R2_SP2\Setup.exe to install SQL Server 2008 R2 + SP2
  
 ECHO ==============================================================================
  
 ECHO.
  
 GOTO FIN
  
 :ERROR
  
 ECHO ==============================================================================
  
 ECHO FILE VERIFICATION FAIL, PLEASE CHECK THE FOLLOWING:
  
 ECHO THE DIRECTORY C:\SQLServer2008R2_SP2\ EXISTS
  
 ECHO SQLServer2008R2SP2-KB2630458-x86-ENU.exe FILE IS LOCATED IN C:\
  
 ECHO SQLServer2008R2SP2-KB2630458-x64-ENU.exe FILE IS LOCATED IN C:\
  
 ECHO SQLServer2008R2SP2-KB2630458-IA64-ENU.exe FILE IS LOCATED IN C:\
  
 ECHO ==============================================================================
  
 ECHO.
  
 :FIN
  
 PAUSE
  

Thanks to Fran Lens for the heavy lifting. 

Monday, September 17, 2012

vSphere 5.1 ESXi Unattended script building


So I'm slowing working my way through building an automated script for a project I'm on. I had some issues a while ago with this process as every time I would specify a ks.cfg on a USB, it would give me an error on initializing a partion. I still to this day don't know what the issue was. I posted a question on the VMware community boards, but no one ever solved.

Well, the good news is, I've at least passed that point and am working my way through. As I do, I'll update progress on this post. By the end, it should show a running log of what it took to get to the end script, along with said script.

So, I'll start with the other sources I'm pulling info from:


Duncan Epping's Yellow Bricks post about an install script. Great starting point.




William Lam's VirtualGhetto posts about kickstart scripting and esxcli


Official docs

So the offical docs document how to start using the custom script that's included on the stock installation media. Here's how:

1.      Boot to stock installation

2.      When presented yellow bar and the option to, press SHIFT+O to get the boot prompt.

3.      This will give you a prompt like the following ">runweasel" with a cursor flashing at the end.


4.      Simply put a space, and add "ks=file://etc/vmware/weasel/ks.cfg " so the whole thing looks like this:

 

5.      It will chug away for awhile and finally let you know that it will reboot in Eval Mode (even if you specify a license). 
 

So, that gives us the stock ks.cfg on the disc.  Now, there’s a whole mess of places you can use your own ks.cfg from.  Here are the boot options to use them all:


Also, if you want to use a USB, you will need to format it with FAT32.  I think this might have been my initial issue.  Plus, I formatted it with a Linux box (CentOS 6.3 to be specific) and I followed these directions:


Basic script looks like this:

# Accept the VMware End User License Agreement

vmaccepteula

# Set the root password for the DCUI and ESXi Shell

rootpw --iscrypted <password hash>

# Install on the first local disk available on machine

install --firstdisk --overwritevmfs

# Set the network to DHCP on the first network adapater, use the specified hostname and do not create a portgroup for the VMs

network --bootproto=dhcp --device=vmnic0 --addvmportgroup=0

# reboots the host after the scripted installation is completed

Reboot

 

Now, you see the “rootpw –iscrypted” there with a place for a hash.  Download OpenSSL-Win32 from here:


Once you have that installed, open the command prompt and go to the openssl-win32 folder (for me c:\openssl-win32\bin), and type the following:

Openssl passwd <password you’d like encrypted>

Copy what comes out of there into your ks.cfg.
 
That’s what I have so far.  As I said, it’s a work in progress, and I’m going to try to keep this as a living post. 

Thursday, September 13, 2012

VMworld 2012 Wrap-up post

As some of you may know, I do a lot of virtualization in my day job.  My company asked that I do a blog entry post-VMworld to talk about the new technologies.  It mostly consisted of our marketing company interviewing me for the entry, and writting it themselves.  So, you will notice a significant change in "voice" on that post.  If you can find the pieces that I wrote, I'll give you a cookie. 

It's mostly fluff.  But, here's the link for all those that care:


Tuesday, September 11, 2012

vSphere 5.1 Drops

vRAM IS DEAD! HUZZAH!
At long last, VMware heard the protesters. They've done away with vRAM licensing. During the keynote of VMworld when this was announced, there arose such a cheer that only a room full of virtual geeks would ever know. It was a miserable year for licensing since last VMworld, so I'm glad it's over.
 
First off, look at the What’s New for 5.1 here.
 
At any rate, to the meat and potatoes:
 
·         VI Client Deprecated
o   One of the bigger things that came out of VMworld for me was that VMware is deprecating the VI client. If you've not used the Web Client, get used to it now. They're moving that direction. One chink in the armor is that if you need to work on an individual host, you still have to use the fat client. Additionally, plugins will take a while to move over. I've not heard of to many vendors making plugins for the web client. But VMware is developing new features ONLY for the web client. So this is going to be a bit of a difficult period of transition.
·         vCenter Single Sign-On
o   With the move to the web client, services are being broken out and a snappy new Single Sign-On piece is being introduced.  This will give you the ability to sign into the web client once, and have access to everything VMware without signing in again; vCOPS, vCloud, etc.
·         Single-root I/O virtualization
o   This is an interesting thing.  It allows the direct connection of NICs or HBAs to a VM bypassing the Hypervisor.  The VMworld session I attended briefly talked about it, and the engineer said use it with caution.  It can introduce issues in the VM, but if you’ll looking to squeeze every last I/O out of a VM, it may improve performance. 
·         Enhanced vMotion
o   vMotion WITHOUT THE NEED FOR SHARED STORAGE.  That’s right kids.  vMotion no longer needs shared storage.  Essentially what happens is Enhanced vMotion performs a Storage vMotion of the vdisks after the standard vMotion of memory and processing.  This all takes place over the vMotion network, so plan accordingly.
·         vSphere Replication
o   So, have you been having trouble with EVA replication?  Yeah, who hasn’t.  Well, vSphere Replication has been moved out of SRM and is not included with vCenter…ANY vCenter.  So, do you have Essentials+ licenses?  Guess, what.  You can use vSphere Replication.  SMBs rejoice!  You can now replicate to a secondary site.  In addition, rather than replicating at a LUN level (as you would have to with storage based replication) you replicate at the VM level.  Replicate a single VM, test SRM, lather, rinse, repeat.  Down side is, all this processing is now taking place on your virtual infrastructure rather than the storage processors.  Some people will shy away based on that.
·         Zero-downtime upgrade for VMware Tools
o   As of 5.1, VMware tools will not require a reboot.  Now, you’ll still have to reboot getting there.  But that’s it…honest.  What could go wrong? 
·         Restructured vCenter databases
o   Apparently a DRASTIC improvement has been made to the vCenter databases.  Thing, improved performance, improved storage, everything.  The jury’s still out on what happens when you UPGRADE your existing databases.  You might need to rebuild from scratch and import configuration (loosing statistics) to get the improvements.
·         Increased VM maximums
o   64 vCPUs, 1TB vRAM (super-monster VMs)
 
So, that’s the interesting points.  Anyone finding something else interesting in the new release? 
 

Monday, September 10, 2012

SQL 2012 Licensing in VMware vSphere

I was working with a customer on virtualizing SQL, and they expressed concerns about licensing SQL 2012 in a virtual environment.  This is a common concern I'm hearing, so I thought I would clarify as best I could.  I dug into the SQL Server 2012 Licensing Reference Guide ( http://go.microsoft.com/fwlink/?LinkId=230678 ) and found the following:

 
SQL Server 2012 offers expanded virtualization rights, options and benefits to provide greater flexibility for customers deploying in virtual environments. When deploying SQL Server 2012 software in virtualized environments, customers have the choice to license either individual virtual machines as needed, or to license for maximum virtualization in highly virtualized, private cloud, or dynamic environments. Maximum virtualization can be achieved by licensing the entire physical server with Enterprise Edition core licenses and covering those licenses with Software Assurance (SA). (Pg. 10)

 
Now, the key take away is “…either individual virtual machine [or] by licensing the entire physical server with Enterprise Edition core licenses” (Pg. 10).  Looking further into it, page 11 details individual VM licensing.  It points out that a minimum of 4 core licenses are required to be purchased for a VM regardless of edition or the number of cores presented (which is different from 2008 R2).  But, other than that, the number of cores presented is the number you need to license.

The last thing in terms of individual VM licensing is that Software Assurance is REQUIRED if you would like to vMotion the SQL server.  “For customers … who want to move VMs dynamically across servers … Microsoft permits License Mobility as an exclusive SA benefit for all SQL Server editions” (Pg. 11).

Now, if you plan on creating multiple SQL servers in the environment, you may want to consider the other route; “Licensing for Maximum Virtualization”.  This is where things get a little confusing.  In this scenario, you would license ALL cores on a physical host with SQL 2012 Enterprise Edition.  This would allow you to create as many VMs with SQL as the number of physical cores you’ve licensed, REGARDLESS OF THE NUMBER OF ASSIGNED VIRTUAL CORES. So, here’s their example from page 12:
 

For example, a four processor server with four cores per processor—fully licensed with sixteen core licenses—can run SQL Server software in up to sixteen VMs, regardless of the number of virtual cores allocated to each VM.

 
Now, you will need Software Assurance to take advantage of this feature.  And in addition, you’d need SA if you wanted to vMotion anyway.

That’s it in a nutshell (all-be-it a coconut shell).  There are other options, namely Server+CAL licensing options.  You can look at the document, and it details that scenario as well.  Might be worth looking at for you.  Also, I would be remiss if I didn’t say, this is a best effort interpretation of the Microsoft SQL 2012 Licensing model.  Your mileage may vary…  But, I’ve included the link to the document at the top.  You can double-check my work. 

If you have any questions, don’t hesitate to ask.  Thanks!