Automated Restore Script Output for Ola Hallengren’s Maintenance Solution 1) Start SQL Services on Local 2) Connect to Azure AlwaysOn 3) Delete all maintenance.

Slides:



Advertisements
Similar presentations
SQL-BackTrack for Sybase
Advertisements

SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 IT390 Business Database Administration Unit 5 :
Backup, Integrity Check and Index and Statistics Maintenance
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
SharePoint and SQL Server integration Demo: SQL Server Optimizing Configurations SQL Server 2014 for SharePoint 2013 Avoiding ginormous transaction.
Backup, Integrity Check and Index and Statistics Maintenance
Module 12: Backup and Recovery. Overview Backup and recovery methods available in Oracle and SQL Server 2008 Types of failure Types of recovery Formulating.
CS27510 Commercial Database Applications. Maintenance Maintenance Disaster Recovery Disaster Recovery.
Session 7 Creating and Managing Databases. RDBMS and Data Management/ Session 7/2 of 27 Session Objectives Describe the system and user-defined databases.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
Chapter 10 : Designing a SQL Server 2005 Solution for High Availability MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design.
1 Chapter Overview Creating a User Database Setting Database Options Managing User Database Size Placing Database Files on Multiple Disks.
Chapter 2: Designing Physical Storage MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide (70-443)
It is one of the techniques to create a stand by server. Introduced in SQL 2000,enhanced in It is a High Availability as well as Disaster recovery.
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Module 16: Performing Ongoing Database Maintenance
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
Martin Cairney Hybrid data platform – making the most of Azure plus your on- prem kit DAT341 B.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
Data Disaster Recovery Planning Greg Fibiger 1/7/2016.
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Digging Out From Corruption Eddie Wuerch, MCM - Principal, Database Performance - Salesforce Marketing Cloud Data protection and loss recovery with SQL.
SQL SERVER MAINTENANCE PLANS Kat
Linkedin: dennisegraham Dennis E Graham Reporting For SQL Health.
SQL Server High Availability Introduction to SQL Server high availability solutions.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
Thank You! Local PASS Community & Sponsors!. Restoring a SQL Server database from Azure Blob Storage (200-level) Randolph
AlwaysOn In SQL Server 2012 Fadi Abdulwahab – SharePoint Administrator - 4/2013
Dealing with Database Corruption DBA 911. Who am I? 2 David M Maxwell twitter.com/dmmaxwell or twitter.com/upsearchsqltwitter.com/dmmaxwelltwitter.com/upsearchsql.
Blog.eardley.org.uk SharePoint Databases What you need to know Alan Eardley SQL Saturday Exeter 25 April 2015.
ProgressBook Suite Maintenance
Backups for Azure SQL Databases and SQL Server instances running on Azure Virtual Machines Session on backup to Azure feature (manual and managed) in SQL.
Partial Database Availability
Turgay Sahtiyan Istanbul, Turkey
Sponsors.
You Inherited a Database Now What?
Tips for SQL Server Performance and Resiliency
SQL Replication for RCSQL 4.5
A big party is being held to honor relational database systems and their impact on modern society. Outside the venue, the host awaits the guests. The.
About PASS The PASS community encompasses everyone who uses the Microsoft SQL Server or Business Intelligence Platforms. This includes database administrators,
Disaster Recovery Where to Begin
Example of a page header
Designing Database Solutions for SQL Server
Contained DB? Did it do something wrong?
Summit Nashville /14/2018 9:26 PM
Introduction to SQL Server Management for the Non-DBA
Database Administration for the Non-DBA
Performance Monitoring Using Extended Events, DMVs & Query Store
Tips for SQL Server Performance and Resiliency
The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC
Use PowerShell & dbatools to Manage your SQL Server Environment
Backup and Restore your SQL Server Database
Example of a page header
Peter Shore SQL Saturday Cleveland 2016
Backup to Basics Tom Fox
The Ultimate Maintenance Plan By Edward Roepe Perimeter DBA, LLC
Active Secondary: Enabling Backup On Secondary
AlwaysOn Availability Groups
You Inherited a Database Now What?
Top 5 TIPS TO KEEP Always on AGs humming and users happy
Sql Saturday Philadelphia
Ch 10. Maintaining and Automating SQL Server
Top 5 TIPS TO KEEP Always on AGs humming and users happy
The DBA Quit and now you’re it:
Presentation transcript:

Automated Restore Script Output for Ola Hallengren’s Maintenance Solution 1) Start SQL Services on Local 2) Connect to Azure AlwaysOn 3) Delete all maintenance solution jobs

