Each event that causes data loss or disruption of regular daily operations on a SQL Server can be defined as a “disastrous” event. These events include power outages, hardware failure, virus attacks, various types of file corruption, human error, natural disasters, etc. Although there are many methods that are focused on preventing these events, they still occur from time to time and therefore require proper measures to be addressed. One of the most effective methods for this purpose is the creation of a suitable disaster recovery plan.
May 15, 2017How to synchronize specific rows on a SQL remote database using a database installer package
Challenge
Even now there are some isolated SQL Servers (without internet access or a limited one) that need to have databases updated with data changes on a daily basis. These kinds of SQL Servers need a way to get the latest data changes from the master SQL database.
May 8, 2017How to detect whether index maintenance affects SQL Server performance
The article How to detect whether index fragmentation affects SQL Server performance explains how and in what cases the Index fragmentation affects SQL Server performance, and when a DBA should and should not have to deal with fragmented indexes. This article will deal with the situation when Index fragmentation affects SQL Server performance and has to be dealt with
May 5, 2017Two ways to rename SQL Server database objects
From time to time, a database object may need to be renamed for various reasons. When that happens, native features for renaming SQL Server database objects can be very useful. But, there are big differences between just renaming SQL Server database objects in the SQL Server Management Studio and Safe renaming them with ApexSQL Refactor.
This article will explain the differences between renaming database objects with SSMS and the ApexSQL Refactor’s Safe rename feature.
April 27, 2017How to automatically compare and synchronize multiple databases on different SQL Server instances
Challenge
It’s often quite a challenge to keep all SQL databases located on different SQL Servers in sync. As time goes by, a lot of schema and data changes are made on QA databases on daily basis that require to be in sync with Production databases.
To keep everything in sync, there should a system that would be either triggered or scheduled to run the comparison of all SQL databases and synchronize the ones were changes are detected. This system should be also aware of any dependencies during the synchronization in order to keep the SQL database integrity.
April 5, 2017How to set up email notifications for backup jobs in SQL Server
Introduction
For a SQL Server DBA handling multiple databases on any given time, knowing how to set up regular backup schedules, backups with unique names on a daily basis, making backup mirrors for redundancy, cleaning up old backup files is important. Equally important is automatic confirmation that the backups have been successfully created for the databases with an email notification. There are a couple of different ways to set up email notifications which can be done from Microsoft’s SQL Server Management Studio.
April 3, 2017SQL Server database continuous integration workflow DOCUMENT step – Creating database documentation
In this article, the Document step of the Continuous Integration workflow will be described. After the Sync step is successfully completed, in this step, database documentation is created, using the latest changed database version.
March 24, 2017How to build a SQL Server database from source control
Challenge
In order to perform any continuous integration or delivery process, an important requirement – to be able to pull out the database (which was previously versioned in source control), automatically and repeatedly, to recreate the database in a QA environment at a click a button (or scheduled on a commit).
March 10, 2017How to automate SQL Server defragmentation using policies
Introduction
Apart from numerous factors, poor index maintenance can be a reason for decreased SQL Server performance. If a database contains tables with numerous entries, that get updated frequently, it is most likely that high index fragmentation will occur. For smaller indexes, high fragmentation does not necessarily degrade the performance of the queries that are run on a table. But for the larger tables, with indexes that consist of 1000 pages and more, fragmentation could cause noticeable performance issues. Luckily, performing index maintenance tasks on a regular basis can eliminate the risk of degrading performance significantly. The most effective ways for treating index fragmentation are reorganize and rebuild index operations.
March 9, 2017How to version and audit schemas and rollback changes with schema snapshots
Challenge
One of the most important things for a DBA when it comes to managing databases is schema change auditing. This involves tracking changes over time, identifying differences between two versions and even rolling back changes to a previous baseline.
March 1, 2017How to monitor SQL Server replication agent status
Determine the replication agents’ status
Insight on replication agent status can be collected manually or programmatically. This article will consider both cases, and also when a replication agents’ status will be determined in relation with all publications, or a particular one.
February 24, 2017How to monitor database status changes in SQL Server
Database status overview
Every database in a SQL Server environment has two basic states: full availability (online state) or full unavailability (offline state).
February 20, 2017How to apply static data under source control to a SQL Server database
Prelude
In the Understanding SQL Server database static data and how it fits into Database lifecycle management, we covered topics from the basics (what is the static data, why it is used), followed by the explanation of how to version control the static data, meaning how to initially commit, how to track changes and how to apply static data from SQL source control to a database.
February 13, 2017Fragmentation in SQL Server – how to detect its high level and automatically fix it
Introduction
When working with databases, availability and performance are of supreme importance. The key among them is low Fragmentation in SQL Server, which allows fast query processing. That can be facilitated using indexes. Indexes are like the table of contents in a book, providing shortcuts to where the information is located. Otherwise, the book should be read from the beginning until the needed information is found. The same goes for databases. If there weren’t for indexes, for every query there should need an entire table scan.
February 8, 2017How to deploy static data from SQL source control to database
Prelude
As described in the article Understanding SQL Server database static data and how it fits into Database lifecycle management, the reasons for version controlling static data were reviewed.
February 8, 2017How to manage version controlled SQL Server database static data; from commit to usage, to deployment
Challenge
As explained in this article Understanding SQL Server database static data and how it fits into Database lifecycle management including static data in SQL Server database source control is important for a successful CI/CD implementation.
February 3, 2017Three phased approaches to getting your SQL Server database into source control
Challenge
Database development teams show an increasing interest in getting their SQL Server databases into source control. However, depending on the team’s actual needs, their development plan and the level of source control integration required, there are various ways to achieve getting a database under source control.
January 25, 2017How to delete old database backup files automatically in SQL Server
Introduction
While working with a number of databases, creating a recovery plan can be challenging, especially if we want a foolproof design. Automated backup and restore strategies ensure the recovery plan is successful. However, strategies relying on frequent backups, although part of a sound strategy, can start causing issues when available storage space becomes limited. Old database backups are in many cases unnecessary, and it is often prudent to delete those backups to increase available storage. This can be done manually or automatically. There are several options to delete old backup files automatically in SQL Server:
January 19, 2017How to pull version controlled SQL Server database static data from a repository
Prelude
In the article “Understanding SQL Server database static data and how it fits into Database lifecycle management” we covered what is static data in general and numerous reasons why it needs to be version controlled.
January 13, 2017Automatically comparing and synchronizing data changes in a SQL Server database
For the second use case, when only data changes are made to the source control repository, a combination of 3rd party applications – ApexSQL Build and ApexSQL Data Diff, can be used to perform this Sync step. ApexSQL Build can be used to build a database from the source control repository along with its static data, while ApexSQL Data Diff can be used to synchronize data from the built database to a QA database.
January 13, 2017