Browsing:

Month: September 2016

SQL2016 Stretch database. Yes, it’s another linked server

Your manager always wants to keep all the data...now with bigdata being a thing and algoritmes are used more efficient (IOT), people want to hoard data even more, but it needs to be online to be valuable. If you have to restore the data first, your data is not very valuable. But all this extra data also slows down your database performance...and gives the dba'ers extra challenges....but not anymore.! Well, at least when your boss got a big wallet and don't mind spending it on a SQL buget.

In SQL2016 Microsoft introduced the stretch database. which give you live access to 'archived' data and makes it feel like it's on premise. And  it's a secretly just a linked server! A linked server between mssql and Azure.LS+azure

How does this work, and is it safe?

Yes! since it works on secure linked server technology and it stores an encryption key on the on-premises sqlserver, it's suitable for all your cold data, not hot, because it does slow down the query speed, but it will not clogg your network and your data will be available at all times, even when the data is being stretched over to Azure the data still is fully query-able.

First ask yourself, Do you really need to keep this data? If yes, How do you create a stretchdatabase? Well, this is easy!

Hesitations? use this link for info on the MS Stretch database advisor.

I use a simple test database, the adventureworks2016 ctp3.

Before we can start, check if the data archive function is enabled, if not (0) enable it.

####Check status of Remote data archive####
SELECT @@VERSION AS 'SQL Server Version'; 
EXEC sp_configure 'remote data archive'; 
GO 
####Activate Remote data archive####
EXEC sp_configure 'remote data archive' , '1'; 
GO 
RECONFIGURE; 
GO

Next we can create a master key to encrypt all your data locally, this way, the data can't be read in Azure.
Note: You can also create a masterkey from the stretchdb wizard, it's up to you. I'll show both options.

USE AdventureWorks2016CTP3; 
GO 

CREATE MASTER KEY ENCRYPTION BY PASSWORD='stretchdb2016'; 
GO

Next I will create a simple table  and populate it with some data, to keep the demo quick and simple :

CREATE TABLE dbo.Stretchtable
(
FirstName VARCHAR (50),
LastName VARCHAR (50)
);
GO


Use [AdventureWorks2016CTP3]
GO
INSERT INTO dbo.Stretchtable (FirstName, lastName)
VALUES ('Reed', 'Richards'), ('Benjamin', 'Grimm'), ('Sue', 'Storm'), 
 ('Johnny', 'Storm'), ('Victor', 'Von Doom'), ('Willie','Lumpkin');
 GO

Keep your Azure account ready! I use the SQL logical server resource, you need to create a resource before you can stretch the database.

Azure resource

 

Select the table you will be stretching to Azure. Now enable the table for stretching and the wizard will open up.

Enable stretch database

It's a Hybride archive - You can stretch the whole table or filter out the (c)old data from a massive table.
4_EnableStretchTable

 

Next thing you create a master key, if you didn't make it before, if you made it already, It will ask you to fill in the master password.Masterkey_StretchTable
10_LoginStretchTable

Fill in the IP range for a firewall rule.IP_Azure

12_EnableStretchTable

Hey Ho, let's go, that was easy!

Now the table will start to stretch, if you want to see if it stretched yet, try a select query and check the executionplan.
14_EnableStretchTable

Want your data back? No problem, You can bring back the data to your on-premise server, if you don't want to use Azure. Because, when you delete your azure account, the data will be gone too!

bringbackmydatabringbackmydata2bringbackmydata3

 

Note: Data storage can be expensive on Azure, but this function gives us a positive view on the ever growing databases and it's possibilities.


Meet the Buttonfactory – September 15

  • tbf_powershellkopieThursday, September 15, 2016

    to

    Beercoo

    Weg en Bos 51, 2661 DL Bergschenhoek

    You are invited to join us at our first meetup!
    There will be 2 presentations. One is about Powershell and the other about SQL Server 2016.

    Planning:

    19:00 A drink and some food

    19:30 Powershell Objects by Jacqueline
    Powershell is an object oriented scripting language, but what does that even mean? In this presentation you'll get to learn all about objects and how you can supercharge your scripts leveraging them. No Powershell skills required!

    20:15 What is new in SQL Server 2016? By Melanie
    SQL Server 2016 is the biggest leap forward in Microsoft data platform history!
    OK, I copied that line from the Microsoft site. But the coolest new feature is the stretched database. We are going to tell you all about it.

    21:00 Another drink.

    The meetup is free of charge and will be dutch spoken.
    No prior knowledge is required!

    Dutch PowerShell Meetup

    Rotterdam, NL
    26 Powershellerines

    Know Ada Lovelace? Grace Hopper? This group firmly believes that programming, scripting and system administration is for women! But where are you? Let's get together and learn...

    Check out this Meetup Group →