Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
Featured Script
The Voice of the DBA
 

Daily Coping Tip

Pause, breathe, and feel your feet firmly on the ground.

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

How Do You Decide to Rollback?

One of the constant questions I get from Redgate customers is about rolling back database changes. We build software to help you deploy changes, but what about rollbacks? I think I've heard this in almost every conversation I've had on this topic in the last 5 years. It's one reason that Flyway has undo, though with some caveats. Please don't expect this works magically like a restore operation.

These is a complex topic, and one that can be way harder than a rollback for application changes. In fact, everyone wants it to be simple, but I don't think it ever will be. There is a big reason for that: data. Undoing data changes can be impractical, especially in if there are lots of changes.

The question I'd like you to ask yourself, and give me thoughts about, is when do you decide to rollback. How can you make that decision in a production system? Are there criteria or guidelines you use? Do you ask someone else? Maybe another aspect of this situation is how you decide to roll forward instead of rolling back.

I was listening to some MVPs discuss this awhile back and one of the main criteria that one person brought up was data changes. This individual said if no data had changed, they just undid everything. However, once data changed, they were likely in a roll forward scenario where they needed to fix code quickly.

That's often the big factor for me. Once data is changed (or added), then we often can struggle to rollback. If we have an application that needs a new column, and we add it, if there software has a problem, we may not be able to roll back because the old software doesn't work with the new column. We don't want to delete the column, at least not until we save the data. These are the problems.

The easy rollbacks are when the deployment fails and transactions undo the work, or we just quickly undo everything we did. That's an easy decision, but I rarely find this sort of issue. Instead, usually we find certain data breaks our application or the logic is improperly implemented.

I look forward to your ideas and thoughts here, but I do have some advice. One thing I always tell customers is that you want to deploy often, so that you are ready to fix something you broke. That's important. The other thing that simplifies life is to never add and delete objects in the same deployment. This goes for everything. If I add new first and last name columns, but keep the old fullname column, if I've broken something, I still have the old columns and data. I can rollback easier. If everything works, I can always delete the fullname column later. Following these concepts has made my life much easier when I made database changes.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents

More on Column Choice and Order for Multi-column Non-Clustered Indexes

Mike Byrd from SQLServerCentral

In the last year I’ve published articles on indexes to include Indexes: When Column Selectivity Is Not Always A Requirement – SQLServerCentral and Query Optimizer Suggests Wrong Index and Query Plan -- Why? – SQLServerCentral. This article is a continuation of just how the optimizer interacts with the index wizard. We’ve all heard and read […]

But we've always done it this way?

Additional Articles from Redgate

This statement can be the biggest hurdle in changing software development and deployment processes. So, the question comes up pretty frequently: How do you overcome it? Grant Fritchey explores techniques to understand and coach others towards change.

Embed Power BI in Jupyter Notebooks

Additional Articles from SimpleTalk

Power BI and Jupyter Notebooks are popular tools, but you may have never thought about using them together. Dennes Torres demonstrates how to do that and also asks why.

From the SQL Server Central Blogs - Centralized vs decentralized data architecture

James Serra from James Serra's Blog

One of the biggest differences between the Data Mesh and other data platform architectures is a data mesh is a highly decentralized distributed data architecture as opposed to a...

From the SQL Server Central Blogs - Suggested Topics in Power Virtual Agents

Devin Knight from Devin Knight

Power Virtual Agents empowers subject matter experts to build intelligent conversational bots, using a guided, no-code graphical interface. In this video you will learn how

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Swapping Values

I have this in python 3.9:
a = ['a','b','c']
b = [1, 2, 3]
a,b = b,a
b
What is returned?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Finding Keys

I am using Always Encrypted in SQL Server 2019. I have a symmetric key for the key that is used to actually encrypt the data. Which DMV stores the metadata about this key?

Answer: sys.column_encryption_keys

Explanation: For Always Encrypted, the asymmetric key that protects the key used to encrypt data is stored in sys.column_master_keys. The key used to encrypt column data is stored in sys.column_encryption_keys. Ref: sys.column_encryption_keys - https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-column-encryption-keys-transact-sql?view=sql-server-ver15  

Discuss this question and answer on the forums

 

Featured Script

PowerShell script to create SQL Server alias name

vijeesh.plr from SQLServerCentral

This script is useful for your environment having multiple always-on with replication setup and your listener value is persisted with RegisterallIP set to 1. When initiating the always-on failover, It will create/update the alias in the distributor server by pointing to the new primary server without RDP to each distributor server and that makes the […]

 

