Ola Hallengren’s SQL Server Maintenance Solution & CMD Syntax

I’m using the free version of SQL Server Management Studio so I have to use CMD to call the SQL scripts. The official page gives an example of the CMD syntax used to call the “DatabaseBackup” script, as follows:

Create cmd files to execute the stored procedures; for example: sqlcmd
-E -S .SQLEXPRESS -d master -Q “EXECUTE dbo.DatabaseBackup @Databases = ‘USER_DATABASES’, @Directory = N’C:Backup’, @BackupType = ‘FULL'” -b -o C:LogDatabaseBackup.txt

I got that to work, but I can’t get it to work for the “DatabaseIntegrityCheck” or the “IndexOptimize” scripts.

I guess I don’t know the syntax. I tried using the example code and just replacing the script name, but that didn’t work.

Can anyone help me?

magento2 – Custom under maintenance page when bin/magento maintenance:enable

I have a local magento 2 shop running and I would like to set up an under maintenance page when maintenance mode is enabled. Right now when enable maintenance mode it only shows:

1 exception(s):
Exception #0 (Exception): Unable to proceed: the maintenance mode is enabled. 

Exception #0 (Exception): Unable to proceed: the maintenance mode is enabled. 
<pre>#1 MagentoFrameworkAppBootstrap->run() called at (pub/index.php:40)

How can I set up a custom page? Thanks in advance!

maintenance – using git, bringing old tagged releases up to date

A tag denotes a specific point in development history. It should not change, at all. Ideally, build should be reproducible. This means checking out a tag and building it should – bit-for-bit – produce the exact same artifact, every time. Changing the versions of the build tools involved will alter that. Thats mostly not even desired.

But there is an alternative: branches.

You can have a stable branch containing the current, stable production ready release of your software, a development branch that you are working on, and several branches for major versions, e.g:

  • master
  • development
  • release-1.0.x
  • release-1.1.x
  • release-2.0.x

If you ever need to change the tooling with which version 1.0 is built, you check out the release-1.0.x branch. Lets say its HEAD is also currently tagged v1.0.3.

If you update the build tooling and make sure it works, e.g. it build on a new OS version, then you tag that version 1.0.4 and release it as such, with a changelog denoting that these are compatibility changes for that new OS version. If you just change tooling versions, you’d put “maintenance changes” or something alike in the changelog.

“Updating” a tag seems ill-advised, as tags represent specific points in the development of the software, and thus shouldn’t just change or jump around.

With the aforementioned setup it is also easy to backport changes, e.g. security fixes, to older versions of your software.

7 – Maintenance page doesn’t render on front page if page–front.tpl.php exist on Bootstrap theme

The maintenance page doesn’t render in homepage, but renders in inner pages. It’s a bug that was reported here https://www.drupal.org/project/1345390/issues/2971215 it is because page.tpl.php has custome front tpl file.

I tried all code snippets in the comments, but it doesn’t work.

E.g. put

  if (!user_has_role(3, $account = NULL) && variable_get('maintenance_mode') == 1) {
    $vars('theme_hook_suggestions')() = 'maintenance_page';
  else if (drupal_is_front_page()) {
    $vars('theme_hook_suggestions')() = 'page__front';

to my-sub-theme/templates/systems/page.vars.php inside function THEME_preprocess_page(&$vars) wrapped with the rest of functions.

What I’m doing wrong?

I tried looking for alternative with Rules something like redirect from homepage to any inner page if page is on Maintenance mode, but there is no such token.

Site stuck in maintenance mode after migration to D8

I migrated a D7 site to D8 as instructed. The content has come over but I can’t get the site out of maintenance mode because I have 2 “This block is broken or missing. You may be missing content or you might need to enable the original module.”
I have tried a couple of suggestions to fix this by adding Recreate Block Content and Fixed Block Content modules but the errors persist.

During the site migration, these modules could not be converted to D8. Is this the problem? I am fairly new to Drupal.


mobile application – How much time in advance should users be informed of an upcoming maintenance on app?

I’m desiging the UX on how to handle planned maintenance of a travel booking app. During this time frame, some services won’t able available. I’ve decided that there will be messaging in the app as well as using push notifications.

My question is, how much in advance should users be informed of upcoming maintenance on the app? what should I consider for this time window? will it be a fixed time or will it be based on the services that would be affected?

mobile application – In app – planned maintenance and unplanned downtime messaging

I particularly prefer the option that least obstructs the application, modal windows in some cases work as a barrier.

By choosing the second option, I would also use less obstructive options.

For example, the info icon has no meaning when the information is already open. In its place, I would put the app logo making implicit that it’s an institutional information. Text in red emphasizes its importance.

I would also eliminate the close icon, the X. There are two options, either keep the information open at all times, optimizing the text, or create a hiding vertical window when interacting with the application plus a scroll icon to return to view content.

enter image description here

How can I exclude certain routes from maintenance mode?

I am trying to make certain routes exempt from maintenance mode by adding the option _maintenance_access to the route and setting it to TRUE.

I think (although I’m not 100%) that this works because in DrupalCoreSiteMaintenanceMode there is the following method which checks for the _maintenance_access option and returns false if it is present –

public function applies(RouteMatchInterface $route_match) {
  if (!$this->state->get('system.maintenance_mode')) {
    return FALSE;

  if ($route = $route_match->getRouteObject()) {
    if ($route->getOption('_maintenance_access')) {
      return FALSE;

  return TRUE;

I have followed this guide on drupal.org on how to alter existing routes

Here is my mymodule.services.yml file

    class: DrupalmymoduleRoutingMaintenanceModeRouteSubscriber
      - { name: event_subscriber }

Here is my MaintenanceModeRouteSubscriber class


namespace DrupalmymoduleRouting;

use DrupalCoreRoutingRouteSubscriberBase;
use SymfonyComponentRoutingRouteCollection;

class MaintenanceModeRouteSubscriber extends RouteSubscriberBase {

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('entity.node.canonical')) {
      $route->addOptions(('_maintenance_access' => TRUE));

But this is not working as when viewing this route (any node) it is still in maintenance mode.

sql server 2012 – Index maintenance for AG DBs

I wanted to get some opinions on the index maintenance we currently do at the company where I work. One of our production SQL 2012 clusters that consists of 4 nodes, with two instances on each, has multiple AGs which service some very heavy workloads. Some of the databases in these AGs are 2TB+.

We have a standard daily index maintenance routine that does the usual rebuild vs reorg depending on the fragmentation level, but we also only do reorgs in indexes that are over a certain size because we have seen issues with SYNC latency if these larger indexes were to be rebuilt. Once index maintenance has been performed we then update statistics etc.

This job can sometimes run up to 12 hours+ so it impacts on our critical business hours where we see peak traffic, so we really need to do something to alleviate this.

I’ve seen quite a bit of commentary recently where it has been suggested that index maintenance isn’t always required at all, and I suspect that may be the case for us where we are doing a reorg on large indexes that are only 5% fragmented.

I guess I’d like some ideas on how I could identify indexes where the level of maintenance we do daily isn’t necessarily required, other than disabling it and observing the impact, if any.