This file contains hidden or 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
| -- USE Chinook_PROD; | |
| USE Chinook_Dev | |
| SELECT COUNT(*) | |
| FROM dbo.customer | |
| JOIN dbo.Invoice | |
| ON Customer.CustomerId = Invoice.CustomerId; | |
| SELECT TOP 10 | |
| FirstName, |
This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| Generates a T-SQL script that recreates a database's schema (empty tables) | |
| from a TDM classification.json file, for local pipeline testing. | |
| .DESCRIPTION | |
| The classification file lists every schema, table and column, plus (for string | |
| columns) a maxLength. It does NOT contain real SQL data types, so every column | |
| is created as NVARCHAR: | |
| * maxLength 1..4000 -> NVARCHAR(maxLength) |
This file contains hidden or 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
| # UPDATE ME!!!! | |
| $rgCloneEndpoint = "https://update-me:8132/" | |
| # DON'T CHANGE ANYTHING ELSE | |
| ############################################################### | |
| <# | |
| For more information, see: | |
| https://documentation.red-gate.com/redgate-clone/using-the-cli/cli-installation | |
| #> |
This file contains hidden or 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
| $testMode = $true # By default, don't actually delete anything. Just print out the commands you would execute without executing them. Set this to false if you want to actually delete stuff | |
| $images = (rgclone get di --output json) | ConvertFrom-Json | |
| $failedImageIds = ($images | Where-Object {$_.status -like "Failed"}).Id | |
| $containers = (rgclone get dc --output json) | ConvertFrom-Json | |
| $failedContainerIds = ($containers | Where-Object {$_.status -like "Failed"}).Id | |
| if ($failedImageIds.length -ne 0){ | |
| $failedImageIds | ForEach-Object { |
This file contains hidden or 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
| sourceType: Backup | |
| name: pagila-pg | |
| engine: postgresql | |
| version: 14 | |
| backups: | |
| - file: pagila-pg/dump-pagila_dev.sql | |
| - file: pagila-pg/dump-pagila_shadow.sql | |
| initialDatabaseName: pagila | |
| postScript: | | |
| CREATE ROLE redgate WITH LOGIN SUPERUSER PASSWORD 'not_the_real_password'; |
This file contains hidden or 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
| :: DO NOT BLINDLY RUN THIS FILE!!!! | |
| :: It won't work. | |
| :: Also, it's important you understand what each bit does. | |
| :: Instead, step through it, one line at a time, reading the comments (::) as you go. | |
| :: | |
| :: STEP 0 - Download the rgclone command line | |
| :: It's available here. (NOTE: You need to provide your own rgclone URL and port!): | |
| :: https://rgclone-url.com:port/cloning-api/download/cli/windows-amd64 |
This file contains hidden or 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
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| -- If you want to use a different name for the table, update this variable | |
| DECLARE @TABLENAME AS NVARCHAR(100)=N'flyway_schema_history'; | |
This file contains hidden or 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-SqlDefaultPath { | |
| param ( | |
| [Parameter(Mandatory=$true)][string]$SqlInstance, | |
| $NewDefaultDataPath = "", | |
| $NewDefaultLogPath = "", | |
| $NewDefaultBackupPath = "" | |
| ) | |
| try { | |
| import-module dbatools | |
| } |
This file contains hidden or 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
| Session type: | |
| Lightning Talk | |
| Title: | |
| Dante's 9 Levels of Database Deployment Hell | |
| Abstract: | |
| Got a monolithic database with a zillion wicked dependencies? | |
| Do database deployments send fear down your spine? | |
| Have a dark sense of adventure? |
This file contains hidden or 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
| -- Attribution to Ivan Donev | |
| -- Details: | |
| -- http://www.mssqlinsider.com/2013/09/check-databases-part-replication/ | |
| -- Requires SA | |
| IF IS_SRVROLEMEMBER ('sysadmin') = 1 | |
| print 'Current user''s login is a member of the sysadmin role' | |
| ELSE IF IS_SRVROLEMEMBER ('sysadmin') = 0 | |
| THROW 50001, 'ERROR: Current user''s login is NOT a member of the sysadmin role.', 1 | |
| ELSE IF IS_SRVROLEMEMBER ('sysadmin') IS NULL |
NewerOlder