Category: Blog

  • Daily Coping 5 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 go for a drive or a solitary walk and enjoy the changing scenery.

    This tip actually came from my wife. I was a little overwhelmed by the announcement of various companies and organizations extending their lockdown into the fall. This includes Redgate, where it seems like we’ve abandoned any changes in 2020 and this is our way of working until at least 2021. If schools don’t open, then maybe not until H2 2021.

    In any case, she suggested going for a drive as a relatively safe way of changing our environment. I wasn’t sure, but I agreed. So one afternoon, she stopped work early and we headed out. No real destination in mind, but I drove a random route through Denver, heading north. It was good to wander through some places I haven’t been in a long time, and after a couple hours, I looped over to my son’s apartment, grabbed him for a light meal, and then heading back home.

    A wasted 4-5 hours of not getting thing done, but a good coping mechanism for me.

  • Quick SSMS Tip: Map Mode for Code–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    In recent versions of SSMS, there’s been an addition to the query windows that I find helpful and useful. This is the map mode for code, and it means that when you have a large script, you can get a quick view of where you are in the file, and where you code is located.

    First, turning this on. In the Options for SSMS, select the Text Editor section on the left, then expand the All Languages item. There is a Scroll Bars section to select. When you pick this, on the right you will see the Behavior section near the bottom. The default is bar mode, but you can switch this to map mode.

    2020-07-23 16_44_26-Window

    When you do that, if you open a script that is bigger than your query window, you will see a map of the code, along with a light colored bar that shows where you are in the code.

    In the image below, Glenn Berry’s diagnostic script is open, and  I have actual code near the middle of my screen, and on the right, you can see the pink just at the bottom of the oval that’s lighter in color than the map.

    2020-07-24 10_24_27-Window

    This is a little hard to describe, but if you turn this on and experiment, you’ll get an idea of what happens.

    Let me add some blank links to this script. When I do that, I can see the map expand with some gray spaces near the top.

    2020-07-24 10_46_23-Window

    You can also get a preview of code by putting the cursor on the map to the right. Below I’ve put the cursor on the right side, above the current location in the query window. I see a preview of the code, while I see the locator bar below the preview, showing me where I am in the code file.

    2020-07-24 10_47_33-Window

    Map mode is an interesting way to manage large code files, which sometimes occur in stored procedures and complex queries. While I would hope that most people don’t have hundreds of lines of code in any one file, I do know some do. Map mode can help.

    SQLNewBlogger

    This was a question someone asked me in a presentation. It took me almost as long to type an explanation as it did to take a few screenshots. Adding a little text made this a 10 minute effort.

    This is the type of thing that you can do, showing how this might help you with some code that is complex and harder to navigate. In addition, this is a nice way to show you are honing your craft and learning to use your tools.

  • Unboxing SQL Clone 2020 for a PoC

    When I got a new machine, I had SQL Clone on my old machine, in a few VMWare VMs. I decided to move this to my new machine, so that I can more easily demo things. I also want this always running so that I can use in constantly in development. That’s part of my job, but it’s also a good way to approach this as a Proof of Concept.

    I’m going to install this on my desktop, but the process is the same for a distributed installation on a server and a desktop. I’ll separate out the server and then the desktop into two posts, with a quick look at how this works. I’ll also detail the steps I need that differ slightly from what’s in the documentation.

    Architecture

    There are really three components to SQL Clone:

    • The SQL Clone management server (web server and data store in SQL Server)
    • A file share for storing database images
    • An agent on each SQL Server instance that gets database deployed to it

    SQL Clone has a server component, which is really just a metadata store and a web interface. This manages how the clones are deployed and tracked, but really, these are just metadata stores. Not much horsepower is needed for the server, either the web server or the database used as the data store. I’ll detail this setup below.

    There also is a file share that is used for keeping the read-only images. This does need to be high quality storage that each SQL Server instance can connect to with minimal latency. I’ll set up a share on this desktop, so that I can use this from other machines.

    The SQL Clone Agent goes on the SQL Servers where you deploy cloned database. This will also be on my local workstation, but I can add agents on other machines as well if they run SQL Server. I’ll look at this in another post.

    Installing the Server

    The documentation for getting started lists requirements on this page. There are a few items that this lists for the server:

      • Windows Server for running SQL Clone Server – this will be my desktop, but can be any Windows server.
      • SQL Clone license details – Obviously.
      • A SQL Server instance – This doesn’t have to be on the same Windows server as SQL Clone, but often is. The db load and web load is low.
      • SQL Clone Configuration database details – A SQL Server instance to host the data store that tracks which images, clones, and users are available.
      • SQL Clone Server service account– a service account for the Windows server
      • File Share set up – high quality connectivity needed

    For this setup, I will start by downloading the SQL Provision eval. Once I have this, I also want to ensure I have a SQL Clone license key (or am doing an eval).

    Once this is done, I’m going to start with the service account. I use SQLCloneMgmt for my service account name. I’ll create this on the local system. You can use a domain account as well, and the setup will assign the rights needed for running a service.

    2020-07-30 16_03_36-SQLCloneMgmt Properties

    Save the password as you’ll need it later.

    Next, I decided to create the database in advance. The documentation notes that the default is SQLClone_Config, so I used that name. I also set this to the simple recovery because I don’t expect to worry about PIT recovery.

    CREATE DATABASE [SQLCLone_Config]
    GO
    ALTER DATABASE [SQLCLone_Config] SET RECOVERY SIMPLE
    GO

    I do need to add my service account to SQL Server. This is really just an account that connects to the database, creates some objects, and then reads and writes some data.

    2020-07-30 16_07_17-Login - New

    I also want to go to the User Mapping page and give this db_owner in the SQLClone_Config db.

    2020-07-30 16_06_56-Login - New

    That’s about it for the pre-setup. Now, let’s install the server.

    2020-07-30 16_09_38-SQL Provision

    I’m choosing SQL Provision, which is Data Masker  and SQL Clone. Data Masker is used to process data during image creation, so I’ll install both. Once this is done, the Eula is next and then the install location. I’ll accept the terms and defaults.

    There is a check for running applications and then a normal Windows application install runs. When this completes, I get to the configuration screen and then a login for Redgate on top of it.

    2020-07-30 16_22_27-

    I’ll log in and my license isn’t found. No worries, I can activate this later. I’ll need to ping someone for a new one. Once I get that, I clicked the Activate link and entered it. I get a confirmation. Note: you can move forward as an eval for the installation.

    2020-07-30 16_25_14-

    The configure Clone screen appears when you get done with licensing. Click Next to move on.

    2020-07-30 16_25_57-SQL Clone Server Setup

    The next screen is where I put in the service account information and the SQL Server details. This is the SQLCloneMgmt account I created earlier, and for my SQL Server, it’s on Aristotle.

    2020-07-30 16_27_25-SQL Clone Server Setup

    I click “Finish” and after a moment my default web browser opens. I see this:

    2020-07-30 16_28_58-SQL Clone

    This is the welcome screen for the Dashboard. Since this is a new install, there is not information here. Click “Get Started” and you move to the flow that is used for SQL Clone.

    2020-07-30 16_29_56-SQL Clone

    The server is installed, but I can’t do anything without an agent. Agents do all the work on the SQL Server instance machines. I’ll do that part in another post. If I look at my SQL Server, I see this:

    2020-07-30 16_31_37-SQLQuery3.sql - ARISTOTLE.SQLCLone_Config (ARISTOTLE_Steve (62))_ - Microsoft SQ

    SQL Clone is installed and ready for work. The next thing for me is to set up a file share for the server.

    File Shares

    I can work with a local path, but I’ll constantly get warnings for images, since only SQL Server instances that can see the local path can work with the images. It works fine for a proof of concept, but it’s annoying. As a result, I’m going to make a share that’s essentialyl a loopback, pointing back to this machine.

    I have a few drives on my machine. The E: drive is an SSD, and I want to use that.

    2020-07-30 16_33_09-This PC

    Whether this is the local machine or a server, I’d create a folder on this drive. I want to create “SQLCloneImages” so I know what this is, and then look at the properties to share this.

    2020-07-30 16_34_40-SQLCloneImages Properties

    I’ll click “Share” and add my account. On a server, I’d likely pick an existing AD group to read this share, or create a new one. When I complete the process, I see a confirmation.

    2020-07-30 16_34_48-Network access

    Sharing is a weird concept in Windows, as we’ve tried to be better about security. You’ll likely do something different, depending on your Windows OS.

    That’s it. I can test this in Explorer, and I see the share.

    2020-07-30 16_36_40-SQLCloneImages

    Everything is ready for an Agent, which I’ll tackle in another post.

  • Daily Coping 4 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 remember that you are not alone, we all struggle at times.

    I know that I’m not alone, and I have empathy for others that feel as I do. My wife reminds of this, especially the last couple weeks as I’m struggling to cope with the unending view forward of this pandemic and the limitations on life.

    Hearing that message over and over was good. From the club director where I coach volleyball, from a couple friends, from my wife. It has helped.