Author: way0utwest

  • Daily Coping 7 Aug 2020

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here.

    Today’s tip is to get a long hug from someone that is important to you.

    I’ve seen research in the past that hugs are beneficial. A couple years ago my wife said that a 10s hug is a good idea, and I started to try it. Those of you that know me well and have seen me at an event in the last year might have gotten a long, perhaps slightly uncomfortable hug.

    My apologies if you felt that way,  but most people tense up after 2 seconds, but relax after 5 and go with it, especially when I explain they’re here for 10 seconds. A few people, including one of my son’s, have started to look forward to them.

    We had dinner with a friend recently, and when I walked up, she stood up, ready for her “bear hug”, as she calls it. It was a nice ten seconds, both of us whispering how good it was to see each other.

    A bonus for her, since she got 20s of hugs, one each from my wife and I.

  • Creating a SQL Clone Agent and a First Image

    In a previous post, I set up the SQL Clone server. This is really a metadata store and web front end, but it does no real work. The Agent service, which is installed on each SQL Server instance that will work with clones, does the work.

    This post looks at installing the agent and then creating the first image and clone of a database.

    Downloading the Agent

    To get a SQL Clone agent, you need to have access to the SQL Clone Management server. This is a web application, with a URL that defaults to the name of the machine where you installed the server and port 14145. You do not have to be logged into this machine, but rather, logged into a machine with SQL Server that you need an agent on.

    For me, I installed this on Aristotle, so I go to:

    http://aristotle:14145/dashboard/

    The Getting Started screen appears, which we saw in the last post. I want to click the “Download agent”.

    2020-07-30 16_29_56-SQL Clone

    This downloads a file, but before I run this, I need a service. On the Agent installation doc page, you see some architecture. While I am using the same machine, for many PoCs, I’d likely have installed the server on a central machine, such as the SRV-SQLCLONE machine in the image below.

    2020-07-30 16_45_51-Artboard 12.png (5334×3334)

    In many POCs, my laptop, or some shared development SQL  Server instance, is represented by SRV-HC1-SQL1 above. This is where I connect to as a developer and deploy clones. Or maybe I need an agent on my local workstation, WKS-DEV-01.

    In any case, I need a service to run the agent. While I could use my local account, I don’t recommend this. I really want a separate account. Get in this habit. Learn to use Group Managed Service Accounts or deal with separate domain service accounts.

    For me, I use SQLCloneAgent on each machine that runs as an agent, so I’ll create that account.

    2020-07-30 16_48_28-New User

    This does need some special Windows permissions. The install will allow it to be a service, but this does need to be an admin to use the Virtual Disk Service. Let’s ensure this is working.

    2020-07-30 16_50_56-SQLCloneAgent Properties

    This account also needs read/write access to the share, so I’ll alter the share with permissions to allow read and write.

    2020-07-30 16_51_46-

    This does need SQL Server permissions. This agent will create and drop databases regularly on the local SQL Server instance, and so it needs to be able to do that and manage those items. While you may be able to get away with CREATE DATABASE permissions, the documentation notes this account needs sysadmin privileges.

    It might seem that create/alter any database is sufficient, but that’s not the case. The agent checks this access, so grant this.

    With the account created and the permissions on the share, let’s install the agent.

    Installation

    This is a standard Windows install process. There is a procedure for a silent install, but I’ll do this interactively. Double clicking the downloaded EXE runs the install.

    2020-07-30 16_57_32-Redgate SQL Clone Agent

    When this completes, I get the config process.

    2020-07-30 16_57_48-SQL Clone Agent Setup

    Clicking Continue asks for my service account.

    2020-07-30 16_58_07-SQL Clone Agent Setup

    In a moment, if I’ve typed the credentials correctly, I see this.

    2020-07-30 16_59_06-SQL Clone Agent Setup

    In Services, I see this running. Note, the Clone Management services happens to be here, but this isn’t required. This could be on another machine.

    2020-07-30 17_00_20-Services

    In the settings of the SQL Clone application, I can see my agent listed. In fact, as you add new agents, their version and status is listed.

    2020-07-30 17_01_00-SQL Clone

    This is working, so let’s proceed.

    Creating a Cloned Database

    Once I have an agent, the Getting Started flow has a new option: Create an image.

    2020-07-30 17_03_08-SQL Clone

    I click this and I need to pick a source. I’ll pick an existing database on this instance, so I select “SQL Server”.

    2020-07-30 17_03_14-SQL Clone

    This gives me two dialogs. I enter a SQL Server name, and SQL Clone will check that my agent has sysadmin access. Once it does this, I can select a database on this instance.

    2020-07-30 17_07_10-SQL Clone

    I click Continue to set up modifications. The main purpose of SQL Clone is to allow you to use full size production databases in development, by saving space and masking out PII data. This is a test, and I’m picking a dev database to make an image, so I’ll leave this alone and move on.

    2020-07-30 17_08_38-SQL Clone

    I need to select a location for my image. In this case, I’ll enter the share I created in the first post.

    2020-07-30 17_09_54-SQL Clone

    Now I need to enter the name for this image and check that I have what I wanted to be entered.

    A word on naming. I know some people will name these with dates, which I used to do. However, for the most part you will have 2-3 images for any database in rotation.

    2020-07-30 17_11_14-SQL Clone

    When I click create, this starts running. I can see some progress on the dashboard. In this case, this is a 10MB database, so it runs quickly. When the creation is done, the dashboard updates with the activity item in the upper right, and I can see the image at the bottom.

    2020-07-30 17_11_50-SQL Clone

    I can see my image in the share. This is a VHD in a folder, and I don’t want to mess with this. I can see the size, however, which is my data size.

    2020-07-30 19_34_07-simpletalk_current_00000001_see

    This is an image, but I don’t have a database, so let’s quickly deploy a clone. On the left menu of SQL Clone, let’s click Create Clone. This gives me a place to select an image (of which I only have one now).

    2020-07-30 19_34_45-SQL Clone

    I can  modify this during deployment, but let’s skip that.

    2020-07-30 19_35_17-SQL Clone

    Next I need to pick an instance to deploy this clone on. I’ll pick my local instance.

     

    Once I do that, I give this a name. This is the database name I see in SSMS.

    2020-07-30 19_36_04-SQL Clone

    I create this, and I see it in SQL Clone:

    2020-07-30 19_36_50-SQL Clone

    and SSMS:

    2020-07-30 19_37_00-SQLQuery4.sql - ARISTOTLE_SQL2017.master (ARISTOTLE_Steve (55))_ - Microsoft SQL

    Summary

    That’s a quick look at getting an agent installed and testing it’s working with an image and clone. I can now work with the SimpleTalk_Test database as I would any other. Once I’ve tried something, I can get rid of it and recreate it easily, or create copies if I want to test multiple things.

    SQL Clone is a valuable tool that changes the way you work with databases, allowing developers and automated systems to work from a known base for their code changes. With frequent recreations of updated images after deployments, you can always be sure that your developers have a consistent foundation.

    Try SQL Clone today if you are looking for a way to consistently and easily deploy databases for your developers.

  • Security for 2FA

    I got a new mobile device recently and despite the restore from backup, I still had to perform quite a few setup chores. Reconnecting various apps to services by logging in was time consuming, but simple. A password manager was useful here, since I have different passwords everywhere. I set that application up first and then proceeded from there.

    The only trouble I really had was with Outlook and mail. I have an IMAP provider for one account and Outlook doesn’t make it easy to figure out where to change the settings for this. The second issue was with my corporate mail, which is secured with a 2FA connection through Duo.

    This is a technology that doesn’t use text, but has an application on devices and pushes a notification to them. I get a push when I log onto corporate assets from my PC, and I have to approve a login from my mobile. This prevents sum of the sim hijacking that can occur, where someone might have access to my SMS messages. It also prevents a lazy guy with Google Messages from getting a code on the same device rather than walking to the other room to get my phone an ensure I have it.

    I had to get help from our admins with the new device, despite having the old device connected and able to approve the connection. I had thought this would work, but there was some issue with Duo. On one hand, maybe this is good that it isn’t simple and I can’t quickly approve a new device, in that it prevents someone from stealing my identity on a cloned device. On the other, in an organization of any size, where mobiles might change constantly, this feels like a time sink.

    This might not be an attack vector to be worried about, but I think it’s better to be safer here than we might need. I do think that good security is worth some hassle. I don’t really complain about having to periodically re-authenicate, the requirement for strong passwords, and I love having 2FA enabled on many services. I hope we continue to find more and stronger methods of protecting individual and corporate data, along with more respect for the rights of humans whose data is being captured and used by most organizations. I also hope that we continue to improve the security options in SQL Server, including adding 2FA.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher or iTunes.

  • Daily Coping 6 Aug 2020

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here.

    Today’s tip is to try a new recipe or food.

    I realize that not everyone likes to cook. I know some of you don’t even love food like I do. However, we all eat, and food can bring joy to your life, whether that’s ordering something different from a restaurant or preparing something new.

    My wife got me to watch Chef, which was quite enjoyable for me. When we finished, she said she’d never had a Cuban sandwich. I was surprised, thought not as surprised as her. I’ve had them numerous times when I’ve visited places with lots of Cuban food, like Miami.

    I would have made her one, but before I could, we were out one day and decided to look for Cuban food. We found a place and she tried one. I did, too Winking smile

    In any case, I also ordered some other items. I got some Maduros and a Palermo. I hadn’t tried those before, though I have had plantains in some recipes. I enjoyed these much more, and I’ll be looking for some recipes to try at home to expand my cooking.