<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DBAduck</title>
	<atom:link href="https://www.dbaduck.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbaduck.com/</link>
	<description>DBA</description>
	<lastBuildDate>Tue, 10 Mar 2026 18:29:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.dbaduck.com/wp-content/uploads/2013/12/cropped-dbaducklogo-2-32x32.png</url>
	<title>DBAduck</title>
	<link>https://www.dbaduck.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PowerShell for SQL Server DBAs Course is Finally Here!</title>
		<link>https://www.dbaduck.com/powershell-for-sql-server-dbas-course-is-finally-here/</link>
					<comments>https://www.dbaduck.com/powershell-for-sql-server-dbas-course-is-finally-here/#respond</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Fri, 29 Nov 2024 06:02:24 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4769</guid>

					<description><![CDATA[<p>I have finally finished preparing my Fundamentals of PowerShell for SQL Server DBAs Course. You can see the curriculum at this link PowerShell for DBAs Fundamentals &#124; DBADuck Training School. The class is scheduled to be delivered live and the recordings will be available to you for a year as part of the class. The [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/powershell-for-sql-server-dbas-course-is-finally-here/">PowerShell for SQL Server DBAs Course is Finally Here!</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I have finally finished preparing my Fundamentals of PowerShell for SQL Server DBAs Course.</p>



<p>You can see the curriculum at this link <a href="https://training.dbaduck.com/p/powershell-for-dbas-fundamentals">PowerShell for DBAs Fundamentals | DBADuck Training School</a>. The class is scheduled to be delivered live and the recordings will be available to you for a year as part of the class.  The enrollment link is live and will allow you to enroll, but make sure you use the discount link below.</p>



<p>BLACK FRIDAY special. For 2 weeks there is a coupon <strong><em>BLACKFRIDAY</em></strong> that will get you $2000.00 off the regular price of $2,995.00. Don&#8217;t miss out on this deal before the end of this year.  If you have any questions you can feel free to use the Contact link.</p>
<p>The post <a href="https://www.dbaduck.com/powershell-for-sql-server-dbas-course-is-finally-here/">PowerShell for SQL Server DBAs Course is Finally Here!</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/powershell-for-sql-server-dbas-course-is-finally-here/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Contained Availability Groups using DbMail Query</title>
		<link>https://www.dbaduck.com/contained-availability-groups-using-dbmail-query/</link>
					<comments>https://www.dbaduck.com/contained-availability-groups-using-dbmail-query/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Sun, 13 Oct 2024 18:03:44 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Availability Groups]]></category>
		<category><![CDATA[Fixes]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4767</guid>

					<description><![CDATA[<p>Call to action for Microsoft. Contained Availability Groups came out in SQL 2022 and they definitely have their use. But there were some artifacts left behind that need some fixing. Namely when you use DBMail while in the Availability Group jobs or operations. Let&#8217;s see what there is left. First, here is the link to [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/contained-availability-groups-using-dbmail-query/">Contained Availability Groups using DbMail Query</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Call to action for Microsoft. Contained Availability Groups came out in SQL 2022 and they definitely have their use. But there were some artifacts left behind that need some fixing. Namely when you use DBMail while in the Availability Group jobs or operations. Let&#8217;s see what there is left.</p>



<p>First, here is the link to the <a href="https://feedback.azure.com/d365community/idea/e2454e20-3d80-ef11-a4e5-000d3a01397d">Feedback Item</a> that is out there for voting to get Microsoft to fix this issue. There has already been an issue fixed with the msdb proc to activate dbmail in a Contained AG ([dbo].[sp_sysmail_activate]). </p>



<h3 class="wp-block-heading" id="h-what-is-the-issue">What is the Issue?</h3>



<p>The issue is that within a Contained AG the master and msdb are actually named AGNAME_master and AGNAME_msdb which in the procedures mentioned use the following code which uses the original msdb database instead of the AGNAME_msdb database.</p>



<pre class="wp-block-code"><code>-- sp_RunMailQuery is used to run a query result into the mail message
SET @mailDbName = db_name() -- which will return msdb instead of AGNAME_msdb</code></pre>



<p>The fix is to have this code instead so that it uses the real database name since it is in a contained availability  group which makes the AGNAME_msdb look like msdb when connected to the AG Listener. See below.</p>



<pre class="wp-block-code"><code>-- Note: we cannot use DB_NAME() here since this SP could be running in the context
    -- of a contained AG: in that case, we really want to fetch the physical name of the DB
    SELECT @mailDbName = physical_database_name FROM sys.databases WHERE database_id = DB_ID()
    SET @mailDbId   = DB_ID()</code></pre>



<p>Notice how the database name instead of just being DB_NAME() it is using the physical_database_name that is in sys.databases for this DB_ID()?  This is the fix. You can make the fix yourself until <a href="https://www.microsoft.com">Microsoft</a> gets to it in the feedback item.</p>



<p>If you have not applied the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=105013">latest SQL 2022 CU</a> to your servers and you run a Contained Availability Group, then you should look to update your server so that you have the most up to date fixes in SQL Server. So far this fix is not in a CU, but the previous one for dbo.sp_sysmail_activate has been fixed in one of the CUs previously.</p>
<p>The post <a href="https://www.dbaduck.com/contained-availability-groups-using-dbmail-query/">Contained Availability Groups using DbMail Query</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/contained-availability-groups-using-dbmail-query/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PASS Data Community Summit Presentations part 2</title>
		<link>https://www.dbaduck.com/pass-data-community-summit-presentations-part-2/</link>
					<comments>https://www.dbaduck.com/pass-data-community-summit-presentations-part-2/#respond</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Tue, 21 Nov 2023 03:19:01 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[PASS Summit]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQLServer]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4753</guid>

					<description><![CDATA[<p>To all who came to my PASS Summit sessions and those that gave feedback about my presentations, I say Thank You! I read the feedback and understand the comments made. Based on the feedback I am adding a Part 2 for both presentations. Add PowerShell to your DBA Toolbox! and SQL Server 2022 Contained Availability [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/pass-data-community-summit-presentations-part-2/">PASS Data Community Summit Presentations part 2</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>To all who came to my PASS Summit sessions and those that gave feedback about my presentations, I say Thank You!</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" width="1024" height="758" src="https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77-1024x758.jpg" alt="" class="wp-image-4754" style="aspect-ratio:1.3509234828496042;width:273px;height:auto" srcset="https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77-1024x758.jpg 1024w, https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77-300x222.jpg 300w, https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77-768x568.jpg 768w, https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77-1536x1137.jpg 1536w, https://www.dbaduck.com/wp-content/uploads/2023/11/6d0cca0c10cb6972d8675d3f51581b77.jpg 2000w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>I read the feedback and understand the comments made. Based on the feedback I am adding a Part 2 for both presentations. <strong>Add PowerShell to your DBA Toolbox!</strong> and <strong>SQL Server 2022 Contained Availability Groups</strong>. I am going to be completing the presentations on <a href="https://twitch.tv/dbaduck">Twitch.tv/dbaduck</a> on November 27th at 3:00 PM MDT. </p>



<p>The presentations are <a href="https://www.dbaduck.com/presentations/">linked here</a>.</p>



<p>I will be covering a more deep level of PowerShell for DBAs to complete the more basic side of PowerShell that I presented. If you have any questions that are related please post them to <a href="https://pollgab.com/room/dbaduck">https://pollgab.com/room/dbaduck</a> so that I can address them as part of the broadcast. I would love it if you wanted to attend live to ask the questions in the chat window.</p>



<p>As I said before, I thank you all for your feedback and your attendance and this is why feedback is so important. None of it was brutal but sincere and to the point. I appreciate the opportunity to resolve feedback that I received. I hope to see you there.</p>
<p>The post <a href="https://www.dbaduck.com/pass-data-community-summit-presentations-part-2/">PASS Data Community Summit Presentations part 2</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/pass-data-community-summit-presentations-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>TSQL Tuesday &#8211; One of my favorite Extended Events</title>
		<link>https://www.dbaduck.com/tsql-tuesday-one-of-my-favorite-extended-events/</link>
					<comments>https://www.dbaduck.com/tsql-tuesday-one-of-my-favorite-extended-events/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Tue, 12 Sep 2023 14:41:21 +0000</pubDate>
				<category><![CDATA[Extended Events]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[ExtendedEvents]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[tsqltuesday]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4736</guid>

					<description><![CDATA[<p>In honor of TSQL Tuesday for September, the mother post is with Grant Fritchey &#8211; TSQL Tuesday 166. I wanted to share one of the Extended Events I always put on a server when I am in charge of it. It has to do with File growths and captures some important things for me. Before [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/tsql-tuesday-one-of-my-favorite-extended-events/">TSQL Tuesday &#8211; One of my favorite Extended Events</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In honor of TSQL Tuesday for September, the mother post is with <a href="https://www.scarydba.com/">Grant Fritchey</a>  &#8211; <a href="https://www.scarydba.com/2023/09/11/t-sql-tuesday-166-extended-events/">TSQL Tuesday 166.</a></p>



<p>I wanted to share one of the Extended Events I always put on a server when I am in charge of it. It has to do with File growths and captures some important things for me. Before you say that it is in the system_health extended events session, I know that it is there. I have had system_health sessions cycle pretty fast and there are a lot of other events in that trace, so I decided to make my own for just that specific thing so that I can archive the sessions and keep the disk clean as well as pull this information into a table and analyze data in a tabular way instead of mining XE files.</p>



<p>Here it is for those that would like to use it as well.</p>



<pre class="wp-block-preformatted">CREATE EVENT SESSION [FileSizeAutogrow] ON SERVER 
ADD EVENT sqlserver.database_file_size_change(SET collect_database_name=(1)
    ACTION(package0.collect_system_time,sqlos.task_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.client_pid,sqlserver.database_id,sqlserver.database_name,sqlserver.server_instance_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.username)),
ADD EVENT sqlserver.databases_log_file_size_changed(
    ACTION(package0.collect_system_time,sqlos.task_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.client_pid,sqlserver.database_id,sqlserver.database_name,sqlserver.server_instance_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.username))
ADD TARGET package0.event_file(SET filename=N'FileSizeAutogrow.xel',max_file_size=(500),max_rollover_files=(10))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)
GO

</pre>



<p>You will notice that the events that are captured are sqlserver.database_file_size_change and sqlserver.databases_log_file_size_changed (yes, it is weird to have the names be so different. The first one has no (s) on database_file_size_change  and the second there is no (d) on change. On the log file size change it is database(s) plural and change(d). Not sure what the significance of that is, but it is not intuitive to find in XE. These events are available from SQL 2012 and onwards. They do not exist in SQL 2008R2.</p>



<h2 class="wp-block-heading" id="h-what-do-i-get-out-of-this"><strong>What do I get out of this?</strong></h2>



<figure class="wp-block-image size-full"><img decoding="async" width="394" height="427" src="https://www.dbaduck.com/wp-content/uploads/2023/09/LogFileAutogrow1.png" alt="" class="wp-image-4737" srcset="https://www.dbaduck.com/wp-content/uploads/2023/09/LogFileAutogrow1.png 394w, https://www.dbaduck.com/wp-content/uploads/2023/09/LogFileAutogrow1-277x300.png 277w" sizes="(max-width: 394px) 100vw, 394px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="414" height="433" src="https://www.dbaduck.com/wp-content/uploads/2023/09/DataFileAutogrow1-1.png" alt="" class="wp-image-4739" srcset="https://www.dbaduck.com/wp-content/uploads/2023/09/DataFileAutogrow1-1.png 414w, https://www.dbaduck.com/wp-content/uploads/2023/09/DataFileAutogrow1-1-287x300.png 287w" sizes="(max-width: 414px) 100vw, 414px" /></figure>



<p>Notice that in the first graphic I have marked it up. You get a lot of things out of this data.<br>* Database Name / Filename<br>* File Type<br>* Duration of the growth<br>* Size change in KB</p>



<p>I carry a mantra that if you keep all files from growing (proactive maintenance of files) then you can grow them automatedly but at a time when it is more conducive to grow it and not in the middle of a great big transaction. Automation is how you get the most out of your day without the heavy lifting that many DBAs still have as part of their DBA careers.</p>



<p>Happy TSQL Tuesday from the Ducks on my side of the pond.</p>
<p>The post <a href="https://www.dbaduck.com/tsql-tuesday-one-of-my-favorite-extended-events/">TSQL Tuesday &#8211; One of my favorite Extended Events</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/tsql-tuesday-one-of-my-favorite-extended-events/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PowerShell for DBAs Office Hours</title>
		<link>https://www.dbaduck.com/powershell-for-dbas-office-hours/</link>
					<comments>https://www.dbaduck.com/powershell-for-dbas-office-hours/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Wed, 01 Mar 2023 22:55:56 +0000</pubDate>
				<category><![CDATA[Office Hours]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4713</guid>

					<description><![CDATA[<p>To celebrate PowerShell month with Brent Ozar (b &#124; i ) and his free PowerShell class, I am hosting Office Hours on Twitch.tv and the questions that I will be answering are those posted by you on the Pollgab/dbaduck site. This is my pollgab room that you can add questions to and upvote them for [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/powershell-for-dbas-office-hours/">PowerShell for DBAs Office Hours</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>To celebrate PowerShell month with Brent Ozar (<a href="https://www.brentozar.com/blog/">b</a> |<a href="https://www.instagram.com/brento"> i </a>) and his <a href="https://www.brentozar.com/archive/2023/03/learn-powershell-in-30-minutes-a-day-free-starting-now/">free PowerShell class</a>, I am hosting Office Hours on <a href="https://twitch.tv/dbaduck">Twitch.tv</a> and the questions that I will be answering are those posted by you on the <a href="https://pollgab.com/room/dbaduck">Pollgab/dbaduck</a> site. This is my pollgab room that you can add questions to and upvote them for me to answer. I may be doing more than just speaking the answers, I am going to be trying to show them in PowerShell as well if they are able to be shown.</p>



<p class="has-medium-font-size"><strong>Event Information</strong></p>



<p>Monday, <a href="https://www.timeanddate.com/worldclock/converter.html?iso=20230306T150000&amp;p1=tz_mt">March 6th at 8:00 AM</a> Mountain Time (click the link for your time)</p>



<p>I am excited to get this started, so I hope you will join me for the first of my Office Hours.</p>



<p></p>
<p>The post <a href="https://www.dbaduck.com/powershell-for-dbas-office-hours/">PowerShell for DBAs Office Hours</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/powershell-for-dbas-office-hours/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Ola Hallengren Maintenance part 1</title>
		<link>https://www.dbaduck.com/ola-hallengren-maintenance-part-1/</link>
					<comments>https://www.dbaduck.com/ola-hallengren-maintenance-part-1/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Tue, 31 Jan 2023 20:40:35 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4708</guid>

					<description><![CDATA[<p>Many of us are using Ola Hallengren&#8217;s maintenance solution. This post will assist you in configuring this solution when you add it to your SQL Servers. Jobs are created with this solution. You download it at the link above. I recommended creating a database to use for this solution or even installing it into an [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/ola-hallengren-maintenance-part-1/">Ola Hallengren Maintenance part 1</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Many of us are using <a href="https://ola.hallengren.com">Ola Hallengren&#8217;s maintenance solution</a>.</p>



<p>This post will assist you in configuring this solution when you add it to your SQL Servers. Jobs are created with this solution. You download it at the link above.</p>



<ul class="wp-block-list">
<li>Backup Jobs for System and User databases</li>



<li>Database Integrity jobs for System and User Databases</li>



<li>Cleanup jobs for Command Log and Output Files</li>
</ul>



<p>I recommended creating a database to use for this solution or even installing it into an existing DBA function database. I usually create a DBA database and use it for this purpose and others as well. With this new database, you configure the Database in the header of the maintenance solution SQL file, whether to create jobs, retention time and backup directory for the jobs.</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">USE [master] -- Specify the database in which the objects will be created.

SET NOCOUNT ON

DECLARE @CreateJobs nvarchar(max)          = 'Y'         -- Specify whether jobs should be created.
DECLARE @BackupDirectory nvarchar(max)     = NULL        -- Specify the backup root directory. If no directory is specified, the default backup directory is used.
DECLARE @CleanupTime int                   = NULL        -- Time in hours, after which backup files are deleted. If no time is specified, then no backup files are deleted.
DECLARE @OutputFileDirectory nvarchar(max) = NULL        -- Specify the output file directory. If no directory is specified, then the SQL Server error log directory is used.
DECLARE @LogToTable nvarchar(max)          = 'Y'         -- Log commands to a table.</pre></div>



<h3 class="wp-block-heading" id="h-parameters-to-fill-out">Parameters to Fill Out</h3>



<p>Pay close attention to the highlighted lines:<br>The database name you created is put in the USE statement and the following items are created in that database:</p>



<ul class="wp-block-list">
<li>CommandLog table</li>



<li>Stored Procedures that are in the solution</li>
</ul>



<p>I use the DBA database here, which keeps it out of System databases and in an isolated place.</p>



<p>The @CreateJobs variable specifies whether or not the create the jobs. If you already have it installed, turning that off is easy, you just change it to an &#8216;N&#8217; and it will merely update the code so that you have the latest version.</p>



<p>Next is @BackupDirectory which is where you specify the database backup location you want to use for the backups. If you do not specify this one, then the default is used. The default location is in the Database Settings tab of the Server Properties in SSMS.</p>



<p>Next is @CleanupTime and it is specified in hours. If you want to clean up the backup files after 1 week, you specify 168 as the hours for cleanup time. This number is put in all the Backup jobs that are created.</p>



<p>Last but not least, is the @OutputFileDirectory which specifies the folder for the output files that are on each step in the Ola jobs. If not specified, it will default to the LOG directory specified in the startup of SQL Server. The SQL Server Errorlogs are kept in that folder. I usually leave the parameter to be NULL to leave the output files there.</p>



<p>The @LogToTable parameter is configured as &#8216;Y&#8217; because this is going to be put in the jobs as well to ensure that the work that is done in this solution is logged in the dbo.CommandLog table in the specified database.</p>



<p>In the code block below, the data is filled out so you can see what it looks like and the jobs get created with these settings as their defaults. The stored procedures are created in the specified database as well.</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">USE [DBA] -- Specify the database in which the objects will be created.

SET NOCOUNT ON

DECLARE @CreateJobs nvarchar(max)          = 'Y'         -- Specify whether jobs should be created.
DECLARE @BackupDirectory nvarchar(max)     = '\\server\share'    -- Specify the backup root directory. If no directory is specified, the default backup directory is used.
DECLARE @CleanupTime int                   = 168        -- Time in hours, after which backup files are deleted. If no time is specified, then no backup files are deleted.
DECLARE @OutputFileDirectory nvarchar(max) = NULL        -- Specify the output file directory. If no directory is specified, then the SQL Server error log directory is used.
DECLARE @LogToTable nvarchar(max)          = 'Y'         -- Log commands to a table.</pre></div>



<h3 class="wp-block-heading" id="h-conclusion">Conclusion</h3>



<p>It is important to remember that this solution creates jobs that have a structure and at <a href="https:.//ola.hallengren.com">https:.//ola.hallengren.com</a> the documentation has a full complement of examples of how to configure these jobs with parameters. The items that you need to ensure are configured include @LogToTable = &#8216;Y&#8217; and @Compress = &#8216;Y&#8217; so that you get it logged to the table and the database backups are compressed. If you omit the @Compress parameter then it will rely on the server setting to compress backups by default. Never rely on a setting that can be changed with or without your knowledge.</p>



<p>This part was not meant to be 100% comprehensive, but to ensure that you have information of how to install the jobs and solution, other parts are going to go into more depth so that you can see how to use it in the real world.</p>
<p>The post <a href="https://www.dbaduck.com/ola-hallengren-maintenance-part-1/">Ola Hallengren Maintenance part 1</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/ola-hallengren-maintenance-part-1/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server Agent PowerShell Job Step with #NOSQLPS</title>
		<link>https://www.dbaduck.com/sql-server-agent-powershell-job-step-with-nosqlps/</link>
					<comments>https://www.dbaduck.com/sql-server-agent-powershell-job-step-with-nosqlps/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Wed, 06 Apr 2022 04:36:20 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://www.dbaduck.com/?p=4625</guid>

					<description><![CDATA[<p>In researching some things for a presentation, I was to give at Intersections, Spring 2022, I came across this documentation page for SQL Server PowerShell that in the SQL Server Agent section it indicates that there is a way to get the Agent Job Step to skip loading the SQLPS module and you get to [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/sql-server-agent-powershell-job-step-with-nosqlps/">SQL Server Agent PowerShell Job Step with #NOSQLPS</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In researching some things for a presentation, I was to give at Intersections, Spring 2022, I came across this documentation page for <a href="https://docs.microsoft.com/en-us/sql/powershell/sql-server-powershell?msclkid=8f06e1c7b56011ecb42db58762054e7f&amp;view=sql-server-ver15" target="_blank" rel="noreferrer noopener">SQL Server PowerShell</a> that in the SQL Server Agent section it indicates that there is a way to get the Agent Job Step to skip loading the SQLPS module and you get to use PowerShell natively and can load whichever modules you would like.</p>



<p>What?  Huge News!</p>



<h2 class="wp-block-heading" id="h-how-is-this-done">How is this done?</h2>



<p>According to the documentation page, you simply would put #NOSQLPS in the first line of the SQL Agent PowerShell Job Step as in the image below, and when the job runs, it will NOT load the SQLPS module. <strong><em>This starts in SQL Server 2019</em></strong>, so it has not been back ported to previous versions of SQL Server.</p>



<p>If you want to test this, you can put the #NOSQLPS in the top of the step and then on the second line put &#8216;Get-Module&#8217; without the quotes and then run the job.  When you look at the job output, you will see nothing. If you remove the #NOSQLPS from the job step and put Get-Module in the line, run the job and then look at the output, you will see the SQLPS module be returned.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="696" height="663" src="https://www.dbaduck.com/wp-content/uploads/2022/04/NOSQLPS_PowerShell_JobStep.png" alt="" class="wp-image-4627" srcset="https://www.dbaduck.com/wp-content/uploads/2022/04/NOSQLPS_PowerShell_JobStep.png 696w, https://www.dbaduck.com/wp-content/uploads/2022/04/NOSQLPS_PowerShell_JobStep-300x286.png 300w" sizes="auto, (max-width: 696px) 100vw, 696px" /><figcaption>SQL Server Agent PowerShell Job Step</figcaption></figure>



<p>Hopefully you found this useful.</p>
<p>The post <a href="https://www.dbaduck.com/sql-server-agent-powershell-job-step-with-nosqlps/">SQL Server Agent PowerShell Job Step with #NOSQLPS</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/sql-server-agent-powershell-job-step-with-nosqlps/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>How is the pandemic going for you? (T-SQL Tuesday #132)</title>
		<link>https://www.dbaduck.com/how-is-the-pandemic-going-for-you-t-sql-tuesday-132/</link>
					<comments>https://www.dbaduck.com/how-is-the-pandemic-going-for-you-t-sql-tuesday-132/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Tue, 10 Nov 2020 18:26:26 +0000</pubDate>
				<category><![CDATA[TSQL]]></category>
		<category><![CDATA[TSQLTuesday]]></category>
		<category><![CDATA[sqlfamily tsqltuesday]]></category>
		<guid isPermaLink="false">https://dbaduck.com/?p=4614</guid>

					<description><![CDATA[<p>At the first of this year, things were going well. Just before the pandemic was in full swing, the company I worked for merged with another company. This added a lot of extra things and stress to the current situation and I found that it was a welcome blessing to work from home all the [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/how-is-the-pandemic-going-for-you-t-sql-tuesday-132/">How is the pandemic going for you? (T-SQL Tuesday #132)</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>At the first of this year, things were going well. Just before the pandemic was in full swing, the company I worked for merged with another company. This added a lot of extra things and stress to the current situation and I found that it was a welcome blessing to work from home all the time. This post is about what I learned and one of the things that I will be working on during this time to keep myself in a better place.</p>



<figure class="wp-block-image size-large"><a href="https://sqlworldwide.com/t-sql-tuesday-132-how-are-you-coping-with-pandemic/"><img loading="lazy" decoding="async" width="250" height="250" src="https://dbaduck.com/wp-content/uploads/2020/06/t-sql-tuesday-250x250-1.png" alt="" class="wp-image-4154" srcset="https://www.dbaduck.com/wp-content/uploads/2020/06/t-sql-tuesday-250x250-1.png 250w, https://www.dbaduck.com/wp-content/uploads/2020/06/t-sql-tuesday-250x250-1-150x150.png 150w" sizes="auto, (max-width: 250px) 100vw, 250px" /></a></figure>



<p class="has-medium-font-size"><strong>What I realized at the onset of the pandemic</strong></p>



<p>I thought that it would be the best thing ever to be able to work from home and never go into the office. In the beginning it was great as I loved to work from home anyway because I got more done and drivebys were not prevalent. What I realized is that the interaction with the team was really nice. To keep up with things and talk with people physically was more important than I thought.  I also found out that I was perfectly OK without interaction while working and that I was more of an introvert than I thought.  But now I did not get to travel to SQL Saturday&#8217;s and speak, I did not go to the User Group physically and catch up with the members.  So while I loved being in my home-office and was perfectly content, I was not perfectly content. I had a side of me that wanted to interact and see the whites of peoples eyes and present in front of. In the end I wanted to be with the #SQLFamily more than I thought I would.</p>



<p class="has-medium-font-size"><strong>Health Ramifications</strong></p>



<p>I don&#8217;t think I take care of myself as much as when I was in the office. I eat worse and I sit all day and find myself having sat for hours on end without drinking water or eating anything. I don&#8217;t think that I am in better health than before the pandemic. I weigh more and I have not developed good habits as I should. So I have to start thinking about long term and not short term in my health. I am grateful to have been shown this by the pandemic, I know I cannot keep doing what I have been doing and be OK. I am beginning to put together a plan to get more healthy and develop good habits around exercise, good office practices (taking breaks, getting up from the chair, standing for a bit) so that I can be more healthy and happy, less stress and a good outlet to the daily grind.</p>



<p class="has-medium-font-size"><strong>My Advice to others</strong></p>



<p>Really it is about finding out who you are and what you want to be. To be of help to your colleagues you need to keep up with yourself and have something to offer. I have given all my time, effort and really everything to everyone else, and I love to do it because growing is very important in keeping your mental health.  If you do not learn and grow, you stagnate which means that you start to feel like you don&#8217;t have anything to offer and if that is a pattern every day, then it will be really detrimental a month from now, because the frog doesn&#8217;t get boiled overnight, it takes a slow rise of temperature and the frog stays in the water until the heat is so much that he cannot get out of the water because of no strength and then he boils.  Don&#8217;t let the temperature of your water slowly cook you to death, recognize right now that you are in that pot of water and you want to ensure that you get out on dry land to make a difference.  Give a little and then give a little more, but remember to give to yourself at the same time. Mostly so that you can thrive, grow and learn the things that make you, you. Take care of yourself through this pandemic and remember that you are a great part of our #SQLFamily and we need you to be complete. Stay safe and see you out there.</p>
<p>The post <a href="https://www.dbaduck.com/how-is-the-pandemic-going-for-you-t-sql-tuesday-132/">How is the pandemic going for you? (T-SQL Tuesday #132)</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/how-is-the-pandemic-going-for-you-t-sql-tuesday-132/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>UpdateHadronTruncationLsn messages in SQL 2019 Errorlog</title>
		<link>https://www.dbaduck.com/updatehadrontruncationlsn-messages-in-sql-2019-errorlog/</link>
					<comments>https://www.dbaduck.com/updatehadrontruncationlsn-messages-in-sql-2019-errorlog/#comments</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Wed, 22 Jul 2020 22:16:59 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Errorlog]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://dbaduck.com/?p=4166</guid>

					<description><![CDATA[<p>If you have SQL Server 2019 installed and are using Availability Groups you may incur messages that look like the below message in your SQL Server Errorlog. UpdateHadronTruncationLsn(6) (force=0): Primary: 0:0:0 Secondary: 892:4720:2 Partial Quorum : 0:0:0 Aggregation: 892:4720:2 Persistent: 892:382:4 According to Microsoft (unofficially as I did not hear this personally), there will be [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/updatehadrontruncationlsn-messages-in-sql-2019-errorlog/">UpdateHadronTruncationLsn messages in SQL 2019 Errorlog</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If you have SQL Server 2019 installed and are using Availability Groups you may incur messages that look like the below message in your SQL Server Errorlog.</p>



<pre class="wp-block-preformatted">UpdateHadronTruncationLsn(6) (force=0): Primary: 0:0:0 Secondary: 892:4720:2 Partial Quorum : 0:0:0 Aggregation: 892:4720:2 Persistent: 892:382:4</pre>



<p>According to Microsoft (unofficially as I did not hear this personally), there will be a fix in CU6 for SQL 2019 that will remove these messages by default and if you enable Trace Flag 3605 then it will turn them on to be logged as below.</p>



<pre class="wp-block-syntaxhighlighter-code">DBCC TRACEON(3605, -1)</pre>



<p>If this changes, I will come and update this post.</p>



<p>Thanks for listening. Have a great day and stay safe and happy!</p>
<p>The post <a href="https://www.dbaduck.com/updatehadrontruncationlsn-messages-in-sql-2019-errorlog/">UpdateHadronTruncationLsn messages in SQL 2019 Errorlog</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/updatehadrontruncationlsn-messages-in-sql-2019-errorlog/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
