Four Areas to Focus on When You Start A New DBA Role

 

You’ve just been hired into a DBA role at a new company, or you’ve been given the DBA keys at your current company. Maybe you’re a SysAdmin and your boss has informed you that you are now supposed to manage the SQL Servers as well as everything else on your plate. In any of these situations, you may have some confidence in your skills, but especially in the case of being a new hire, you have absolutely no true idea of what you’re walking into.

In these scenarios, where do you start? Start with these four areas.

  1. Backups
  2. SQL Agent Job Notifications
  3. Building an environment inventory
  4. Security

 

1. SQL Server backups: You have to be able to recover the data.

My experience has been that many companies aren’t doing an adequate job of managing the backup routines for their databases. I’ve been in companies where two or even three products were running backups on the same SQL Servers. I’ve been in situations where important databases weren’t backed up frequently enough and with the right set of backup types to recover appropriately, which would result in losing more data than the management was comfortable with. I’ve also seen scenarios where there were no backups at all.

So, what do you do to tackle the issue of SQL Server backups in your environment? First, connect to your SQL Servers and run the below query. This will give you the database name and the date of the last full backup if the last full backup was over 7 days ago . If the database has never been backed up, then you’ll get that information as well. Any results from this query should be investigated immediately.

SELECT  d.[name] AS DatabaseName ,
COALESCE(CAST(MAX(b.backup_finish_date) AS VARCHAR(25)),'No Backup Ever Made') AS LastFullBackup
FROM master.sys.databases AS D
LEFT OUTER JOIN msdb.dbo.backupset AS B ON D.name COLLATE SQL_Latin1_General_CP1_CI_AS = B.database_name COLLATE SQL_Latin1_General_CP1_CI_AS

AND B.type = 'D' /*Full backup*/
AND B.server_name = SERVERPROPERTY('ServerName') /*Backupset ran on server you're currnetly connected to. */

WHERE D.database_id <> 2  /* Eliminate TempDB. No need to back that up */
AND D.state_desc NOT IN ('RESTORING', 'OFFLINE', 'OFFLINE_SECONDARY') /* Exclude databases that are offline or involved in log shipping, for example */
AND D.is_in_standby = 0 /* Database is read-only to restore a log backup as in Log Shipping. */
AND D.source_database_id IS NULL /* Excludes database snapshots */

GROUP BY d.name
HAVING MAX(B.backup_finish_date) <= GETDATE()-7 /*Full backup older than 7 days ago.*/
OR MAX(B.backup_finish_date) IS NULL;										    

 

Review the SQL Server to see if there are any native backup methods in place, such as a Maintenance Plan or Ola Hallengren scripts.  Each of these backup methods will produce one or more SQL Server Agent jobs. Check to see if the jobs associated with those options are enabled.

If you don’t see either of those options set up, your company may be using a 3rd party backup software. these are typically, but not always, deployed by System Administrators. Check with them to see what 3rd party software is in place for backups and let them know your findings for the server in question. this could be a situation where this SQL Server was just not enrolled in the 3rd party software and so is not being backed up.

If none of these things turn up a backup solution, then get one in place ASAP. See this post for options on how to create backups.

2. SQL Agent Job Notifications: If a job is worth creating, it’s worth knowing if it failed.

This is in position #2 because it’s been an easy win in every job I’ve taken. In every new role I’ve had, I have discovered many SQL Agent jobs with no notifications or notifications set up to wrong people. If a job is worth creating, it’s worth knowing if it failed.

As you work through finding failed jobs that never notified anyone, you may find that you’re fixing important agent jobs that should have been working. This process fixes business and data related processes and also helps you find stake-holders for data processes. When jobs fail and you investigate, you often need to know who is impacted by the job failure. This further leads to identifying who should be notified if it fails. This process then, actually helps connect you to key players in the organization very early. Those people on the business side almost always appreciate your efforts to make sure that data processes that affect them are working properly. This gives you allies as you move forward in your role.

So how do you proceed if you find jobs that have no notification set up if they should fail?

  • First, locate jobs that are failing. I have a post that will show you two ways to do that. You can either look at the SQL Agent Job Activity Monitor on a SQL instance or query the msdb database.
  • Second, locate enabled jobs that have no email operators assigned. These will be jobs that no one will know whether they are working or not. This post will tell you about how to find these jobs.
  • Third, work through a process to make sure jobs with no notification set up will have an email operator assigned to them. This will ensure the right “someone” will know if the job fails.

3. Build an environment Inventory: You can’t manage what you don’t know about.

The process of gathering information about your environment tells you about the make up of versions and editions in your environment. This, in turn, leads to the answer to the question, “What SQL Server’s are out of support and likely need to be upgraded?”

“How many SQL Servers are there at company X?”

Sure, the hiring manager told you the company only has a dozen SQL Servers, but I’ve often found that hiring managers often don’t know the real answer to the question, “So, how many SQL Servers do you have at company x?” That’s a question you should always ask when interviewing by the way. When you hear the answer, I’d encourage you to add at least 50% to that answer. At one job, I was told there were about a dozen SQL Servers. Less than 6 months in I had located about 50 SQL Servers, and that was before I ran the MAP Toolkit.

If you are not familiar with the MAP Toolkit, when you run the utility it does a search of your network or Active Directory to find SQL Servers. You will want to ensure that your security team and/or System Administrators know you are going to run this utility. This is because it will likely set off security software or even be blocked, in some cases.

The tool produces an Excel format list of plenty of information for you to know and this is the simplest way to start creating a SQL Server inventory. This scan is likely to find a lot of SQL Servers that no one seems to remember existing. Managing all the SQL Servers within your purview is important. You can’t do that if you don’t know about them.

You will also probably find individual employees who have installed SQL Server Standard or even Enterprise Edition on their local PCs. That’s a licensing no-no. This situation gives you the chance to help your company avoid licensing entanglements with Microsoft by addressing these scenarios.

If you find that you aren’t allowed to use the MAP Toolkit, as you hear about other SQL Servers that exist in your environment, or as you discover them for yourself as you look through Active Directory Users and Computers, make a Central Management Server and add SQL Servers to it. Ensure you have access to those SQL Servers and then query them to find out all you can about them. Review the information available to you from SERVERPROPERTY and build your own queries to discover information about the company SQL Servers. Here is an example query from the MS Docs link above. As you discover information about the company SQL Servers, create your own spreadsheet of information, or create a database and tables to hold the information you find.

SELECT  
  SERVERPROPERTY('MachineName') AS ComputerName,
  SERVERPROPERTY('ServerName') AS InstanceName,  
  SERVERPROPERTY('Edition') AS Edition,
  SERVERPROPERTY('ProductVersion') AS ProductVersion,  
  SERVERPROPERTY('ProductLevel') AS ProductLevel;  
GO

 

4. Security: Who has access to SQL Server and what type of access do they have?

I generally focus on this one after the others because security is often a political subject within an organization. You don’t want to become embroiled in power struggles right away by trying to take away someone’s access, because you will lose. Additionally, if you’ve done the previous work mentioned, you have likely built some good business relationships and a few allies to help you have the discussion about SQL Server access and security. As a DBA, you and the business need to know who has SysAdmin level access. The access that they possess allows their credentials to make any change they want to. In truth, it’s often not so much about trusting the person who has the access as it is realizing that every person who has SA permission is a person whom a hacker could exploit to gain access to the company’s data. You will want to make the business aware of how many credentials have this level of permission and whose credentials they are.

