Backup All SQL Server Databases

How to Backup All SQL Server Databases

  1. Specify path to store database backups
  2. Specify backup file name format
  3. Select list of databases to backup
  4. Loop through databases
  5. Programmatically create database backup command using database name, path and file name format

File Naming Format DBname_YYYYDDMM.BAK

Here is the script that will allow you to backup each database within your instance of SQL Server.  You will need to change the @path to the appropriate backup directory.

DECLARE @name VARCHAR(50) -- database name  
DECLARE @path VARCHAR(256) -- path for backup files  
DECLARE @fileName VARCHAR(256) -- filename for backup  
DECLARE @fileDate VARCHAR(20) -- used for file name
-- specify database backup directory
SET @path = 'C:\Backup\'  
-- specify filename format
SELECT name 
FROM master.dbo.sysdatabases 
WHERE name NOT IN ('master','model','msdb','tempdb')  -- exclude these databases
OPEN db_cursor   
FETCH NEXT FROM db_cursor INTO @name   
   SET @fileName = @path + @name + '_' + @fileDate + '.BAK'  
   BACKUP DATABASE @name TO DISK = @fileName  
   FETCH NEXT FROM db_cursor INTO @name   
CLOSE db_cursor   
DEALLOCATE db_cursor
Source ..

VMware KB Certificate replacement (LINKAGE)

VMware Knowledge Base

The VMware Knowledge Base provides support for VMware products.

The following VMware Knowledge Base topics provide information about how to manage certificates

NSX (6.3.4) Controller Stuck at Deploying

Strange behaviour from NSX Manager once I started deployment of contollers.

The controller deployment was getting stuck in a deploying status, from the nsx manager it’s quite visible from the installation tab, from the cli you can check it’s progress or lack of it from the cli with :

#show controller list all

To resolve this I looked at :

  • Removing via VC web client, Network and Security, Installation, Under Management, select controller to delete or forcefully delete.
  • NSX manager  -reboot
  • vCenter – restarted services, – reboot
  • NSX API was the only way to remove the contoller

    To remove via the api :

  1. connected to nsx manger and get thhe controller-id                                    #https://nsxmgr-01/api/2.0/vdn/controllerScreen Shot 2018-01-31 at 11.51.01
  2. With the controller id and using the DELETE API


If there is only 1 controller you have to forcefully remove, forceRemoval=True