Translate

Sunday, October 4, 2020

Recover from a Data Disaster – Point in Time Recovery Method

If you are a database administrator, you will never know when your database hit a disaster. When the disaster hit your database, you will be in a panic mode and you will take action which you won't take in modest conditions. However, we need to plan for a disaster. This article provides you with the importance of Point in Time Recovery Method in order to recover data.

This is a fantastic feature in databases but you will not realize how valuable this until you come across this situation. Leaving describing these features to separate time, let us first look at two cases. Incidentally, these two incidents occurred in one organization and moreover for one database but at different times.

Incident #1:  A developer was connected to both production and development instances of databases from one SQL Server Management Studio (SSMS) instance. If you have work with SSMS, you would understand how risky this is. If not, this incident tells you how risky it is. The DBA thinking that she is working on the developer instance has deleted data in a customer table in Production.

Incident #2: In the same organization, they decided to increase the column length to 50 from 15. This column is a critical column to the business. They increased the size of the column using the design view from a table. Guess what, before typing the 0, after removing the 1 the user has saved the designed, which had resulted in the truncation of the table column to 5 from 15 with a data loss!!

Action: In both cases, we were to help. The first question was “What is the recovery model?” if it is Simple, then nothing that we could do as Simple recovery model does not keep the transaction log history and nothing can be recovered. In these scenarios, the recovery model is Full means that we can recover data to a point of time. In this mechanism, we can recover to a given time. So, we got the full back up of database and restored to a different database instance with the recovery option on. Then we got a log backup and restored on top of the previously restored database with specifying a time which is just before the disaster recovery. After the database is restored fully, customer table and the other tables were transferred to the production database.

Lesson Learnt:
  • ·  Never connect to multiple databases instances from SSMS. Especially, with production and other database instances.
  • ·  Never use the SSMS designer, to modify the database schema. Always use scripting for schema design changes. 
  • ·  Always, use the Full recovery model for production.

  • If you need more details, read the article written by me at sqlshack. Further, you can use Log shipping to avoid data disasters as discussed in the latest article. 

Friday, October 2, 2020

Unknown to Known OR Technical Thinking to Business Thinking

This story is a real story that happened back in 2008. I was working in Project for UK client whose prime business is producing advertisements. 

Let me explain the business case first of all. They had few studios in the UK where they have artists working in these studios. They had teams and each team has one or many sales representatives. Sales representatives were the people who bridged between artists and their clients. Sales Reps goes to the clients and get their requirements. Then he comes to his team and explains the requirements. Then the artist comes up with different artwork. Then again busy sales reps go to the clients for their reviews. If he is lucky enough, the trip will end up where the client has selected one artwork with few reviews. However, until the client selects an artwork, the poor sales representative has to run over and over again. 

Management has a problem to solve. 


What are the qualifications of artist that makes the artwork to select? 

By answering this question, management looking at fixing the issue in two ways. 

1. Train the existing artists with the relevant qualification. 

2. When hiring new artists, make sure they have these qualifications. 

Then, I was one member to provide them with a solution with. Now, we required two sets of data, Production & HR which were developed by two different vendors with different technologies and not under any maintenance agreement. If I remember the numbers, there were 121 artists in the production database that needs to be matched in the HR system. 

Obviously, the matching key would be Employee ID or Employee Number. Unfortunately, both systems did not have the same global key to match. Then we decided to match the artist with the Employee Name. 

out of 121 artists, 101 artists did not give us any trouble as they were exactly matched. out of balance 20 artists, 17 of artist we were able to match with Fuzzy Lookup. This is due to the fact in of the system, there were spaces and dots in the names which were not in the other system. However, after spending some quality time with different configurations of Confidence and Similarity levels in Fuzzy Lookup Configurations, we were able to crack those 17 artists. Now we have three artists left where we could not match. 

Further analysis shows that these artists were ladies! Any guesses??

