Read more about the article CDC Cleanup job
Microsoft SQL Server

CDC Cleanup job

An introduction to CDC can be found here.

All data modifications in a CDC enabled table are saved in a separate change table. But in order to limit the size of this change table, a SQL Agent job is automatically created, named cdc.XXX_cleanup, that deletes rows older than the configurable “retention value”. The job is created once per database at the moment when CDC is enabled.

(more…)

Continue ReadingCDC Cleanup job
Read more about the article SSDT and three part names
Microsoft SQL Server

SSDT and three part names

Currently, SSDT (SQL Server Data Tools) in Visual Studio doesn’t accept self referencing three part names. That is, objects qualified as DatabaseName.Shema.Object, where the database is the same as where the object resides.

A build will generate an error similar to this one:

[red_box]Error: SQL71561: View: [dbo].[VIEW1] has an unresolved reference to object [SSDT1].[dbo].[TBL1].[/red_box]

As a result, the solution won’t build as long as there are unsolved errors of this kind. Three part names in stored procedures only results in a warning for some reason, and won’t stop a build:

[yellow_box]Warning: SQL71562: Procedure: [dbo].[PROC1] has an unresolved reference to object [SSDT1].[dbo].[TBL1].[/yellow_box]

(more…)

Continue ReadingSSDT and three part names
Read more about the article Master Data Services – MDS – Introduction and Concepts
Microsoft SQL Server

Master Data Services – MDS – Introduction and Concepts

MDM – Master Data Management

Some types of data are shared across systems. One of the best examples of data that is shared across systems is customers. They can appear in a lot of different systems, perhaps a CRM system and a sales system. This means there is a risk of conflicting information. If the CRM system has one customer address, and the sales system another, which one is the correct?

In master data management discussions the phrase “single version of the truth” is often used. What it means is that there must be one reliable source for information regarding, for instance, customers.

Not all types of information are suitable for a MDM solution. Borrowing terminology from data warehouse concepts, dimensions can be managed in a MDM solution. Facts are not suitable in a MDM solution and are better managed by the traditional OLTP systems.

A MDM solution is also a good place to centralize data quality improving activities.

A MDM solution has to be architected so that some systems publish information to the MDM solution, and other systems subscribe to the information. Some systems can be both publisher and subscriber.

Note that normally in a MDS solution, each source system has its own copy of the data. There are solutions where the master data is removed from all source systems and they instead have to look up that information from a centralized master data hub. However, those solutions require rather large changes in the source systems that may not be practical.

In this blog post I’ll briefly describe Microsoft’s solution for MDM – SQL Server 2012 Master Data Services, or MDS. I’ll explain the central concepts in MDS, but I won’t show the steps to actually use MDS. That may be another blog post.

(more…)

Continue ReadingMaster Data Services – MDS – Introduction and Concepts
Read more about the article Can’t shrink log file
Microsoft SQL Server

Can’t shrink log file

On a heavily utilized system with lots of transaction, shrinking the log file may be difficult.

The normal procedure when shrinking the log file, is to first do a backup of the log. Then directly after that try to shrink the log file. But if there are active transactions writing to the log file, shrinking may not be possible, or at least not shrinking as much as expected.

(more…)

Continue ReadingCan’t shrink log file
Read more about the article SQL Server Change Data Capture (CDC) Basics
Microsoft SQL Server

SQL Server Change Data Capture (CDC) Basics

Change Data Capture (CDC) was first introduced in SQL Server 2008, and is a tool that is used to keep track of data changes (DML statements) in tables. CDC must be enabled on the database level, then on the table level, and lastly on the column level (optional).

When CDC is enabled on a table, a new similar table is created, but under the cdc schema. In the new table all changes to to base table are recorded.

Traditionally, triggers have been created to track changes in tables. But CDC is a more light weight technology since the transaction log is read asynchronously for changes. Triggers are part of the original transaction.

CDC is only supported in the Enterprise or Developer editions of SQL Server.

Read on to see a demonstration of CDC basics.

(more…)

Continue ReadingSQL Server Change Data Capture (CDC) Basics
Read more about the article Introduction to Automate BPA Server
Automate BPA Server

Introduction to Automate BPA Server

If you are using SQL Agent together with SSIS and if you have a batch job solution with hundreds of interdependent SQL Agent steps spread across dozens of servers, you may have run in to some maintenance problems.

For complex batch solutions, a Business Process Automation software can be of great help. In this blog post I’ll give a brief introduction to Automate BPA Server from Network Automation.

(more…)

Continue ReadingIntroduction to Automate BPA Server
Read more about the article sp_cycle_errorlog
Microsoft SQL Server

sp_cycle_errorlog

Sometimes the error log files in SQL Server get too large to view and manage in a practical way in Management Studio. SQL Server keeps a number of log files (between 6 and 99), and a new error log file is created each time the SQL Server Service is restarted.

If you want to cycle the logs more frequently without a service restart, you can do so with the system stored procedure sp_cycle_errorlog. This way, you can get smaller and more log files.

(more…)

Continue Readingsp_cycle_errorlog
Read more about the article Logging changes to sys.configurations
Microsoft SQL Server

Logging changes to sys.configurations

Some server wide settings can have major negative impact if they are changed in your SQL Server environment. So as a DBA it is a good practice to monitor changes to these setting, and to raise alerts when they are changed. To do this, the system view sys.configurations can be monitored for changes.

This blog post will demonstrate a way to monitor SQL Server configuration settings. The solution will also give you get the complete history for the different settings in sys.configurations.

Note that database mail needs to be configured for the current solution to work properly.

(more…)

Continue ReadingLogging changes to sys.configurations