Click here to Skip to main content
15,885,782 members
Articles / Database Development / SQL Server

One Click - DB Script Deployment

Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
26 Mar 2016CPOL6 min read 15.5K   411   4   1
This project is designed for addressing SQL Server Script deployment on multiple servers and databases.

Introduction

This project is designed for addressing SQL Server Script deployment on multiple servers and databases. In large enterprises, scripts would need to deploy on 1000+ servers in one release. It is very much possible to have a single jump box to push scripts on a large number of servers. This application would help development and Database Administrators in creating a deployment batch file. Once you get the batch file from this application, you could deploy scripts from central jump box or if you've direct connectivity from your laptop to databases, then you can deploy scripts using batch from your laptop directly.

Background

This is an efficient way of deploying scripts on SQL Server.

This project is also uploaded to https://oneclickdbscriptdeployment.codeplex.com/. I'm the owner of this project on codeplex and code project website. I've not put about a flash page to this application.

Using the Tool

Brief Description About Application

This is a wizard-like application. It is very easy to use. It is simple to generate the batch file for SQL Script deployment.

The application has 3 screens:

  1. Welcome screen
  2. DB Scripts, servers and database mapping screen
  3. Batch file script screen

Welcome Screen

There are two options on the Welcome Screen:

  1. Multiple Scripts Option: This option is for deploying multiple scripts from a folder.
  2. Single Script Option: This option is for deploying single script from a folder.

Based on your requirement, you would need to select the option and click Next button at the bottom.

WelcomeScreen.gif

Multiple Scripts

When you want to deploy multiple scripts into a number of servers or single server, you can select this option. The following series of operations would explain to you how this option needs to utilize.

DB Scripts, Servers and Database Mapping Screen

When you select Multiple Scripts Option on the welcome screen and come to this screen, it would look like follows. This screen has the following fields:

Deployment-Rollback-ScriptsScreen.png

Change Number: This field is for script deployment change number as per change management system within your organization.

Action: Type change number in the textbox.

Scripts Folder: This field is for selecting folder containing .sql DB scripts. If you’ve multiple folders containing .sql scripts, then select root folder. The application would include the .sql files from subfolder as well.

Action: Click on the button next to textbox for selecting script folder.

Servers List: This is a table like control. You can input the server list into this table by right clicking on a table. When you right click on the table, you would get a context menu with pastelist and delete row options. You can copy the server list into clipboard from Notepad. It is advisable to keep server list and database list typed into Notepad prior to starting this application.

Action: In order to input server list into Servers List table, you would need to type the server list into empty Notepad. Keep this list ready prior to starting an application. The example is given below. Once you typed the list, then select that list by Ctrl A for select all option, then Ctrl C to copy the list to the clipboard. Right click on Server list table, click on paste list menu option. It would paste the server list into server list table. This action is recorded as explained below.

Type server list into Notepad and select all and copy action.

Image 3

Paste the server list into server list table.

Image 4

The server Authentication column has a button to select the authentication option. The below animation would explain how to set server authentication. When you click apply to all option, then the same authentication method applies to all the servers into the list.

Image 5

In order to delete the server from the list, select the server, you want to delete, then right click on Server List table, click delete row. This action is explained as follows:

Image 6

Databases List: Follow the same method to copy paste databases list from note to Databases List table. There is context menu attached to this list box same as Servers List. You can paste the DB list and delete the databases in the same fashion as that of servers list.

Batch File Folder: You would need to select the final batch file folder where you want to save the deployment batch file on your local drive.

Action: Click on the button with ... and select the folder from a local disk drive.

Select All: Once you've updated all required fields, then you can click Select All button to select all the servers from server list and all the databases from databases list.

Clear All: This button is for clearing the selected server and databases lists.

Green Color Plus Button

Once you've updated all these required fields, then you can click on Green Color Plus Button. This action would load all the details into Batch File Scripts table. There are up and down arrow buttons attached to this Batch File Scripts table for rearranging the deployment script order. As per your requirement, you can order the scripts in the table. Also, if you want to delete any script from the table then you can use Red Crossed delete button.

Each script with the table has one drop down box to select your option if a script fails what action you would expect batch file should take. There are two options given as follows:

  1. Exit scripts execution upon failure
  2. Ignore failure and move to next script

You would need to select this option and click next.

Final Batch File Script Verification Screen

This screen would look as follows. This screen has two portions:

  1. Actual batch file script code portion for your verification
  2. Change description portion for updating the change ticket description

Image 7

You can copy paste the Change description portion details in your change ticket. Also, you would need to attach scripts and batch to change ticket.

Please Note

The folders marked in the red line in the above figure are updated into application installation folder.

Usually, deployment folder location is C:\Program Files (x86)\OneClick\OneClick-DBScriptDeployment\OneClick.exe.config. You would need to update file OneClick.exe.config. This file has the following application settings by default. If you want to modify the folder structure on deployment server, then you would need to change folders in this file:

XML
<applicationSettings>
<OneClick.My.MySettings>
<setting name="ServerScriptFolderLocation" serializeAs="String">
<value>D:\Releases\Scripts</value>
</setting>
<setting name="ServerScriptLogFolderLocation" serializeAs="String">
<value>D:\Releases\Logs</value>
</setting>
<setting name="ServerBatchFileLocation" serializeAs="String">
<value>D:\Releases\</value>
</setting>
</OneClick.My.MySettings>
</applicationSettings>

FOR USE

  • Windows OS with .NET 4.5

FOR DEVELOPMENT

  • Visual Basic .NET 2013
  • Windows OS 7.0
  • .NET 4.5

Expected Users

  • Microsoft SQL Server Database Administrators
  • SQL Script Developers
  • Release Engineers

History

This project is also uploaded to https://oneclickdbscriptdeployment.codeplex.com/. I'm the owner of this project on codeplex and Code Project website. I've not put about a flash page to this application.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Thomson Reuters
India India
Mahesh Shinde is Leader in SQL Server with 14+ years of experience. I’m Microsoft Certified professional in SQL Server, ITIL 3.0 v foundation and Six Sigma Green Belt. As a lead Database Engineer I’ve proven experience in Database Technologies and able to Architect / Design / implement a DB solution which meet client requirement of High Availability, Performance and Reliability with complex SQL server/Oracle database infrastructure. Expert in managing complex production SQL servers across different data centres with wide range of MS SQL servers versions (7.0 To 2012). I’ve proven expertises in SQL server consolidation with virtualization and data cloud offerings helped clients deploy SQL servers in cost effective manner. I’m looking to take up a bigger opportunity where I would be working as solution architect for DB infrastructure as a whole.

Comments and Discussions

 
Praise:) Pin
Member 1241682525-Mar-16 10:19
Member 1241682525-Mar-16 10:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.