Yes, most of you are correct. After their marriage, they have changed their names and in one system you have the option of changing the name in another system you do not have an option t change the name. (You know what, I have been telling this story for more than 12 years now, every time it is the male who provides the correct reason for this mismatch. Will leave that analysis for a different date). 

Since we know the reason for the non-matching for these three artists, we tagged them to UNKNOWN category which is what is our typical technical approach in reporting or in data warehousing.  So we thought we crack the Artists "problem" and we were over the moon. So in all of our fancy reports and dashboards, whether it is Sales Rep wise, Artist Groups wise, Studio wise, all of these reports shows three artists work under UNKNOWN category. During our presentation, we presented these reports and dashboards with our head is high, needless to say proudly. We never thought that our proud would be short-lived. 

During the question time, Finance Manager who was a lady very quietly asked "guys, who are these unknowns". As you can imagine, I was ready with the answer. I had byhearted those ladies names, as this was expected question. I proudly said those names and the reason for not matching them. Further, I took the opportunity to explain our Fuzzy lookup techniques boasting our technical capabilities. 

She first acknowledged our capabilities, "great work guys", but then came the killer questions. 

"If you know these ladies names, how can you call them unknowns"

I was looking like a tiger without nails. Though they accept our project, that question has left me to thrive for a solution. I came up with a very simple solution. I used type 3 slowly changing dimension design. I introduced a simple table, where you have two columns with the previous name and current name. 

So the final solution was 

 1. Perform a simple lookup

 2. Perform a fuzzy lookup for non-matching names,

3. Lookup new table and find the previous name and perform a lookup.

Though we came up with a solution. This incident has changed our thinking ability. If you further analyse her question, business-wise we knew who these employees are, but technically we did not know them. In approach, we placed our technical knowledge over business knowledge. That was the clinical mistake we did. The lady with less technical knowledge was driven us for a technical solution to achieve success. 

Finally, I leave you with this great saying. 

"Whether you succeed or not is irrelevant, there is no such thing. Making your unknown known is the important thing"

Georgia O'Keeffe

Monday, December 9, 2019

Encryption, Decisive Factor to lose the WWII

Germany and Japan were gaining momentum to win world war II and concur the world. Some crucial decisions have changed the complexity of the game upside down.
Until late 1942, the United States was not in the war as an active participant, though they were indirectly supporting their allays. In late 1941, Japan decided to give them a run by attacking Pearl Habour so that Japan can expand its control in Asia to Pacific whereas German is extending its powers through Europe. Japan wanted to destroy US Aircraft carriers so that they can get control of the pacific. However, on that day aircraft carriers were not in the port. After the Pearl Habour attack, the US wanted to give it back to Japan by attacking Tokoyo which they did successfully.

Image result for pearl harbour attack
Pearl Harbor Attack: Reference www.atomicheritage.org

Then Japan decided that they have to destroy the aircraft carrier which was escaped during the last attack. Japanese admiral, Yamamoto planed for a trap by attacking Midway island which is somewhat mid between Japan and the USA. Yamamoto divided his troops into three. First troops have to attack the bases in Midway, while his air troops will destroy the US aircraft carriers which will come rescue.

But,
this plan was de-coded by the US naval intelligence in Pearl Harbour. So the USA moved his troops close to the Midway way before the arrival of Japan's troops. Also, they had another set of troops waiting for Japan's arrivals.

Though the Japanese are more superior than the US naval troops, they were able to withstand the Japan attack, mainly due to the fact that the US was able to decode the encrypted messages of Japan communication.







Tuesday, September 17, 2019

Migrating On-Premises Microsoft SQL Server Business Intelligence Solution to Azure

