<?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>Backup-SqlDatabase &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/backup-sqldatabase/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Thu, 15 Sep 2016 19:11:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server 2012: All Database and Log backups using PowerShell</title>
		<link>https://www.dbrnd.com/2016/09/sql-server-2012-all-database-and-log-backups-using-powershell/</link>
					<comments>https://www.dbrnd.com/2016/09/sql-server-2012-all-database-and-log-backups-using-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 18 Sep 2016 16:16:51 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Backup-SqlDatabase]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2566</guid>

					<description><![CDATA[In this post, I am going share scripts to take all database and log backups using SQL Server PowerShell. Using T-SQL, we can also take all databases backup using one single script, but some of the Database Administrators like to perform this kind of task using PowerShell because sometimes it is much faster and it [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&amp;linkname=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fsql-server-2012-all-database-and-log-backups-using-powershell%2F&#038;title=SQL%20Server%202012%3A%20All%20Database%20and%20Log%20backups%20using%20PowerShell" data-a2a-url="https://www.dbrnd.com/2016/09/sql-server-2012-all-database-and-log-backups-using-powershell/" data-a2a-title="SQL Server 2012: All Database and Log backups using PowerShell"></a></p><p>In this post, I am going share scripts to take all database and log backups using SQL Server PowerShell.</p>
<p>Using T-SQL, we can also take all databases backup using one single script, but some of the Database Administrators like to perform this kind of task using PowerShell because sometimes it is much faster and it is executing from outside of the SQL Server.</p>
<blockquote><p>SQL Server 2012 cmdlet introduced a new command to take database backups and the command name is &#8220;Backup-SqlDatabase&#8221;.</p></blockquote>
<p><strong>Execute below command in PowerShell to get the help of &#8220;Backup-SqlDatabase&#8221;:</strong></p><pre class="crayon-plain-tag">help Backup-SqlDatabase -full</pre><p>
<strong>PowerShell script to take all database backups:</strong><br />
Generating file name with the date.</p><pre class="crayon-plain-tag">$BackupDate = Get-Date -Format MMddyy
foreach($database in (Get-ChildItem)) { 
$dbName = $database.Name
$bakFilePath = "C:\temp\" + $dbName + "_" + $BackupDate + ".bak"
Backup-SqlDatabase -Database $dbName -BackupFile $bakFilePath -Initialize }</pre><p>
<strong>PowerShell script to take all database log backups:</strong><br />
Generating file name with the date.</p><pre class="crayon-plain-tag">$BackupDate = Get-Date -Format MMddyy_hhmm
foreach($database in (Get-ChildItem)) {
$dbName = $database.Name
$trnFilePath = "C:\temp\" + $dbName + "_" + $BackupDate + ".trn"
Backup-SqlDatabase -Database $dbName -BackupAction Log -BackupFile $trnFilePath -Initialize}</pre><p>
<a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerPowerShellDatabaseBackup.png" rel="attachment wp-att-2573"><img fetchpriority="high" decoding="async" class="alignnone wp-image-2573 size-full" title="SQL Server PowerShell Database Backup" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerPowerShellDatabaseBackup.png" alt="SQL Server PowerShell Database Backup" width="667" height="205" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerPowerShellDatabaseBackup.png 667w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerPowerShellDatabaseBackup-300x92.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerPowerShellDatabaseBackup-150x46.png 150w" sizes="(max-width: 667px) 100vw, 667px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/09/sql-server-2012-all-database-and-log-backups-using-powershell/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