More »

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2016 - Administration
SSRS Query Designer times out - Hello experts, I am getting the following error when trying to open the Query Designer for the a report Dataset in Report Builder. The report runs successfully in the browser and in Report Builder. And the data sources for the report validate successfully. I also checked for TLS issues, but the report server is correctly […]
Error 17311 while trying to run query with OPENDATASOURCE - SQL Server 2016 SP2 terminates suddenly with the error id 17311. Here's the SQL dump error: 2021-06-27 10:32:05.29 spid63 SqlDumpExceptionHandler: Process 63 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. 2021-06-27 10:32:05.29 spid63 * ******************************************************************************* 2021-06-27 10:32:05.29 spid63 * 2021-06-27 10:32:05.29 spid63 * BEGIN STACK DUMP: 2021-06-27 10:32:05.29 spid63 * 06/27/21 10:32:05 […]
SQL Backup/Restore - Hi, Production database : I have a database Backup size is 300 GB from production server. Total size of hard disk is 1 TR in Production. Test environment: I want to restore a database in test, not all the tables from backup mdf. , i need only 50 GB data, from the database backup. Total […]
SQL Server 2016 - Development and T-SQL
Unable to create USER with T-SQL - Hello Community, Can someone explain why I'm getting the error Incorrect syntax near '-' When I run the followng sql code: CREATE USER DT-SERVICES-TEST WITHOUT LOGIN; My guess is because of the hypen '-' If that is the case, can someone let me know how to add the code with the hypen? Thanks    
sp_server_diagnostics_sleep - Hi, we are trying to bulk write the data in the table. but the process seems to get slow. On checking the wait type, i found continuous records of sp_server_diagnostics_sleep. Couldn't find the real reason for the latency of bulk insert in the table. Kindly help Saumik Vora
Need to get records based on Sub Query - I have written the query using ranking function. I tried to write the same query using sub query no clue. Can any body help The query below as follows WITH HighRecords AS ( SELECT BusinessEntityID, FirstName, MiddleName, LastName, TotalDue, ROW_NUMBER() OVER(PARTITION BY BusinessEntityId ORDER BY TotalDue ASC) AS RN FROM Person.Person Pp INNER JOIN Sales.Customer […]
Trouble filling missing months of data with zero values - Hello, Hopefully someone can help a novice with the following problem i have. We have as system that records monthly reported figures and for several accounts, quite often the sites don't report their figures. So for a 12 month period there can often be gaps. I would like to show all months in a result […]
Administration - SQL Server 2014
Unable to connect to SQL Server instance - I just created 2 named instances on 2 different server. Created firewall rules, enabled TCP/IP, made sure SQL Browser was running, both instances are running under default acct. I am able to connect to 1 named instance thru SSMS from my local machine and not to the other. I am also able to ping both […]
Development - SQL Server 2014
SQL Server 2014 Developer Edition - Hi, Can we use SQL SERVER 2014 Developer free Edition for UAT environment. Please help me. Thanks, Carmelo Labadie
SQL Server 2012 - T-SQL
Cursor replacement suggestions - I have a process that uses SqlAgent jobs to process data coming from many sources, and I'm seeing performance issues trying to process the data. Looking for suggestions on processing of the data table. I have a single SP currently processing from the table and it has a parm of equip_id so I break the […]
SQL Server 2019 - Administration
Who Update the Stored procedure Last time? - Hello EveryOne, Need your help once again. I have lots of Stored PRocedures in my Database and we are 3 sql dba/developer . But need to know who updated the stored procedure last time? or by whom the stored procedure was updated last time?? Any Help or suggestion would be appriciated. Thanks in advance.
SQL Server 2019 - Development
transposing date column to rows - Hello people, I am trying to transpose date column to rows. I am not sure if this can be done for more than 10000+ rows. For example, I am trying to convert the table in image 1 to image 2. Please note that the below is just a example extract of the data , the […]
Splitting adhoc queries into a data structure - Issue - Current adhoc SQL can be generated by our reporting module that is difficult to maintain much less decipher.  The TSQL is huge and almost un-manageable.  This makes it extremely hard to figure out what to do since we can have hundreds of queries Partial solution - instead of using profiler we have a […]
SQL Azure - Administration
Backup/recovery using native Azure tools - Hello, Hopefully someone who manages and administers hundreds of SQL Server VM's in Azure can share their experience. We have a few dozen SQL Server VM's in Azure and a small handful of managed instances. One of the issues we run into is the lack of visibility into backup failures, as well as being able […]
Powershell
load xls file to sql - Looking for a script to load xls files to SQL without using dbatools or a Driver that's need to be loaded... Is there any Native loads of xls to SQL using PS script? I've been trying to use a script that converts cls to csv, but I run into issues on fields where the delimter […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -