WEB开发网
开发学院数据库MSSQL Server sqlserver的日常检查脚本归结 阅读

sqlserver的日常检查脚本归结

 2012-02-15 12:23:49 来源:WEB开发网   
核心提示:Declare @instance_name1 nvarchar(100) -- Step 3: Reading registry keys for IP,Binaries,Startup type ,startup username, errorlogs location

Declare @instance_name1 nvarchar(100)                        


-- Step 3: Reading registry keys for IP,Binaries,Startup type ,startup username, errorlogs location and domain.


SET @instance_name = coalesce(convert(nvarchar(100), serverproperty('InstanceName')),'MSSQLSERVER');                        


If @instance_name!='MSSQLSERVER'                        


Set @instance_name=@instance_name                      



   

Set @instance_name1= coalesce(convert(nvarchar(100), serverproperty('InstanceName')),'MSSQLSERVER');                        


If @instance_name1!='MSSQLSERVER'                        


Set @instance_name1='MSSQL$'+@instance_name1                        


EXEC master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\Microsoft SQL Server\Instance Names\SQL', @instance_name, @system_instance_name output;                        


                       


Set @key=N'SYSTEM\CurrentControlSet\Services\' +@instance_name1;                        


SET @registry_key = N'Software\Microsoft\Microsoft SQL Server\' + @system_instance_name + '\MSSQLServer\Parameters';                        


If @registry_key is NULL                        


set @instance_name=coalesce(convert(nvarchar(100), serverproperty('InstanceName')),'MSSQLSERVER');                        


EXEC master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\Microsoft SQL Server\Instance Names\SQL', @instance_name, @system_instance_name output;                        




SET @registry_key = N'Software\Microsoft\Microsoft SQL Server\' + @system_instance_name + '\MSSQLServer\Parameters';                        


SET @registry_key1 = N'Software\Microsoft\Microsoft SQL Server\' + @system_instance_name + '\MSSQLServer\supersocketnetlib\TCP\IP1';                        


SET @registry_key2 = N'SYSTEM\ControlSet001\Services\Tcpip\Parameters\';                        

上一页  1 2 3 4 5 6 7  下一页

Tags:sql server 脚本

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接