Jared Zagelbaum MCSE Data Management & Analytics Featured blogger at SQLServerCentral.com Technical Editor for SQL Server Publications Consultant and Solutions Architect https://jaredzagelbaum.wordpress.com/ Twitter: @JaredZagelbaum 2 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Ola Hallengren https://ola.hallengren.com E-mail: ola@hallengren.com DBA with Saxo Bank, a Danish investment bank Microsoft MVP – SQL Server 3 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Solution Overview SQL Server 2005* - 2016 Based on stored procedures SQL Server 2005 end of support was April 12, 2016 Based on stored procedures DatabaseBackup DatabaseIntegrityCheck IndexOptimize CommandExecute It’s free! Download and install maintenance solution at end of slide using all defaults 4 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Common Parameter Declarations @Databases Common Parameter across DatabaseBackup, IndexOptimize, and DatabaseIntegrityCheck Value Description SYSTEM_DATABASES All system databases (master, msdb, and model) USER_DATABASES All user databases ALL_DATABASES All databases Db1 Database Db1 Db1, Db2 Databases Db1 and Db2 USER_DATABASES, -Db1 All user databases except Db1 %Db% All databases that have “Db” in the name %Db%, -Db1 All databases that have “Db” in the name except Db1 ALL_DATABASES, -%Db% All databases that do not have “Db” in the name 5 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

DatabaseBackup Full, differential, and transaction log backup Backup to local drives, network shares, or Azure Blob Storage Mirroring and / or striping of backups to multiple files Supports AlwaysOn Availability Groups Checksum, Compression, and Encryption Supports Red Gate SQL Backup, LiteSpeed, and Idera SQL Safe Automatic handling of new databases @ChangeBackupType 6 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Backup of AlwaysOn Availability Groups Define a backup preference for the Availability Group Prefer Secondary (Default) Secondary only Primary Any Replica Backup types supported on secondary replicas Copy-only full backups Regular transaction log backups Function to check preferred backup replica Sys.fn_hadr_backup_is_preferred_replica 7 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

DatabaseBackup Availability Group Logic Backup type Backup performed on Full backup Primary replica Full backup copy_only Preferred replica Differential backup Transaction log backup 8 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

DatabaseIntegrityCheck DBCC CHECKDB DBCC CHECKFILEGROUP DBCC CHECKTABLE DBCC CHECKALLOC DBCC CHECKCATALOG Options for PHYSICAL_ONLY and NOINDEX 9 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

IndexOptimize Checks fragmentation Defines three different fragmentation groups: low, medium, and high Fully configurable thresholds and maintenance actions Defaults to Microsoft recommended thresholds and actions Low fragmentation <5% (Index < 1000 pages) No Action Medium fragmentation between 5 and 30% Reorganize Index High fragmentation >= 30% Rebuild Index (Online if possible) Supports AlwaysOn Availability Groups Index maintenance performed on primary replica Updates statistics (skips rebuilt indexes) 10 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Index Maintenance – Rebuild and Reorganize Limitations Online rebuild only available in Enterprise Edition Xml indexes and spatial indexes cannot be rebuilt online Indexes with image or text cannot be rebuilt online Indexes with varchar(max), nvarchar(max), or varbinary(max) can be rebuilt online in SQL Server 2012 or later Index partitions can be rebuilt online only in SQL Server 2014 or later An index with page locking disabled cannot be reorganized 11 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Solution Implementation CommandExecute Wrapper procedure that implements standardized logging throughout the components of the maintenance solution CommandLog CommandExecute writes maintenance solution procedures execution results to this table when @LogToTable = ‘Y’ Default @LogToTable = ‘N’ for maintenance procedures Default @LogToTable = ‘Y’ for SQLCMD job steps when created using maintenance solution script 12 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

Solution Implementation (continued) SQL Server Agent CmdExec Job Step Sqlcmd and the –b option Execution continues on after error SQL Agent job reports failure in the end SQL Server Agent Tokens Uses SRVR for the local SQL Server instance Uses SQLLOGDIR (new in 2014) for the output file directory Uses JOBID, STEPID, STRTDT, and STRTTM to create unique output file names Error log: C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log Can be found in config manager startup settings 13 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

DR and Availibility Planning Maintenance Solution DB health Automated backups Availability requirements RPO RTO Schedule, Drill, Repeat!!!!! 14 | 10/10/2015 Automated Restore Script Output for Ola Hallengren’s Maintenance Solution

…not just me “The real problem isn’t backups – it’s communication. Being a truly exceptional DBA means that your manager, plus every level all the way up the chain, is comfortable with your (in)ability to restore every system in the shop. Your managers have a list in writing of all the company’s systems, a high-level overview of how frequently they’re backed up, how frequently the restores are tested, and how long a restore will take.” -Brent Ozar 10/10/2015 Session Title Here

DR Scenarios Houston…we have a problem Instance / database responsive If possible, always take tail log backup before restore (Full recovery model) Use Recovery Advisor Backup files What to restore RTO include time to hunt and identify correct .bak(s) and .trn(s)!? 10/10/2015 Session Title Here

Automated Stand by Restore Script Extends Maintenance Solution RestoreCommand Adds additional job step to DatabaseBackup jobs Requirements @LogToTable = ‘Y’ At least one full backup logged to CommandLog Job to manage script file cleanup (template provided) 10/10/2015 Session Title Here

Restore Script solution limitations Mirroring / Striping unsupported Some complexities around Availability Group implementation ***User base + feedback = more features!*** https://jaredzagelbaum.wordpress.com/ 10/10/2015 Session Title Here