How do you find who has SysAdmin level access on your SQL Server? Here is a query for that from MS Docs. I have added a WHERE clause to exclude the commonly found SQL Server accounts that start with NT SERVICE.

 

SELECT	roles.principal_id AS RolePrincipalID,	
roles.name AS RolePrincipalName,	server_role_members.member_principal_id	AS MemberPrincipalID,	
members.name AS MemberPrincipalName

FROM sys.server_role_members AS server_role_members
INNER JOIN sys.server_principals AS roles
    ON server_role_members.role_principal_id = roles.principal_id
INNER JOIN sys.server_principals AS members 
    ON server_role_members.member_principal_id = members.principal_id
WHERE members.name NOT LIKE 'NT SERVICE%';

This query shows you what credentials have Server level SA access. You also will want to know what accounts have the db_owner role at the database level.

I would strongly encourage you to review the permissions scripts written and maintained by Kenneth Fisher. These will provide a wealth of information about your server level logins and your database level users.

 

Next Steps To Take

1.If you have a comment or question about this post specifically, leave a comment and I’ll get back to you.

2. If you would like help with something else related to SQL Server, reach out to me on Twitter, and I’ll be glad to offer assistance.

 

Three Keys to SQL Server Performance

 

Everyone wants good performance from their database systems. Some even expect and need a high performing Ferrari all the time. How is this achieved though? What do you need to understand about SQL Server specifically in order to make your company’s applications hum along like a well tuned car? We will look at three keys to SQL Server performance.

 

SQL Server Speed
SQL Server Performance

Here’s the short list of performance keys.

1. SQL Server must be able to cache sufficient data in memory

2. SQL Server must be able to retrieve data from disk efficiently

3. You must write “good” T-SQL

 

SQL Server Memory

 

1. SQL Server must be able to cache sufficient data in memory

SQL Server does not use memory like most applications.  People unfamiliar with SQL Server’s use of memory are surprised to see SQL Server using 80% or more of a server’s RAM. “I have 128 GB  of RAM on this machine why is SQL Server set to consume 115 GB of that?!” Then they decide to change Max Server Memory down to like 64 GB or less. Suddenly they might find that disk IO shoots up. You will also likely see that execution plans are rapidly aging out of the plan cache, which will burn up CPU with new compiles for query plans and potentially lead to parameter sniffing issues. When all this comes into play people start complaining about applications not working as well. They start saying the magical phrase, “It’s slow.”

When a query is issued and the  data requested is not in memory, SQL Server must use CPU and disk IO to get the data into memory first. While it does this a PAGEIOLATCH_* wait is registered in SQL Server because the current query is waiting on the data to be retrieved. This wait causes the query to be put on hold.  Reading data off the disk is always, always going to be slower than working with data that’s already in memory.

So, how do you determine what is a sufficient amount of RAM for your SQL Server? The short answer is that I would encourage you to look at  my post here and use the DBATools cdmlet Set-DBAMaxMemory. The post will help you understand more about what the Max Server memory setting does and the PowerShell cmdlet will recommend a good starting place for setting Max Server Memory. Here are some examples from the documentation from DBATools and from the Help commands available in PowerShell.

<# If you have a Central Management Server for your SQL environment, consider using this command to loop through all the SQL Servers and set the Max Server Memory where it is set to something larger than the total amount of RAM assigned to the server. #> 

Get-DbaRegServer -SqlInstance sqlserver | Test-DbaMaxMemory | Where-Object { $_.MaxValue -gt $_.Total } | Set-DbaMaxMemory 

<# If you have a Central Management Server for your SQL environment, consider using this command to loop through all the SQL Servers and set the Max Server Memory to this accepted formula created by a SQL Server expert. #> 

Get-DbaRegServer -SqlInstance sqlserver | Test-DbaMaxMemory | Set-DbaMaxMemory 

<# If you don't have a registered server then just use the below #> 

Test-DbaMaxMemory -SQLinstance SQLServerInstanceNameHere | Set-DbaMaxMemory

The longer answer is this. Take a look at three metrics in the SQL Server:BufferManager category in Performance Monitor.  First, if you observe Page Life Expectancy over time and the value has long stretches where it plummets and stays low without recovering, then you have some heavy hitting queries running that could likely benefit from having more RAM available. This will likely be accompanied by SQL Server wait stats showing a high average wait for PAGEIOLATCH_* type waits. This is SQL Server reading pages from disk because the data pages it needed were not in memory.

Second, review the Perfmon counter Lazy Writes/Sec. If SQL Server is having to free up memory in between checkpoints, this value will be above zero. If it is regularly above zero, then SQL Server is regularly under memory pressure and is having to write data pages in memory back to the disk so that it can load different data pages to satisfy queries.

Third, look at Free list Stalls/sec. The value of this Performance Monitor counter indicates the number of requests per second that had to wait for a free data page in memory. If Page Life Expectancy is often low for long stretches and both Lazy Writes/sec and Free List Stalls/sec are greater than zero, then you need to either adjust Max Server Memory up (as long as you don’t go too high based on the above information), add memory or, take a hard look at your indexes and queries involved when these PerfMon metrics are out of balance.

SQL Server Indexing and Disk Performance

 

2. SQL Server Must Be Able to Retrieve Data From Disk Efficiently

Look at your SQL Server wait stats information and if you see PAGEIOLATCH_* very prominent then there could be a good chance that the indexes in your database need attention or those long IO waits could mean a problem with the disk subsystem.

PAGEIOLATCH_* type waits are all wait types related to reading 8KB data pages from the disk into memory. Inefficient indexes could be making these reads longer because SQL Server can’t quickly get the data it needs from the existing indexes. This can happen over time as query patterns and data patterns change. For example, your company might introduce a new category of products Suddenly people are querying that category and its associated products far more and older, mainstay products less. The distribution of that data may affect the execution plan generated.

The company may have re-factored an existing application into new tables and missed indexing the Category column. Now when people are searching for things like “Bike Accessories” there is no supporting index. This results in long table scans of millions of rows.

As a start to determine if there is inefficient indexing, run and save the output of sp_Blitzindex to examine your tables and indexes. Review its recommendations and make adjustments. Then re-measure index usage with sp_BlitzIndex. Some time after a restart of SQL Server re-run sp_BlitzIndex and compare the output to the previously saved run looking to see if SQL Server is using the adjusted indexes.

To review whether you have a disk IO subsystem issue, look at the DMV called sys.dm_io_virtual_file_stats. You can also review the SQL Server Error Log looking for messages indicating IO that took longer than 15 seconds. These could be an indication of an IO subsystem issue. Review this article and this article on these topics.

Both of these articles provide information on understanding the DMV and the error message. There is also information about Performance Monitor counters to use to measure potential problems.

If you are in the cloud, such as AWS, be sure to review settings for ebs and fsx storage to ensure that the IOPs and throughput are set up appropriately. Also, be sure to take into consideration how the AWS ec2 instance type might be throttling your IO and throughput capabilities. Just because your storage is set up with a certain IOPs and throughput doesn’t mean that the ec2 instance can support the storage settings.

T-SQL Anti-Patterns to Avoid

 

