Virtually Sober

If there is free booze and Virtualization; I'm there!

Category Archives: Microsoft SQL

Automating SQL Server Live Mounts with Rubrik Alta (4.0)

How many times in your career have you tested something that totally blew you away? Your mind racing with use cases both past and present. The first VM you created? Check. Your first vMotion? Check. Your first storage vMotion? Check. But what next? I just found one to add to my list and its SQL Server Live Mounts in Rubrik Alta (4.0). So what exactly is it and why is it so amazing? Glad you asked, read on!

Read more of this post

Creating a vSphere Change Management DB for free – Step 4 of 4

For my final blog post in the 4-part series on how to create a vSphere Change Management Database for free, I’m going to show you how to prune the data. If you missed the first 3 posts check them out here:

Step 1 – Creating the SQL Database
Step 2 – Inserting data into the SQL Database
Step 3 – Querying the SQL Database

Depending on the size of your vSphere environment or your data retention policies you probably don’t want to log vCenter settings indefinitely. Because we designed the database to always contain a RecordID in each table along with a LastUpdated datetime, we can use this to prune the data.

Read more of this post

Creating a vSphere Change Management DB for free – Step 3 of 4

In my previous 2 blog posts I took you through creating a vSphere Change Management Database, how to insert data using PowerCLI, and in this post, I’ll show you some example queries you can run once you have the data. If you missed the first 2 posts check them out here:

Step 1 – Creating the SQL Database
Step 2 – Inserting data into the SQL Database

There are probably hundreds of different things you can derive from the data captured. So here is just a sample of what I’m going to show you:

  • Show all configurations of a VM across all data logged
  • Taking oldest date available and showing all VM configs on that datetime
  • Taking the most recent data available and showing total VM size provisioned and used (useful for Rubrik sizing)
  • Using the oldest and most recent VM used size to calculate the total VM used storage growth % (also useful for Rubrik sizing!)
  • Show all VMDisk and VMNIC configurations for a VM
  • Show all configurations for a VMDK or VMNIC
  • Show all configurations for a Port Group on a host
  • Show all configurations of a Cluster and Host
  • Taking the oldest date available and showing all original Cluster and Host configs
  • Show all current and historical stats for a Datacenter (including cluster, host and VM counts etc)

Read more of this post

Creating a vSphere Change Management DB for free – Step 2 of 4

In the last blog we created a SQL database in which to store data from PowerCLI in order to create a vSphere Change Management Database for free. If you missed it, check it out here:

Step 1 – Creating the SQL Database

In this second post we are now going to insert data into the database and configure it to run on a schedule. To do this we are first going to use a PowerCLI cmdlet with variables to store the vSphere data, then we will use ForEach to insert each row of data into a corresponding SQL table row.

Read more of this post

Creating a vSphere Change Management DB for free – Step 1 of 4

In my last blog post I gave an introduction to Working with SQL Databases using PowerShell. What I’d now like to do is share an example of a cool use case for combining PowerShell, SQL and PowerCLI.

After drinking a few beers (this blog is called virtually sober for a reason!) I started to think about different problems that I could solve by logging information into a SQL database. What info could I pull and store that would be useful to a virtualization admin? Then the answer hit me. Every setting in the vCenter from VMs to port groups, clusters, hosts to datastores! Why? Because the vCenter database only stores the latest setting.

Read more of this post

Working with SQL databases using PowerShell

One of the things I love about PowerShell is the sheer number of use cases you can address. A perfect example is working with SQL databases. If you think you need to wait for a DBA to give you data from a SQL database then you’d be wrong. You can use SELECT queries to pull data directly into PowerShell from any SQL database and not only that, you can also INSERT, UPDATE, DELETE or whatever else you desire, all from the comfort your scripts using invoke-sqlcmd in the Sqlserver PowerShell module. This also means you can now store data from your PowerShell scripts in SQL for long-term reporting, configuration management, you name it.

SQLServerBrowser

Read more of this post