Some organizations are looking at the possibility of migrating their Microsoft Business Intelligence solutions to the cloud due to cost-effectiveness, easier maintenance, scalability, etc. However, they are running current solutions on-premises which have been servicing their stakeholders for years. Because of this, with the cost factor and the time factor, it might not be feasible to start a new solution from scratch. Although they would like to lift and shift the existing solution to the cloud as-is, there are a lot of issues with that migration. Mainly, some of the existing features may not be compatible with the cloud. This article looks at how on-premises Microsoft Business Intelligence solutions can be migrated to an Azure environment.

Wednesday, August 28, 2019

SQL Server ALTER TABLE ADD Column overview


In this article, we will explore SQL Server ALTER TABLE ADD Column statements to add column(s) to an existing table. We will also understand the impact of adding a column with a default value and adding and updating the column with a value later on larger tables.

Naive Bayes Prediction in SQL Server

This is the second article of the data mining series.
https://www.sqlshack.com/naive-bayes-prediction-in-sql-server/

Tuesday, August 27, 2019

SQL Server 2019 Reporting Services RC1 now available - here's all that's new

Last year, Microsoft announced SQL Server 2019, its new database management system (DBMS) that helps manage both relational and non-relational databases through a common service. It runs on-premise, in the cloud, and on Azure Stack as well.

Read more from https://www.neowin.net/news/sql-server-2019-reporting-services-rc1-now-available---heres-all-thats-new

Wednesday, July 31, 2019

Introduction to SQL Server Data Mining

Prediction, is it a new thing for you? You won’t believe you are predicting from the bed to the office and to back to the bed. Just imagine, you have a meeting at 9 AM at the office. If you are using public transport, you need to predict at what time you have to leave so that you can reach the office for the meeting on time. Time may vary by considering the time and the day of the week, and the traffic condition etc. Before you leave your home, you might predict whether it will rain today and you might want to take an umbrella or necessary clothes with you. If you are using your vehicle then the prediction time would be different. If so, you don’t need to worry about the rain but you need to consider the fuel level you need to have to reach to the office. By looking at this simple example, you will understand how critical it is to predict and you understand that all these predictions are done with your experience but not by any scientific method.

Read full article https://www.sqlshack.com/introduction-to-sql-server-data-mining/

Monitoring SQL Server Analysis Services with Extended Events

Monitoring is an essential aspect in any system and it is an important factor in SQL Server Analysis Services as well. Monitoring will help troubleshoot, audit operations and sometimes monitoring is needed to support various standards and legislation. SQL Server Analysis Services (SSAS) is an OLAP tool used for analysis of data and in many cases SSAS multidimensional cubes and tabular models contain data from many sources and therefore it might be essential to audit who is accessing what. Also, when there are performance issues in SSAS, monitoring needs to be enabled. This article discusses what options SQL Server provides to enable monitoring for SSAS.

Read this article https://www.mssqltips.com/sqlservertip/6121/monitoring-sql-server-analysis-services-with-extended-events/

Monday, June 3, 2019

Windows And SQL Server 2008 And 2008 R2 End Of Life


Windows Server 2008/2008 R2 and SQL Server 2008/2008 R2 are on their extended support phase now. July 8, 2019 for SQL Server 2008/2008  R2 and January 14, 2020 for Windows Server 2008/2008 are the end-of-life dates. Once you hit these dates, you will essentially be running those machines at your own risk in this bloated age of cyber attacks. 

Following are the options you have
Path 1:  The first path is the traditional evolutionary path of upgrading to a newer version of Windows Server and SQL Server. 

Path 2:  If you do not want to upgrade to the latest server versions—don’t worry—Microsoft has you covered. Microsoft recently announced a few options for those who want to continue on Windows Server 2008/2008 R2 and SQL 2008/2008 R2. To save money, you could simply move your Windows Server 2008/2008 R2 and SQL 2008/2008 R2 to Azure by using the Azure Hybrid Use Benefit. The only cost you would incur would be computed and infrastructure.

Read more at https://community.connection.com/windows-sql-server-2008-2008-r2-end-life-coming-soon-now/