3. You Must Write “Good” T-SQL

Poorly written T-SQL can cause poor application and SQL Server performance. Here is a brief list of things to avoid.

A. Writing T-SQL that makes it non-SARGable. This will cause SQL Server to have to scan entire tables instead of using an existing index. For details and examples see this, this and this. there is no need for me to explain this in depth, as it has been written about quite frequently.

B. Overuse of cursors. SQL is a set based language so making it do operations row by row, is far less efficient than using set-based logic.  Take a look at this post and this post.

C. Overuse of SELECT *. Some tables are very wide and have millions or even billions of rows. If you don’t truly need every column, then do SQL Server and your application a favor and only return the columns that are actually needed!

D. Be careful with scalar user defined functions. This goes back to the idea of SQL being a set-based language. A scalar udf returns a single value for each value passed to it. when you use this sort of logic and pass into it large numbers of rows, then each row is processed one at a time inside the function to return a value. Also, SQL Server doesn’t do a good job of “seeing inside” Scalar UDFs and show you that one is present in a query plan. Asa result, you might not see this sort of thing if you’re looking at a query plan. Additionally, scalar UDFs kill SQL Server’s ability to go parallel. For more, take a look at this, this , and this.

This list could be much, much longer. the point here is that how you write your T-SQL often has a direct impact on performance. If you write T-SQL for applications, I strongly encourage you to look at the blogs of folks like Erik Darling and Kendra Little as well as sites that have a large number of entries on T-SQL like this one.

Next Steps To Take

If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, on Twitter, or by email at Leem@leemarkum.com and I’ll be glad to offer assistance.

 

How I Became a Database Administrator

I recently saw a Tweet from Kendra Little where she asked the simple question, “What got you into databases?”  I’m intrigued by people’s stories of how they got into their current careers so I looked through the thread. There were lots of interesting paths shared and even a blog post was shared by someone who had recently written about how they got into a career involving databases. Kendra’s question and all of the interesting responses inspired me to write a post about my story.

 

It was a Dark and Dreary Night

 

Actually, it was February 2008. For a number of years I had been a team Supervisor at a physical security company called Interface Security; think ADT only much smaller. I was good at leading the team of 8-12 people as we used a critical piece of software to interact with customer accounts. I understood a lot about this software and was often the “lucky” person to be selected to do application failovers. This involved using a custom GUI from the vendor to shut down all the services of the application and start them back up, pointed to a new server. I haven’t worked there in almost 7 years, but I can still see this GUI in my mind.  Anyway, the woman who was the liaison between our company and the software maker was leaving her job to go work for the software maker, Bold Technologies.

I had reached about the top of the pay scale in my position and, at that point, there really was nowhere else for me to go in the company. The next few positions above me were taken and those people weren’t going to leave any time soon. The employee who was leaving asked me to apply for her job. At first I was adamant that I didn’t want to do that and that I didn’t know enough. She insisted that I did know enough and that I should apply. I gave it some more thought and decided to throw my hat in the ring. After a conversation with my boss two levels above me (Dan Reynolds) and about a month later, I had the job and the title of Manitou System Administrator. Manitou was the name of the software.

Interface Security was in the planning phases of a major version upgrade for this software. I took the job thinking I was just going to manage software. However, we were also going to be doing hardware upgrades for the servers this application was running on. My desire to understand everything even tangentially connected to the software got the better of me. We completed the software upgrade later that year and the server hardware upgrade as well.

Lee, Meet SQL Server

As part of that application upgrade process, I learned that there was this thing called SQL Server installed on the servers we were going to replace. I dove in head first to learn all I could about SQL Server. I learned that the process I was controlling with this company’s custom GUI was actually transactional replication under the covers. I loved learning about it and it was an important process to understand for my company and for my role.

About 18 months after starting the new role I began learning T-SQL using whatever free tutorials I could find on the internet. I started experimenting with SQL Server Reporting Services. I began to augment the application’s reporting capabilities with SSRS, at first just building the reports and making them available via the Report Manager and then later by scheduling them to be delivered to various people. In Jan 2012 I was officially moved into the I.T. department.

During that time I discovered the Microsoft Certified Master video training that Kimberly Tripp and Paul Randall recorded. I watched all the videos, some of them multiple times. There was so much I didn’t understand, but as I kept watching them and searching for information on the internet, the more the concepts made sense. I was by no means on my way to being an MCM for SQL Server, but I was learning rapidly.

Somewhere in the following years I started experimenting with what at the time were brand new features in Excel to help with reporting – Power Query and Power Pivot. I used those new tools to pull in and visualize data so that I had both SSRS and these new Excel tools at my disposal.

I also found Brentozar.com during those years. At the time, it was Brent, Kendra Little, and Jeremiah Peschka. Later, as I continued to learn from all of them, they added Jes Borland. This post was one of my first forays into performance tuning. I found it after the I.T. Director asked me to look into the performance problems that the financial system was having. It was also on SQL Server.

Earning a Microsoft Certification

In May of 2012 I completed a certificate in database technology from the Continuing Education Center University of Missouri at Saint Louis. The course I took there were concentrated two day courses on various parts of SQL Server. They advanced my career greatly. Somewhere along the way, I bought a book called SQL Server 2008 R2 Unleashed. I read that book, watched the aforementioned MCM videos and all the blog posts I could from BrentOzar.com.  I bought a Microsoft practice test and then a test from another vendor as well. At night around 9pm, after my three kids and my wife went to bed, I would study for about 2 hours a night, 5 nights a week. I studied probably 4-8 hours on the weekends too. This went on for months.

In May 2013 I got my first certification. It was for Microsoft SQL Server 2008 Implementation and Maintenance. I took the test on the eighth anniversary of my dad’s passing. I took it for me to advance my career, but I took the test on that day to attempt to honor him as well. The test was challenging, but I passed and I was ecstatic! I knew he would have been so proud.

A Change of Title

I held the Manitou System Administrator title until March 2014 and continued to grow more and more as a data professional. In March 2014 I got a title change to Database Administrator. I was elated! I had achieved a remarkable career change from a Call Center Supervisor role to a Database Administrator!

 

Acknowledgments

Wife and Kids –

My wife, Dacia, missed time with me on the weekends when I was studying for my first certification to help me break into the world of database administration. She handled the kids while I was sequestered away in my basement office studying like crazy. My kids, of course, missed time with me because of that too. I missed being with them, but it was necessary to help all of us as I was trying to advance my career and support a family.

Dan Reynolds – Interface Security

My previous boss, Director and then later Vice President of Customer Operations, Dan Reynolds was instrumental in my career development and I’d be remiss if I didn’t mention him. He believed in me from years previous when I had been working under him in the Call Center. I continued to work closely with him even after I  officially went into I.T. He took me to the user conference for the software I was managing. It wasn’t cheap and I was grateful. I learned a lot at those conferences and met a lot of great people at Bold Technologies while I was at those conferences. I met a lot of people from other companies working in the same role I was in. Dan helped me pursue education for SQL Server at the Continuing Education and Training Center at the University of Missouri at Saint Louis.

Amy Spurgeon – Interface Security/Bold Technologies

Amy was the support person who encouraged me to apply for her job before she left. She pushed me to consider the possibilities.

Josh Tafoya – Bold Technologies

