Practical SQL Server http://sqlmag.com/blog/10109/feed en Stop Using INFORMATION_SCHEMA and SysObjects for Exists Checks http://sqlmag.com/blog/stop-using-informationschema-and-sysobjects-exists-checks <div class="node-body blog-body"><p>Code like this isn&rsquo;t optimal:</p> <pre> <div class="geshifilter" style="white-space: nowrap;"><div class="text geshifilter-text" style="font-family:monospace;">IF EXISTS(SELECT * FROM sys.objects WHERE name = N'TableToDrop' AND type = 'U')<br /> &nbsp; &nbsp; &nbsp; &nbsp; DROP TABLE TableToDrop;<br /> GO</div></div></pre> <p>Neither is this:</p> <pre> <div class="geshifilter" style="white-space: nowrap;"><div class="text geshifilter-text" style="font-family:monospace;">IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TableToDrop')<br /> &nbsp; &nbsp; &nbsp; &nbsp; DROP TABLE TableToDrop;<br /> GO</div></div></pre> <p>Yet, I see both of those used all of the time &ndash; over and over again. Even though it&rsquo;s 2015. &nbsp;</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/stop-using-informationschema-and-sysobjects-exists-checks" target="_blank">read more</a></p> http://sqlmag.com/blog/stop-using-informationschema-and-sysobjects-exists-checks#comments SQL Server ALTER ALTER CREATE CREATE DROP DROP EXISTS EXISTS INFORMATION_SCHEMA INFORMATION_SCHEMA sys.objects sys.objects Practical SQL Server Tue, 01 Sep 2015 18:50:00 +0000 25811 at http://sqlmag.com A Replacement for Maintenance Plan Backups http://sqlmag.com/blog/replacement-maintenance-plan-backups <div class="node-body blog-body"><p>This blog post is a bit of a &lsquo;repeat&rsquo; &ndash; since I already covered much of the rationale behind this post in <a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-23-maintenance-plan-backups-and-ssis-pack">Part 23 of my multi-part series on AlwaysOn Availability Groups and SQL Server Agent Jobs</a>. But, I also figured that this is enough of an important topic to merit its own blog post.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/replacement-maintenance-plan-backups" target="_blank">read more</a></p> http://sqlmag.com/blog/replacement-maintenance-plan-backups#comments SQL Server Maintenance Plans Maintenance Plans SQL Express Backups SQL Express Backups SQL Server Backups SQL Server Backups Practical SQL Server Thu, 27 Aug 2015 17:45:00 +0000 25781 at http://sqlmag.com Looking forward to Containers http://sqlmag.com/blog/looking-forward-containers <div class="node-body blog-body"><p>Virtualization has long been a staple when it comes to computing. In essence, virtualization is really just the use of abstraction to make things either easier to manage or more fault-tolerant. Disks, for example, have long been virtualized in the sense that a single, physical, can easily be divided up into multiple logical (or virtual) volumes (or drives) just as easily as a number of discreet physical disks can also be virtualized into a single drive (via RAID) &ndash; which can further be partitioned into volumes, LUNs, and so.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/looking-forward-containers" target="_blank">read more</a></p> http://sqlmag.com/blog/looking-forward-containers#comments Systems Management SQL Server containers Containers deployment deployment docker docker future future SQL Server SQL Server virtualization virtualization Windows Windows Practical SQL Server Wed, 19 Aug 2015 19:54:00 +0000 25731 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 29: Practical Implementation Tips http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-29-practical-implementation-tips <div class="node-body blog-body"><p>My initial goal in writing this series of posts was to outline some of the concerns surrounding Availability Groups (AGs) and SQL Server Agent Jobs &ndash; and call out how there is virtually no guidance from Microsoft on this front and then detail some of the pitfalls and options available for tackling this problem domain. I initially expected this series of posts to have between 25 and 30 posts &ndash; according to some of the early outlines I created &lsquo;way back when&rsquo;.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-29-practical-implementation-tips" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-29-practical-implementation-tips#comments SQL Server backups backups ETL etl jobs jobs SQL Server Availability Groups SQL Server Availability Groups SSIS SSIS Practical SQL Server Tue, 28 Jul 2015 18:03:00 +0000 25391 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 28: Additional Options for Tackling Jobs Failover http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-28-additional-options-tackling-jobs-failo <div class="node-body blog-body"><p>Throughout this series of posts I&rsquo;ve taken a somewhat pessimistic view of how SQL Server Agent jobs are managed within most organizations &ndash; meaning that most of the code and examples I&rsquo;ve provided up until this point were based on assumptions about how CHANGE to jobs is managed. That pessimism, to date, has come in two forms:</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-28-additional-options-tackling-jobs-failo" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-28-additional-options-tackling-jobs-failo#comments SQL Server availability group Change Management Change Management Failover jobs SQL Agent job sql server agent Practical SQL Server Mon, 06 Jul 2015 18:06:00 +0000 25211 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 27: Options and Concerns for More Advanced Deployments http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-27-options-and-concerns-more-advanced-dep <div class="node-body blog-body"><p>In this series of posts I&rsquo;ve called out some of the concerns related to SQL Server AlwaysOn Availability Groups and their interaction with SQL Server Agent jobs &ndash; both in the form of Batch Jobs (see <a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-3-defining-batch-jobs">post #3</a>) and backups.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-27-options-and-concerns-more-advanced-dep" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-27-options-and-concerns-more-advanced-dep#comments SQL Server AlwaysOn Availability Groups AlwaysOn Availability Groups backups backups licensing licensing Preferences Preferences SQL Server Agent Jobs SQL Server Agent Jobs Practical SQL Server Wed, 01 Jul 2015 17:26:00 +0000 25191 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 26: Using Master Servers for Job Administration http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-26-using-master-servers-job-administratio <div class="node-body blog-body"><p>When I initially decided to write about AlwaysOn Availability Groups and SQL Server Jobs, I knew I&rsquo;d have a bunch of different posts on a variety of different topics. To that end, I initially planned on this series of posts being comprised of 3 main parts:</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-26-using-master-servers-job-administratio" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-26-using-master-servers-job-administratio#comments SQL Server AlwaysOn AlwaysOn Master Servers Master Servers MSX MSX sql server agent sql server agent TSX TSX Practical SQL Server Wed, 10 Jun 2015 16:36:00 +0000 24781 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 25: Final Remarks on Backups http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-25-final-remarks-backups <div class="node-body blog-body"><p>In the last few posts (posts 19 &ndash; 24) I&rsquo;ve covered some high-level concerns and reviewed some details about how to implement and manage database backups against AlwaysOn Availability Group databases. Most of the information I&rsquo;ve provided was pretty basic or elementary &ndash; along with some additional guidelines for things to watch out for when managing backups. Which is to say that backups are never something you can simply take for granted and they&rsquo;re never something you just take lightly.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-25-final-remarks-backups" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-25-final-remarks-backups#comments SQL Server AlwaysOn Availability Groups AlwaysOn Availability Groups best practices best practices SQL Server Backups SQL Server Backups Practical SQL Server Thu, 28 May 2015 19:47:00 +0000 24641 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 24: Synchronizing SSIS Packages http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-24-synchronizing-ssis-packages <div class="node-body blog-body"><p>In my <a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-23-maintenance-plan-backups-and-ssis-pack">previous post</a> I covered options for adding &ldquo;If-checks&rdquo; into SSIS Packages &ndash; or SQL Server Maintenance Plans (which are, effectively, specialized SSIS packages). Once you&rsquo;ve tackled that process, you&rsquo;ll need to tackle something else when it comes to managing SSIS packages in conjunction with AlwaysOn Availability Groups. Or, more specifically, you&rsquo;ll actually need to tackle two tasks.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-24-synchronizing-ssis-packages" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-24-synchronizing-ssis-packages#comments SQL Server AlwaysOn AlwaysOn Maintenance Plans Maintenance Plans SSIS packages SSIS packages synchronization synchronization Practical SQL Server Mon, 18 May 2015 12:00:00 +0000 24361 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 23: Maintenance Plan Backups and SSIS Packages http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-23-maintenance-plan-backups-and-ssis-pack <div class="node-body blog-body"><p>In my last post, we took a look at some of the details involved in actually <a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-22-executing-backups">implementing backups against databases being hosted in AlwaysOn Availability Groups</a>. In addition to providing a high-level overview of how sys.fn_hadr_backup_is_preferred_replica() works, I also mentioned that integrating it into backups managed by SQL Server Maintenance Plans isn&rsquo;t as easy as what you&rsquo;ll run into with other types of backups.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-23-maintenance-plan-backups-and-ssis-pack" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-23-maintenance-plan-backups-and-ssis-pack#comments SQL Server Availability Groups Availability Groups Maintenance Plans Maintenance Plans SQL Server SQL Server SSIS SSIS Practical SQL Server Wed, 13 May 2015 15:30:00 +0000 24171 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 22: Executing Backups http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-22-executing-backups <div class="node-body blog-body"><p>Ultimately, there are a number of ways that DBAs can regularly create backups of their databases. Some of the more common options for managing backups include:</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-22-executing-backups" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-22-executing-backups#comments SQL Server AlwaysOn Availability Groups AlwaysOn Availability Groups backups backups Practical SQL Server Tue, 28 Apr 2015 19:32:00 +0000 24061 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 21: Assigning Backup Preferences http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-21-assigning-backup-preferences <div class="node-body blog-body"><p>An option when creating new AlwaysOn Availability Groups is to specify Backup Preferences.</p> <p><img alt="" src="/site-files/sqlmag.com/files/uploads/2015/03/BackupPreferences.gif" style="width: 516px; height: 438px;" /></p> <p>It&rsquo;s also something you can easily configure once the Availability Group has been set up as well &ndash; by simply right-clicking on the Availability Group and selecting Properties &ndash; then navigating into the Backup Preferences tab. &nbsp;</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-21-assigning-backup-preferences" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-21-assigning-backup-preferences#comments SQL Server AlwaysOn AlwaysOn Availability Groups Availability Groups Backup Priority Backup Priority Preferences Preferences SQL Server SQL Server Practical SQL Server Tue, 17 Mar 2015 17:11:00 +0000 23391 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 20: Avoiding Backup Fragmentation http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-20-avoiding-backup-fragmentation <div class="node-body blog-body"><p>On SQL Servers where Availability Groups (or Mirroring) isn&rsquo;t in play, I typically recommend keeping a combination of on-box backups along with copying said backups off-box as well. Obviously, keeping databases AND backups on the SAME server is the metaphorical equivalent of putting all of your eggs in one basket &ndash; and therefore something you should avoid like the plague.</p></div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-20-avoiding-backup-fragmentation" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-20-avoiding-backup-fragmentation#comments SQL Server AlwaysOn Availabiliity Groups AlwaysOn Availabiliity Groups backups backups Fragmentation fragmentation SQL Server SQL Server Practical SQL Server Thu, 12 Mar 2015 16:56:00 +0000 23071 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 19: Availability Group Database Backups http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-19-availability-group-database-backups <div class="node-body blog-body">One of the biggest strengths of AlwaysOn Availability Groups is that they allow DBAs to address both high availability and disaster recovery concerns from a single set of tooling or interfaces. But, this doesn’t mean that you won’t still need backups.</div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-19-availability-group-database-backups" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-19-availability-group-database-backups#comments SQL Server Availability Groups Availability Groups backups backups SQL Server AlwaysOn SQL Server AlwaysOn Practical SQL Server Fri, 06 Mar 2015 18:11:00 +0000 22971 at http://sqlmag.com AlwaysOn Availability Groups and SQL Server Jobs, Part 18: Health Checks for Availability Groups http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-18-health-checks-availability-groups <div class="node-body blog-body">Now that we’ve outlined the process to let servers in a SQL Server AlwaysOn Availability Group "talk to each other" by means of setting up linked servers, it’s possible to set up some additional or improved checks on Availability Group Health.</div> <div class="og_rss_groups"><ul class="links"><li class="og_links first last"><a href="/blog/practical-sql-server">Practical SQL Server</a></li> </ul></div><p><a href="http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-18-health-checks-availability-groups" target="_blank">read more</a></p> http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-18-health-checks-availability-groups#comments SQL Server Availability Groups Availability Groups cluster health cluster health cluster nodes cluster nodes SQL Server SQL Server Practical SQL Server Mon, 16 Feb 2015 22:29:00 +0000 22471 at http://sqlmag.com