tim laqua dot com Thoughts and Code from Tim Laqua

27Feb/103

Script sp_configure Output To Migrate Settings Between SQL Servers

Sometimes when setting up a new server, all you want is for it to work and be configured exactly like the old server. In some cases, the new server is almost identical in every way already. If you've worked much with SQL Server, you know very well that there are a billion switches and knobs and every time you do this, you forget at least one. I had a similar situation recently and figured I'd be lazy about it and just turned the output of sp_configure in to a script I could execute on the new server:

scriptSpConfigure.sql - run this on the old/source server

EXEC sp_configure 'show advanced options' , 1;
GO
RECONFIGURE;
GO
DECLARE @spConfigureOutput TABLE
	([name] varchar(255)
	,[minimum] int
	,[maximum] int
	,[config_value] int
	,[run_value] int)
 
INSERT INTO @spConfigureOutput
EXEC sp_configure
 
SELECT	'EXEC sp_configure ''' + name + ''', ' + CAST(config_value AS VARCHAR)
FROM	@spConfigureOutput
GO
EXEC sp_configure 'show advanced options' , 0;
GO
RECONFIGURE;
GO

Copy the selected rows and paste in to another SSMS window, add the show advanced options switch above and below - should end up with something like this after you remove all the settings you don't care about or don't want on the new server:

EXEC sp_configure 'show advanced options' , 1;
GO
RECONFIGURE;
GO
 
EXEC sp_configure 'Ad Hoc Distributed Queries', 1
EXEC sp_configure 'Agent XPs', 1
EXEC sp_configure 'clr enabled', 1
EXEC sp_configure 'cost threshold for parallelism', 5
EXEC sp_configure 'cursor threshold', -1
EXEC sp_configure 'Database Mail XPs', 1
EXEC sp_configure 'default full-text language', 1033
EXEC sp_configure 'default trace enabled', 1
EXEC sp_configure 'fill factor (%)', 80
EXEC sp_configure 'ft crawl bandwidth (max)', 100
EXEC sp_configure 'ft notify bandwidth (max)', 100
EXEC sp_configure 'max full-text crawl range', 4
EXEC sp_configure 'max server memory (MB)', 10000
EXEC sp_configure 'max text repl size (B)', 65536
EXEC sp_configure 'min memory per query (KB)', 1024
EXEC sp_configure 'min server memory (MB)', 10000
EXEC sp_configure 'nested triggers', 1
EXEC sp_configure 'network packet size (B)', 4096
EXEC sp_configure 'PH timeout (s)', 60
EXEC sp_configure 'query wait (s)', -1
EXEC sp_configure 'remote access', 1
EXEC sp_configure 'remote login timeout (s)', 20
EXEC sp_configure 'remote query timeout (s)', 900
EXEC sp_configure 'scan for startup procs', 1
EXEC sp_configure 'server trigger recursion', 1
EXEC sp_configure 'SMO and DMO XPs', 1
 
EXEC sp_configure 'show advanced options' , 0;
RECONFIGURE;
GO;
Comments (3) Trackbacks (0)
  1. Very nice script, thank you.

  2. Many thanks, your script saved me valuable time.


Leave a comment

No trackbacks yet.