Josh was a person in the support department at Bold Technologies when I started my application support role. He knows the Manitou software very well. He helped me understand the software better and he taught me a lot about what it meant to be an I.T. professional.

Matthew Narowski – Bold Technologies

Matthew held a number of roles at Bold while I was at Interface and was eventually named either CEO or President at Bold. He was patient and taught me a lot about I.T. support. He explained a great many things to me about the world of I.T. in general.

I am sure there are others who made contributions to my transition into a new career. I thank all of you.

 

I hope my story helps and encourages you along your own journey.

 

 

How to Use the SQL Server CONCAT Function

SQL Server concatenation methods have been enhanced in modern versions of SQL Server. SQL Server 2012 introduced the CONCAT() function. In SQL Server 2017 we get CONCAT_WS().

A common usage of concatenation, or joining column values together in a string, is combining a FirstName and LastName column into a FullName column.  Another common usage might be for creating an address column that pulls together building number, street, city and zip code.

Below I have provided an example of the three common ways to concatenate strings to create an address. These all produce the same results because there are no NULL values. They are just different ways of doing the same thing.

The first example is the CONCAT() method from SQL Server 2012, followed by the CONCAT_WS() function, which is CONCAT With Separator. The third method is the traditional method of combining strings with the
+” sign.

USE WideWorldImporters;
GO

SELECT CONCAT(DeliveryAddressLine2, ' ', C.CityName, ' ',DeliveryPostalCode) AS NewConcatMethod,

CONCAT_WS(' ', DeliveryAddressLine2, C.CityName,DeliveryPostalCode) AS CONCAT_WSMethod,

(DeliveryAddressLine2 + ' ' + C.CityName + ' ' + DeliveryPostalCode) AS OlderConcatMethod

FROM [WideWorldImporters].[Sales].[Customers] AS CUST
INNER JOIN [Application].[Cities] AS C ON CUST.DeliveryCityID = C.CityID;

 

NULLs And Concatenation

Before SQL Server 2012 the “+” sign was used to combine strings together into whatever form you needed. One disadvantage to this method is that if a value in the string to be concactenated is NULL then the result set returns a NULL.

 

USE AdventureWorks2014;
GO

SELECT TOP 5
    Title, 
    FirstName, 
    MiddleName, 
    LastName,
    Title + ' ' + FirstName + ' ' + MiddleName + ' ' + LastName as MailingName
FROM Person.Person;

SELECT TOP 5
    Title, 
    FirstName, 
    MiddleName, 
    LastName,
    CONCAT(Title,' ',FirstName,' ',MiddleName,' ', LastName) as MailingName
FROM Person.Person;

 

In the top result set, you can see that whenever a NULL occurs the resulting MailingName column is also NULL. This makes some sense because NULL is “unknown” so you can’t really join an unknown value to other strings and get a predictable result.

However, with CONCAT(), columns with NULL values simply have those values ignored.

SQL Server CONCAT Function and NULL

 

What about concatenating numbers?

CREATE DATABASE TestDB;

CREATE TABLE IntValues
(Col1 INT);

INSERT INTO IntValues
VALUES(67),(45),(90)

SELECT CONCAT(67,45,90) AS Result
FROM dbo.IntAvlues;

SELECT CAST(67 as CHAR(2)) + CAST(45 as CHAR(2)) + CAST(90 as CHAR(2)) AS Result
FROM dbo.IntAvlues; 

Concatenating numbers works in the same way. The great thing here is that there is no need to do an explicit cast when using CONCAT().

 

SQL Server CONCAT_WS()

SQL Server 2017 brought us CONCAT_WS. With this new function, you specify the separator you want to use when building the string.  The value used as the separator goes first inside the parentheses followed by the column names that are to be joined together. These column names are separated by commas in a list.  Like CONCAT(), CONCAT_WS() eliminates NULLS from the result set, leaving you with the non-null values.

SELECT TOP 5 Title, FirstName, MiddleName, LastName, 
CONCAT_WS(' ',Title,FirstName,MiddleName,LastName) as MailingName 
FROM Person.Person;
SQL Server Concat_WS() Results

I think that the syntax with these new functions is easier to write and to read. These newer approaches reduce typing and having to switch between adding a “+” and ‘ ‘ in various places.  CONCAT_WS() reduces typing even more by only specifying the separator once at the beginning of the function.

Next Steps To Take

  1. Check here for the MS Docs on CONCAT() and here for CONCAT_WS().
  2. If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, or on Twitter, and I’ll be glad to offer assistance.

How to Configure SQL Server Temporal Tables Part 2

 

In the initial post, we talked about some very basic items to get you up and running with temporal tables. In part 2, I’ll cover a few more things to think about and implement when working with temporal tables.

In the first post, we looked at altering an existing table to be a temporal table. Now we will look at what is involved in making a table be a temporal table from the very beginning.

Designing a Temporal Table from Scratch

First of all, you can create a table to be a temporal table from the beginning, without naming the history table. But you get an ugly history table name in the following format:

[dbo].[MSSQL_TemporalHistoryFor_tableObjectId].

In my test case that turns out to be this:

[dbo].[MSSQL_TemporalHistoryFor_1913773875].

Also, notice that in this example below, the SysStartTime and SysEndTime required columns are not designated as hidden. This means they can be returned in queries, so be aware of this, particularly when using SELECT *.

This syntax also results in a clustered index being created on the history table
using the SysStartTime and SysEndTime columns.

Observe that I’m taking advantage of the inline index creation syntax that was new in SQL Server 2014. Look at examples S, T, and U to see more information on how to use this feature.

CREATE TABLE dbo.Employee
(
ID INT IDENTITY(1,1) NOT NULL,
LastName VARCHAR(100) NOT NULL,
FirstName VARCHAR(75) NOT NULL,
JobTitle VARCHAR(50) NOT NULL,
BirthDate DATE NOT NULL,
HireDate DATE NOT NULL,
SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL,
SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL,
 PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime),
CONSTRAINT PK_Employees PRIMARY KEY CLUSTERED (ID),
INDEX IX_LastName_FirstName (LastName,FirstName),

)
WITH (SYSTEM_VERSIONING = ON);

ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysStart DEFAULT SYSUTCDATETIME() FOR SysStartTime;
ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysEndTime DEFAULT SYSUTCDATETIME() FOR SysEndTime;

This allows me to create the index on Lastname, FirstName directly in the CREATE TABLE statement and not have to do that afterward in a lengthier syntax.

INDEX IX_LastName_FirstName (LastName,FirstName)

To clean up this example and try a slightly different approach, run this code:

ALTER TABLE dbo.Employee SET(SYSTEM_VERSIONING = OFF)
DROP TABLE dbo.Employee

 

How To Name the History Table

You can create a temporal table and name the history table so it is more human friendly. This syntax also results in a clustered index being created on the history table using the SysStartTime and SysEndTime columns.

If you want to be able to create a clustered columnstore index, or a different clustered index then there are 2 choices:
1. Use this syntax and then drop the clustered index and make the new clustered index.
2. Create both the temporal table and the history table and when you make the history table, and specify the indexes you want to create.

 

CREATE TABLE dbo.Employee
(
ID INT IDENTITY(1,1) NOT NULL,
LastName VARCHAR(100) NOT NULL,
FirstName VARCHAR(75) NOT NULL,
JobTitle VARCHAR(50) NOT NULL,
BirthDate DATE NOT NULL,
HireDate DATE NOT NULL,
SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL,
SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL,
 PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime),
