Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Learn about SQL Server DBA, SQL Server database performance,SQL Server optimisation,database tuning,t-sql,ssis
Browse by Tags · View All
DBA Scripts 51
performance 37
SQL Server 29
Object Management 24
#SQLServer 24
Backup and Restore 20
Security Management 20
Powershell 17
Indexes 14
DBA 14

Archive · View All
June 2011 38
January 2011 33
May 2011 32
August 2011 27
July 2011 26
January 2012 24
February 2011 19
April 2011 19
March 2011 17
March 2012 17

Jack Vamvas's Blog

sql server scripts and managing databases

Mar 1 2012 12:00AM by Jack Vamvas   

Managing a large SQL Server inventory requires an efficient management processes.

Following on from DBA  productivity and less is more  , this post outlines the system I use to manage the DBA scripts across the database server environment

 1)       Develop a script library covering the essentials of DBA database management . Tasks include : Reindexing , statistics, defragementation, checkdb , kill user processes, kill all db connections  and much more..

My current version of SQL_TOOLS has 345 scripts covering a wide range of  DBA tasks

2)       Create an installation T-SQL script. The purpose is to deploy the scripts onto the SQL Server Instance via command line .

An example of the script could be as follows . The script I actually use doesn’t allow the DROP DATABASE as the logon account doesn’t have DROP DATABASE privileges , to avoid any mistakes

 This example script assumes you have the five scripts mentioned in the same directory :

/* SCRIPT: SQL_TOOLS_INSTALL.sql */
/* BUILD A THE SQL-TOOLS DATABASE */

-- This is the main caller for each script
SET NOCOUNT ON
GO

PRINT 'CREATING DATABASE'
IF EXISTS (SELECT 1 FROM SYS.DATABASES WHERE NAME = 'SQL_TOOLS')
DROP DATABASE SQL_TOOLS
GO
CREATE DATABASE SQL_TOOLS
GO
USE SQL_TOOLS
GO

:On Error exit

:r isp_ALTER_INDEX_main.sql
:r isp_UPDATE_STATISTICS_main.sql
:r isp_DBCC_CHECKDB.sql
:r isp_KILL_ALL_DBCONNECTIONS.sql
:r isp_KILL_USER_PROCESSES.sql

PRINT 'SQL_TOOLS DATABASE CREATE IS COMPLETE'
GO

3) Create a batch file installation script.  This is the script you’ll execute from the command line – which will trigger the script in step 2.

 

       
An example is : 
       /* SCRIPT: SQL_TOOLS_INSTALL.bat */
       /* Excecute from the command line */
       /*input parameter1 = ”

SQLCMD -E -d master -S %1 -i "SQL_TOOLS_INSTALL.sql"
PAUSE

 

4)       Once the scripts are deployed onto the SQL Server Instance – you have a script library available to a)  create scheduled or ad-hoc tasks b) deploy secure scripts for troubleshooting , analysis and reporting

The key to this system is  a) maintaining a centralised script library , test and proven on lower environments.  b) rapid deployment onto a sql server environment c) Securing the scripts and limiting execution rights to relevant accounts

This approach is only one part of a strategy . Further considerations are scheduling of scripts , managing installation, disaster recovery and inventory management

See Also

Should libraries be installed on database servers ?

Powershell - run script on all sql servers

 

Republished with author's permission. See the original post here.


Republished from SQL Server DBA [65 clicks].  Read the original version here [32134 clicks].

Jack Vamvas
5 · 27% · 8528
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]