This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
break # Prevent everything from running at once. | |
$SqlServer = "SQL2016" | |
Import-Module dbatools | |
# Stop the current command if it throws an error or exception. | |
$ErrorActionPreference = "Stop" | |
# Multiple assignment, woo! | |
# Give us more information about what is going on behind the scenes! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Format-TrelloUriToJson { | |
param ($url) | |
Write-Debug "Formatting $url" | |
$prefix = "https://trello.com/b/" | |
$url = $url -replace $prefix,"" | |
$identifier = "$($url.Split("/")[0])" | |
$name = "$($url.Split("/")[1])" | |
$url = $prefix + $identifier + ".json" | |
Write-Debug "Returning $url" | |
return $url, $name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select n [id], SUSER_NAME(n) [user_name] | |
from ( | |
select top 10000 row_number() over(order by t1.number) as N | |
from master..spt_values t1 | |
cross join master..spt_values t2 | |
) a | |
where SUSER_NAME(n) is not null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Set-SqlTempDbConfiguration | |
{ | |
<# | |
.SYNOPSIS | |
Sets tempdb data and log files according to best practices. | |
.DESCRIPTION | |
Function to calculate tempdb size and file configurations based on passed parameters, calculated values, and Microsoft | |
best practices. User must declare SQL Server to be configured and total data file size as mandatory values. Function will | |
then calculate number of data files based on logical cores on the target host and create evenly sized data files based |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query 1 | |
Table 'Table1'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
Table 'Table2'. Scan count 0, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
Table 'Table2'. Scan count 0, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
Table 'Table1'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
Table 'Table2'. Scan count 0, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
Table 'Table2'. Scan count 0, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. | |
query 2 | |
Table 'Table1'. Scan count 0, logical reads 3, physical reads 0, read-ahead reads 0, lob logical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @databaseName sysname | |
DECLARE @backupStartDate datetime | |
DECLARE @backup_set_id_start INT | |
DECLARE @backup_set_id_end INT | |
, @backup_set_id_diff INT | |
, @filenamereplace nvarchar(max) = '' -- Replace the unc filename with whatever file path you have copied things to | |
-- set database to be used | |
SET @databaseName = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- THIS SCRIPT IS FOR NON-PRODUCTIONR RESTORES ONLY, RUN THIS IN PRODUCTION MAY BE A BAD IDEA, RUN AT YOUR OWN RISK | |
-- ERRORS MAY OCCUR WHEN RUNNING THIS SCRIPT, CONSIDER RUNNING THE RESTORE ON A NEW VERSION OF SQL SERVER OR VERIFYING YOUR BACKUP MEDIA | |
SET NOCOUNT ON; | |
DECLARE | |
@backup_filepath NVARCHAR(MAX) | |
, @new_db_name NVARCHAR(MAX) | |
, @restore_location NVARCHAR(MAX) | |
, @restore_with_recovery BIT= 1; |
NewerOlder