CONSTRAINT PK_Employees PRIMARY KEY CLUSTERED (ID),
INDEX IX_LastName_FirstName (LastName,FirstName),

)
WITH (SYSTEM_VERSIONING = ON(HISTORY_TABLE = dbo.EmployeeHistory));

ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysStart DEFAULT SYSUTCDATETIME() FOR SysStartTime;
ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysEndTime DEFAULT SYSUTCDATETIME() FOR SysEndTime;

DROP INDEX IX_EmployeeHistory ON dbo.Employeehistory;

CREATE CLUSTERED COLUMNSTORE INDEX IX_CC ON dbo.EmployeeHistory;

 

Indexing Decisions for Temporal Tables

Per MS Docs, if you are creating this table as a temporal table for the purpose of auditing row changes, then a clustered rowstore index on the  SysStartTime, SysEndtime and the PK columns of the temporal table is a good choice. Otherwise, a clustered columnstore index is a good choice for analytic queries.

How to Handle Data Retention for Temporal Tables

The simplest option for managing data retention on a history table is to use
the HISTORY_RETENTION_PERIOD = syntax. The available time units for history retention are DAYS, WEEKS, MONTHS, YEARS. SQL Server then uses this information to manage the deletion of data from the history table for you. notice below I have added HISTORY_RETENTION_PERIOD = 6 MONTHS to the syntax.

CREATE TABLE dbo.Employee
(
ID INT IDENTITY(1,1) NOT NULL,
LastName VARCHAR(100) NOT NULL,
FirstName VARCHAR(75) NOT NULL,
JobTitle VARCHAR(50) NOT NULL,
BirthDate DATE NOT NULL,
HireDate DATE NOT NULL,
SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL,
SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL,
 PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime),
CONSTRAINT PK_Employees PRIMARY KEY CLUSTERED (ID),
INDEX IX_LastName_FirstName (LastName,FirstName),

)
WITH (SYSTEM_VERSIONING = ON
    (HISTORY_TABLE = dbo.EmployeeHistory,
     HISTORY_RETENTION_PERIOD = 6 MONTHS)
    );

ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysStart DEFAULT SYSUTCDATETIME() FOR SysStartTime;
ALTER TABLE dbo.Employee ADD CONSTRAINT DF_SysEndTime DEFAULT SYSUTCDATETIME() FOR SysEndTime;

Other options for handling data retention include stretch tables, which place the entire history table, or part of it, in Azure. Partitioning the history table an writing your own custom cleanup script are also options.

Next Steps To Take

  1. Look here for a list of other considerations and limitations.
  2. Think about the tables in your environment where this feature could be useful and do some experimenting.
  3. Talk to your business personnel about this feature and ask them if they know of tables where knowing how the data has changed over time would be helpful. In some cases, you might find that the business is sometimes asked questions about how or when their data changed. This feature is perfect for answering that question.
  4. If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, or on Twitter, and I’ll be glad to offer assistance.

How to Configure SQL Server Temporal Tables

Temporal tables were a new feature in SQL Server 2016. They allow for the tracking of changes without having to set up change tracking, change data capture or triggers.  for certain uses they are not a replacement for something like change data capture, but would work if the purpose is simply having a record of changes. Temporal tables can also be used for auditing changes to data as well as  point-in-time analysis where users might want to compare data changes over time, or even at a specific point in time.

You can create a new table as a temporal table from the very beginning. However, I think a more common scenario is going to be converting existing tables to be temporal tables so I will start there.

The Initial setup

I’ll make a backup of the Production.Products table. I do this as a general practice to keep from having to restore the database to return things to normal after demos and experimentation. This way, I can drop the backup of the table and move on.

USE AdventureWorks2016CTP3;
GO

DROP TABLE IF EXISTS Production.ProductBackup
SELECT TOP (1000) [ProductID]
      ,[Name]
      ,[ProductNumber]
      ,[MakeFlag]
      ,[FinishedGoodsFlag]
      ,[Color]
      ,[SafetyStockLevel]
      ,[ReorderPoint]
      ,[StandardCost]
      ,[ListPrice]
      ,[Size]
      ,[SizeUnitMeasureCode]
      ,[WeightUnitMeasureCode]
      ,[Weight]
      ,[DaysToManufacture]
      ,[ProductLine]
      ,[Class]
      ,[Style]
      ,[ProductSubcategoryID]
      ,[ProductModelID]
      ,[SellStartDate]
      ,[SellEndDate]
      ,[DiscontinuedDate]
      ,[rowguid]
      ,[ModifiedDate]
   INTO Production.ProductBackup
  FROM [AdventureWorks2016CTP3].[Production].[Product]

 

Now that we have a our table that we want to convert to a temporal table, let’s suppose that AdventureWorks wants to raise the price of all products in the Accessories product sub-category. The below will get that initial data and confirm that our expression is right prior to updating the actual data. It also will provide us with the knowledge of how many rows we should expect to see changed.

 

SELECT P.[Name] AS ProductName, P.ProductNumber, P.ListPrice, CAST(P.ListPrice *1.10 AS DECIMAL(9,2)) AS NewListPrice ,PC.[Name] AS ProductCategoryName, PSC.[Name] AS ProductSubCategoryName
FROM Production.ProductBackup AS P
INNER JOIN Production.ProductSubcategory AS PSC ON P.ProductSubcategoryID = PSC.ProductSubcategoryID
INNER JOIN Production.ProductCategory AS PC ON PC.ProductCategoryID = PSC.ProductCategoryID

WHERE PC.[name] = 'Accessories'
ORDER BY ProductCategoryName, ProductSubCategoryName

 

Here is a partial screenshot of the results. Twenty-nine rows were returned.

 

AdventureWorks ProductSubCategory Accessories
Price increase for Accessories product subcategory

A sometimes recommended practice for temporal tables is to create a separate schema to hold the history table, so we’re going to do that.

/*
Create a new schema to hold the history table
*/
CREATE SCHEMA History;

 

Enabling Temporal Tables In SQL Server

Now we will set up system-versioning for our existing table. Two new columns need to be added to the source or “temporal table.” These must be specified as DATETIME2 and can either be hidden or not. If the keyword HIDDEN is used, then these two columns do not show up at all when this table is queried. You might not want the columns to appear in query results because you might be running SELECT * against the table, even though you know not to do that in a production system, right? Also, if the columns are added as HIDDEN, then you don’t have to account for these columns when you do INSERTs.

Once the table has been altered as needed with the new columns, and we’ve either done what I did here and specify defaults for those columns or explicitly defined them and NOT NULL. We also need to add the  PERIOD FOR SYSTEM_TIME statement. After that, there is one additional ALTER TABLE statement to turn on system versioning.

/*
Enable SystemVersioning on existing table
*/

ALTER TABLE [Production].[ProductBackup]
  ADD SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START HIDDEN
         CONSTRAINT DF_SysStart DEFAULT SYSUTCDATETIME()
      , SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END HIDDEN
            CONSTRAINT DF_SysEnd DEFAULT CONVERT(DATETIME2, '9999-12-31 23:59:59.9999999'),
        PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime);

