Just a quick blog post to share a query, which I wrote to monitor availability groups and replicas and the associated databases:
WITH [AvailabilityGroupReplicaCTE] AS ( SELECT dc.[database_name] ,dr.[synchronization_state_desc] ,dr.[suspend_reason_desc] ,dr.[synchronization_health_desc] ,dr.[replica_id] ,ar.[availability_mode_desc] ,ar.[primary_role_allow_connections_desc] ,ar.[secondary_role_allow_connections_desc] ,ar.[failover_mode_desc] ,ar.[endpoint_url] ,ar.[owner_sid] ,ar.[create_date] ,ar.[modify_date] ,dr.[recovery_lsn] ,dr.[truncation_lsn] ,dr.[last_sent_lsn] ,dr.[last_sent_time] ,dr.[last_received_lsn] ,dr.[last_received_time] ,dr.[last_hardened_lsn] ,dr.[last_hardened_time] ,dr.[last_redone_lsn] ,dr.[last_redone_time]…
To optimize the performance of your database, you need to monitor and tune. You determine the performance baseline, how SQL Server is currently performing, through monitoring. Your optimization process includes making changes and then monitoring their effect. This means adjusting two overlapping performance areas, that is, database server performance and… Read more
SQL Server databases are the backbone of many enterprise applications, and good Transact-SQL (T-SQL) code is the best way to maximize SQL Server performance. Therefore, it is important for SQL developers to follow T-SQL best practices and guidelines when writing code. This article highlights some common T-SQL best practices to… Read more
Microsoft Windows Azure SQL Database, commonly known as SQL Azure, is a relational database in the cloud that is part of the Windows Azure platform. Although Windows Azure SQL Database is built on the SQL Server platform, there are differences you should consider when performing an Azure SQL Database migration. Read more
A critical part of database design and management is index design. Index design involves balancing space requirements and the resource overhead required to keep indexes up-to-date compared to the performance improvements resulting from the indexes. You can either use dynamic management functions (DMFs) and views (DMVs) or Database Engine Tuning… Read more
An execution plan is the sequence of operations SQL Server query optimizer performs to run the statements. The SQL Server query optimizer creates an execution plan before it actually runs a query. As per Microsoft Book Online, “Execution plans graphically display the data retrieval methods chosen by the SQL Server… Read more
Many database servers store confidential data, which must be protected from unauthorized access when it’s transmitted across the network and stored on the server. SQL Server provides support for encrypted connections, encrypting data, encrypting database and for encrypted storage.
Bulk transfers are a common way of importing large amounts of data into, or exporting large amounts of data out of, SQL Server databases. SQL Server supports bulk transfers run from an operating system command line or the SQL Server command processor. When performing bulk transfers, you must consider the… Read more
A trigger is a specialized stored procedure that activates (executes) in response to an event. There are two basic trigger types, ie data manipulation language (DML) trigger and data definition language (DDL) trigger, based on the type of event that causes them to fire. For example, a data manipulation language… Read more
SQL Server Integration Services (SSIS) security is based around several layers that provide a rich and flexible security environment. These layers of security include the use of digital signature, package properties, SQL Server database roles and operating system permissions.
In the first of this three-part series, you will learned how to use scripts and batches, and basics of T-SQL variables.
Checkout the part-2 of this article series here, you will learn about Transact-SQL control-of-flow language, including BEGIN…END, IF…ELSE, CATCH, WHILE, BREAK, CONTINUE, RETURN, and WAITFOR.
This article is… Read more
SQL Server users use Transact-SQL programming to create sets of statements for ad-hoc execution. The aim of the Transact-SQL programming is to carry out its transformation objectives by using: Command statements, Variables, and Control-of-flow statements. In this context, a command statement is any executable statement. This includes Transact-SQL commands, stored… Read more
Microsoft ships SQL Server with several built-in tools that database administrators (DBAs) can use to manage their SQL Server environment. With SQL Server 2005, Microsoft introduced SQL dynamic management views, or DMVs, as well as dynamic management functions, or DMFs. They provide plenty of information about server and database state,… Read more
Most of the activity of the database server is related to queries. Because of this, query optimization is often a major concern. SQL Server tries to optimize query performance itself, but its effectiveness in this may be influenced by several problems. Indexes and poorly designed queries can lead to unacceptable… Read more
Checkout the part-4 of my five part article series on Guide to SQL Server Table Indexes here, in which you will learn about index design, and the suitable candidates for index key and non-key columns. I this article, you will also learn about various SQL Server indexes options, such… Read more
A database server is generally a mission critical component. Having a recovery plan is essential to ensure the business can continue to function in case of hardware failure, natural disaster, or other catastrophe.
A backup server or a standby server (using Database Mirroring, AlwaysOn Failover Cluster Instances, AlwaysOn Failover Groups… Read more
Managing changes to environment dependent variables is common and critical in any ETL application, especially during deployment of SSIS packages. This is because they need to be modified appropriately to ensure smooth deployment of ETL application. SQL Server Integration Services (SSIS) provides package configurations that help you to manage such… Read more
Checkout the final part of this two part article series here, in which I discussed how to create full-text index using Transact-SQL, and how to manage and optimize full-text search catalogs and indexes.
This article is published on SSWUG.org.
SQL Server allows applications and users to execute full- text search queries against character based data in SQL Server tables. Full-text search is applicable in wide-range of business scenarios. You use full-text search to create queries that search for a word or phrase in a column. You can use full-text… Read more