ALTER TABLE [Production].[ProductBackup]
SET (SYSTEM_VERSIONING = ON(HISTORY_TABLE = History.ProductBackup));

What Happens When You Modify Data In a Temporal Table?

Let’s update some rows to populate the history table.

/*
Update some rows to populate the history table. 
We will raise the price of everything in the Accessories category by 10%.
Should be 29 rows changed.
*/

BEGIN TRAN
  UPDATE Production.ProductBackup
  SET ListPrice = CAST(ListPrice *1.10 AS DECIMAL(9,2))
  FROM Production.ProductBackup AS P
  INNER JOIN Production.ProductSubcategory AS PSC ON P.ProductSubcategoryID = PSC.ProductSubcategoryID
  INNER JOIN Production.ProductCategory AS PC ON PC.ProductCategoryID = PSC.ProductCategoryID
  WHERE PC.[name] = 'Accessories';
  
COMMIT TRAN

 

Let’s examine one method to see the current price in the source table and the previous price from the rows now in the history table. This will also show the system start and end times for those rows. This date/time range shows when this rows was valid and present in the source table.

 

/*

One method to show the old data and the new data
*/
SELECT PB.[Name] AS PBName, PB.ListPrice AS CurrentListPRice, 
PBH.ListPrice AS PreviousListPrice, PBH.SysStartTime, PBH.SysendTime
FROM Production.ProductBackup AS PB
INNER JOIN History.ProductBackup AS PBH ON PB.ProductID = PBH.ProductId --AS PB
--FOR SYSTEM_TIME ALL 
WHERE PBH.ProductID IN
(
/*These were the 29 IDs I knew we had changed because we returned them in the previous SELECT query
*/
707,708,711,842,843,844,845,846,847,848,870,
871,872,873,876,877,878,879,880,921,922,923,
928,929,930,931,932,933,934
)
ORDER BY PBH.ProductID;

 

Here is a partial screenshot of the results. This table indicates that these rows existed in the source table between August 24th at 04:01:00 and August 24th at 04:01:29.

 

Viewing SQL Server Temporal Table History
A view of SQL Server temporal table history

 

Data Retention for SQL Server Temporal Tables

One additional thing to consider when setting up temporal tables is data retention for the history table. There are several methods to manage data retention, but I think the simplest is to set a retention policy on the table itself and let SQL Server handle the data cleanup. By default the history table will store data indefinitely.

First, check to see that data retention is enabled in the database by querying the column is_temporal_history_retention_enabled column in sys.databases. If it is not enabled, then use the below to do that, remembering to set the database context for your environment within the script.

ALTER DATABASE [<myDB>]
SET TEMPORAL_HISTORY_RETENTION ON

To alter an existing temporal table so that history retention is being managed you can do the below. Keep in mind that values with DAYS, WEEKS, MONTHS, and YEARS are all valid for history table retention.

ALTER TABLE Production.ProductBackup
SET (SYSTEM_VERSIONING = ON (HISTORY_RETENTION_PERIOD = 9 MONTHS));

 

Next Steps to Take

  1. Head over to the MS Docs to learn more about temporal tables in SQL Server.
  2. If you need to know WHO made a change as well as what was changed then check out this post from Aaron Bertrand.
  3. Look for subsequent posts from me that will cover more about temporal tables.
  4. If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, or on Twitter, and I’ll be glad to offer assistance.

How To Use Powershell to Configure Multiple Databases for Log Shipping

I recently needed to configure log shipping for multiple databases at once as part of a migration project. I turned to PowerShell to do this.

But before we get to that part, this post assumes that you’ve done the upfront work to create shares for the backups to write to and for the backups to be copied to. This will involve providing the right permissions for the SQL Server service accounts involved in Log Shipping. If you are not familiar with this, that’s perfectly fine. Check out this article in MS Docs first.

Configure Log Shipping With PowerShell

I first used some commands to find what I could use to do this.

Get-Command *LogShipping* -Module DBATools

#This returned Invoke-DbaDbLogShipping

#Then I ran the below to look at the help for this command
Help Invoke-DbaDbLogShipping -Full 

<#I knew I would need to get the databases on the SQL instance so I did the
below and I came across Get-DbaDatabase
#>
Get-Command *database* -Module DBATools

<#Then I ran the help for that to see how to use the command#>
Help Get-DbaDatabase -FULL

 

Then I wrote two options for providing a list of databases to the script. The first option is a hard-coded list of databases. I did this because you might not want to set up every database on an instance to be log shipped. Perhaps you’re only interested in certain ones.  Rather than hard-coding in the PoSH script, you could change this to have the script read a list of databases from a provided text file as well.

The second option assumes that you want to log ship all user databases. I used the switch -ExcludeSystem to make sure the script didn’t try to log ship my system databases.

#Populate a list of databases on the instance that you want to configure logShipping for 
$SQLInstanceName = "MySQLInstance" 
$Databases = "CollegeFootball", "DBAUtility", "StackOverflow2013", "UMSLIntermediateSQLClass" 

<#Or to set up Log Shipping for every user database on the SQL instance#> 
$SQLInstanceName = "MySQLInstance" 
$Databases = get-dbadatabase -sqlinstance $SQLInstanceName -ExcludeSystem -Database $Databases | SELECT Name

 

An Example from the PowerShell Help

Next, from the help for the log shipping command I pulled out one of the examples. This only gets me one database at a time though, so I need to modify this so I can set up log shipping for multiple databases at once.

PS C:\>$params = @{

>> SourceSqlInstance = 'sql1'
>> DestinationSqlInstance = 'sql2'
>> Database = 'db1'
>> SharedPath= '\\sql1\logshipping'
>> LocalPath= 'D:\Data\logshipping'
>> BackupScheduleFrequencyType = 'daily'
>> BackupScheduleFrequencyInterval = 1
>> CompressBackup = $true
>> CopyScheduleFrequencyType = 'daily'
>> CopyScheduleFrequencyInterval = 1
>> GenerateFullBackup = $true
>> RestoreScheduleFrequencyType = 'daily'
>> RestoreScheduleFrequencyInterval = 1
>> SecondaryDatabaseSuffix = 'DR'
>> CopyDestinationFolder = '\\sql2\logshippingdest'
>> Force = $true
>> }
>>
PS C:\> Invoke-DbaDbLogShipping @params

I add in a foreach loop and put it all together to arrive at the below to do this for a selected list of databases.

<#Populate a list of databases on the instance that you want to configure logShipping for. You could also get the list from a text file, if you wanted to.
#>
$SQLInstanceName = "MySQLInstance"
$Databases =  "CollegeFootball", "DBAUtility", "StackOverflow2013"

# Configure Log Shipping.
foreach ($Database in $Databases)
{
  $params = @{
    SourceSqlInstance = $SQLInstanceName
    DestinationSqlInstance = 'MySQLInstance\sql2019'
    Database = $Databases
    BackupNetworkPath = '\\MySQLInstance\LSBackups'
    BackupLocalPath = 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\LSBackups'
    BackupScheduleFrequencySubdayType = 'Minutes'
    BackupScheduleFrequencySubdayInterval = 5
    CopyDestinationFolder = 'D:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019\MSSQL\DATA\LogShippingCopy'
    CopyScheduleFrequencySubdayType = 'Minutes'
    CopyScheduleFrequencySubdayInterval = 5
    RestoreScheduleFrequencySubdayType = 'Minutes'
    RestoreScheduleFrequencySubdayInterval = 5
    GenerateFullbackup = $true
    CompressBackup = $true
    NoInitialization = $false
    NoRecovery = $true
    Force = $true
    }
  Invoke-DbaDbLogShipping @params 
}

Take note of a few things.

  1. First, there is a switch in the script called GenerateFullBackup that I’m setting to true. If you have existing backups you want to use, there is a parameter for that called UseExistingFullBackup, and a related parameter called UseBackupFolder.
  2. Second, compressing the backup is not enabled by default, so I used the CompressBackup parameter and set it to true in order to compress backups.
  3. Third, a parameter called DisconnectUsers exists that, in combination with setting the StandBy parameter to true, will make the databases on the secondary readable and then disconnect users when the Log Shipping schedule for the restores kicks in.
  4. I am using the NoRecovery switch set to True. You will need to remove that if you want to use the StandBy Parameter.

 

Log Shipping All User Databases

To configure log shipping with PowerShell so that all the eligible user databases on a SQL instance are done, you would do the following. Notice in this example, I’ve changed the $params for Database from simply $Databases to $Database.Name.

<# 
For setting up Log Shipping on all eligible user databases 
Notice in this script that I changed the Database part of the script to $Database.Name
#>
$SQLInstanceName = "MySQLInstance"
$Databases = get-dbadatabase -sqlinstance $SQLInstanceName -ExcludeSystem | SELECT Name

# Configure Log Shipping 

foreach ($Database in $Databases)
{
    $params = @{
        SourceSqlInstance = 'MySQLInstance'
        DestinationSqlInstance = 'MySQLInstance\sql2019'
        Database = $Database.Name
        BackupNetworkPath = '\\MySQLInstance\LSBackups'
        BackupLocalPath = 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\LSBackups'
        BackupScheduleFrequencySubdayType = 'Minutes'
        BackupScheduleFrequencySubdayInterval = 5
        CopyDestinationFolder = 'D:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019\MSSQL\DATA\LogShippingCopy'
        CopyScheduleFrequencySubdayType = 'Minutes'
        CopyScheduleFrequencySubdayInterval = 5
        RestoreScheduleFrequencySubdayType = 'Minutes'
        RestoreScheduleFrequencySubdayInterval = 5
        GenerateFullbackup = $true
        CompressBackup = $true
        NoInitialization = $false
        NoRecovery = $true
        Force = $true
    }

    Invoke-DbaDbLogShipping @params 

}

 

These scripts allow you to configure Log Shipping with PowerShell either for a pre-determined list of databases or for all eligible databases on the SQL instance.

Next Steps to Take

  1. Consider looking up other articles about Log Shipping to learn the details and variations. For example, here and here.
  2. Find a good introduction to PowerShell for use with SQL Server because automation is key these days, especially as your work environment gets larger.
  3. If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, or on Twitter, and I’ll be glad to offer assistance.

 

What I Learned From Giving My First Presentation

I recently was thrust into a conundrum. I suddenly found myself in need of a speaker for a recent SQL Server Meetup this month. My co-organizer and I had one week to find a presenter, set up a new Meetup, and then publicize so people outside of Meetup would know about it. I decided that was too short notice to go out to  Twitter and ask for volunteers to speak.

I thought, “What could I talk about?” You see, presenting is something I’ve always wanted to start doing. I just never did it. For many years, I thought that I didn’t know enough and that presenting was for the “famous” SQL Server people to do and I should just wait on the sidelines. However, over the last couple of years I’ve felt more confident about what I know.

Alos, I’ve come to realize that even people starting out have things they can share. For example, presentations can just be a series of short talks and work problems that a person has solved. Everyone has those examples. you don’t have to Brent Ozar, Kendra Little or Grant Fritchey to share problems you’ve solved at work. Presenting that information helps the presenter grow and helps the people hearing the content. People in the audience might hear a new, inventive way to resolve an issue, or they might have this problem in the days immediately after the presentation and be helped by having recently heard someone’s explanation of how they solved it, even if the solution wasn’t “ingenious”.

Almost out of nowhere I had an idea. I could talk about features in modern SQL Server that make certain aspects of working with the product easier. These could be enhancements like brand new features and feature sets or things like enhancement to T-SQL. I put together a rough list of items to include. There were close to 20 things on the list. As I worked through the presentation, I narrowed the list to 12 features or enhancements. After about 11 hours building slides, doing research, creating and testing demos and another 2 hours practicing giving the presentation, I was ready. You can see the results of that work here.

However, this post isn’t about the content of the presentation. I want to share what I learned as the result of putting together and giving the presentation. Without further delay, let’s look at the bullet points that follow.

 

  • Be careful what you eat before presenting. You want to focus on your presentation and not your queasy stomach or your heartburn, etc.

 

  • I re-learned where Presenter Notes are in the slides. I had given a presentation many months ago internally to my company. It was on finding good resources for training and during that process, had to look up presenter’s notes for PowerPoint. So much time had gone by since then, that I had to look it up again. In the lower right corner of PowerPoint there is an icon with an ^ with four dashes under it and the word “Notes” next to it. Click that and you get a small window below your slide that you can type your talking points into.

Rather than fill up your slides with text that you end up reading, use this Presenter’s Notes area to make short notes about the ideas you want to explain. Or you could type out what you’re going to say into paragraphs in this area. When you run the slideshow, you will see the slide and your Presenter’s Notes on one screen and your audience will see just the slides.

PowerPoint Presenters Notes

 

  •  I learned there is a Presentation Coach feature in PowerPoint that lets you practice your presentation and provides a feedback report. To use this feature, inside PowerPoint select the Slide Show menu at the top and then “Rehearse With Coach”. This feature gives you feedback about things like your use of filler words, how fast you’re speaking and the tone of your voice.

 

  • I learned there is a built-in Design suggestions feature for your slides in PowerPoint. Once I had my content and Presenter’s Notes mostly the way I wanted it, I realized that I needed to do something about the drab looking slides. I hadn’t started with a template of any kind and now I needed help making it visually interesting.

At the top of the Power Point menu ribbon I clicked on the word Design. Then off to the far right I saw a button called “Design Ideas”. I left clicked that and a new set of slide options opened up down the right side. I clicked on the ones I thought would look ok, keeping in mind certain key things. First, when designing slides you will need to avoid bright or pastel type colors that hurt the eyes. Second, these color choices also often make the text hard to read. As I left clicked on options down the right side, the slides changed and I could see what my presentation would look like.

PowerPoint Presentation Design Ideas Menu

 

  • I learned new information about SQL Server as I researched some topics I was less familiar with. I was less familiar with some topics I was planning to cover than others. As a result, I had to do some research to make sure I understood how the feature worked. In this way, the experience of presenting forced me to learn more about SQL Server, and that’s a good thing!

So, that’s what I learned from giving my first public presentation. I hope this encourages you to start presenting and makes things a little easier for you when you decide to give it a try.

 

Next Steps to Take

  1. Consider some problems you have solved at work and give some thought to formalizing what you learned by sharing that information with others.
  2. Look up a SQL Server Meetup group and join one. Start attending and think about how your experience can help others.
  3. If you would like help with anything in this post, or with something else related to SQL Server, reach out to me here, or on Twitter, and I’ll be glad to offer assistance.

What I’ve Been Doing Recently

Dear readers, it’s been a little while since my last blog post. Life is busy and so I’ve been away for a little bit. I am hoping to get back into the swing of things with more blogging though.

Here’s what I’ve been up to.

  1. Keeping a SQL Server Meetup going. I’ve been working with my co-organizer, Anthony Fortner, to discuss group details and get speakers lined up. I’ve had some difficulty with that recently and I need to go back to the community on Twitter and probably review Sessionize to find some additional people who regularly present.
  2. Finding and transitioning to new employment. Finding new work feels like a full time job. There is a lot of energy that goes into the process. I found a new home about six weeks ago.
  3. Because of the new job I landed, I’ve been figuring out a plan of attack for learning the necessary things about SQL Server in AWS. I’ll likely provide a list of those resources and my plan in a separate blog post.
  4. Watching the 6 part series on Azure SQL from Anna Hoffman and Bob Ward. Coming soon there will be a blog series on their videos. I may use these videos and the Azure SQL learning paths on Microsoft Learn to pursue the DP-300 certification.
  5. Continuing to take care of myself.  I’ve stuck to my routine of taking Saturdays off as described here.  I’ve been watching parts of the NBA Finals with my family and that has been fun and relaxing.
  6. I built and gave my first recorded, public presentation on SQL Server. You can find that here.

I would love to hear from you. Reach out to me via email, leem@leemarkum.com, or on Twitter.

Steps I Took To Handle Burn Out

I want to put a disclaimer at the beginning. I am not a mental health professional. Do not construe anything I say to be professional mental health advice. I am simply telling my story.

I’ve always wanted to be a high impact person. I want my life to count for something. I think most people want that. In the United States, where the idea of “living the American dream” is prominent, this desire to make a difference and to live the dream often leads to people living life by going as fast as possible. By late 2020 I found myself doing that. I found myself going in too many directions.

  1. Trying to start an IT business.
  2. Work a full time  IT job.
  3. Study for an IT certification.
  4. Write 2 blog posts a week.
  5. Began answering questions on technical forums.
  6. Dealing with the stress of a global pandemic.
  7. I moved out of the house I raised my kids in for 17 years just one day after my birthday.

That’s a tough combination. I was excited and full steam ahead on all of those things for several months in 2020. In December I took vacation time for the last two or so weeks of the year. The plan was to throw myself even more into launching the business, studying for the 70-764 and blogging.  However, what I discovered on those first few days of vacation was that I just couldn’t make myself do any of it. I realized I was exhausted.

You’ve heard the phrase about burning the candle at both ends to describe people who are really working hard and staying busy in life. I felt like the latter half of 2020 I hadn’t just been burning the candle at both ends, I’d been trying to melt the whole thing with a blow torch! I was burned out – mentally spent. I also began to wonder if I was experiencing symptoms of depression as well.

So, what did I do?

Making Time for Down Time

 

I rested. That “working vacation” in December 2020 turned into a couple of weeks of doing a whole lot of nothing. I actually took a vacation from my problems and my stress. No writing blog posts or studying for certifications, and I didn’t really work on developing the business either.

I also eventually decided to take a consistent day off. For a few weeks in 2020 I was getting up at 7:30 AM on Saturday and Sunday to start work on blogging and business strategy. I would work for 4 or so hours every Saturday and Sunday morning, then I would take a break for awhile and go do something else. During that time I would frequently return to work on blogging that evening. Even when I decided not to get up early on Saturday and Sunday, I was still dedicating the first few hours of both days to blogging and technical work. Essentially, I was working 7 days a week.

Many years ago I worked two jobs and had only 2 days a month off. That’s right – 2 days a month!  I did that for 5 years and was elated when I no longer had to do that. I remember how dropping down to one job changed me quite rapidly, and for the better. Going back to that was not something I wanted to repeat, but I still knew that I would need to put in some effort on my own time to accomplish any of the goals I had.

As a result, I’ve started taking off all day on Saturdays. For probably 2-3 months, I haven’t done anything technical on Saturdays. On Sundays, I sleep in like a person would normally do on their day off and then I do probably 2-4 hours of technical work. This has made a big difference in my mental energy levels. Our bodies and minds were not designed to be going, going, going. We need down time. We need recreation.

Re-focused My Certification Efforts

I had been working hard on the 70-764 SQL Server certification. As I worked through that material, I realized I was learning, or re-learning, a lot of things that I probably wasn’t  going to use any time soon. I had previously been studying for the AZ-900 and switched to the 70-764 because I knew the deadline for that certification was coming. With this new realization, I switched back to the AZ-900 some time in early to mid-January because I could see more potential for using what I was learning. I’m happy to say that in early March I passed the AZ-900! Three weeks later I passed the DP-900 and I’m working on the DP-300.

De-prioritizing My Business

This seems like a bad idea for my business, but it is the choice I made. Remember what I said earlier? I was doing too many things at once. Something had to give.

From March 2020 until early December 2020 I had been working hard on business plans and talking to friends in and out of the tech industry to get input. In October 2020 I incorporated the business, currently just named Lee Markum LLC. It is a tech company focusing on helping people with their SQL Server performance issues. I paid a local web developer a small amount of money to make some changes to the website because those changes desperately needed to be made and I wanted to focus on other aspects of the business.

I contacted a company in Canada who works with SQL Server professionals to update websites. The price was a bit of a steep investment so I wanted to wait until I had more cash on hand. I also made some software purchases around the time of the Black Friday sales in November 2020.

The one thing I hadn’t wanted to do was to try to start this business on my own, but that’s what ended up happening. I invited some friends to launch it with me, and for a few months there was interest. However, what I realized was that while I was full steam ahead on this because the idea of this business had been brewing in my head and heart for about 10 years, the timing just wasn’t right for my friends to join me in the adventure. I have no hard feelings toward my friends. As I said, the timing just wasn’t right for them to be involved in the ways I envisioned.

So, the business went on hold for a bit. I needed to get a detail about my Doing Business As name straightened out anyway. Thanks to the slow grinding wheels of state government, that issues wasn’t resolved until sometime in March 2021.

No Blogging or Technical Forums

I didn’t intentionally decide to take a break from blogging and answering questions on forums. This just sort of happened, but I think it was for the best. Blogging takes a fair amount of time and energy. I took the time off in December, but in January I still found that I only had the mental capacity to do my full time technical job as a SQL Server DBA. Compiling blog ideas and  creating drafts still occurred, but that’s as far as I made it and so that is why I have had only 3 posts this year. I plan to get a queue of posts written so I can post at least once a week. I spent my time in Feb/March focused on the two Azure tests I took so I could get them out of the way.

So that’s a big part of what has been going on with me and my various projects. The previous year has been hard on all of us. I am certain most everyone would like to forget that 2020 happened, and we’re all coping the best way we know how.

Next Steps to Take

  1. Assess your well-being. Think deeply about how you’re truly doing right now.
  2. Don’t be afraid to seek professional help.
  3. Watch this presentation from Tracy Boggiano on “Mental Health in IT” presented at PASS this last Fall.
  4. Check out this post from SQL Server guru Kendra Little where she gives advice to her 20 year old self.
  5. Also read here where Kendra talks about experiencing burn out for herself and what she did.