11 August 2019
07 August 2019
13 July 2019
CIS Benchmark : Center for internet security
1 Installation, Updates and Patches
Ensure Latest SQL Server Service Packs and Hotfixes are Installed
SELECT SERVERPROPERTY('ProductLevel') as SP_installed, SERVERPROPERTY('ProductVersion') as Version;
2. Ensure Single-Function Member Servers are Used
Ensure that no other roles are enabled for the underlying operating system and that no excess tooling is installed, per enterprise policy.
3.Surface Area Reduction
Ensure 'Ad Hoc Distributed Queries' Server Configuration Option is set to '0'
SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'Ad Hoc Distributed Queries';
EXECUTE sp_configure 'show advanced options', 1;
RECONFIGURE; EXECUTE sp_configure 'Ad Hoc Distributed Queries', 0;
RECONFIGURE;
GO
EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;
4 Ensure 'CLR Enabled' Server Configuration Option is set to '0'
SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'clr enabled';
EXECUTE sp_configure 'clr enabled', 0; RECONFIGURE;
Ensure Latest SQL Server Service Packs and Hotfixes are Installed
SELECT SERVERPROPERTY('ProductLevel') as SP_installed, SERVERPROPERTY('ProductVersion') as Version;
2. Ensure Single-Function Member Servers are Used
Ensure that no other roles are enabled for the underlying operating system and that no excess tooling is installed, per enterprise policy.
3.Surface Area Reduction
Ensure 'Ad Hoc Distributed Queries' Server Configuration Option is set to '0'
SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'Ad Hoc Distributed Queries';
EXECUTE sp_configure 'show advanced options', 1;
RECONFIGURE; EXECUTE sp_configure 'Ad Hoc Distributed Queries', 0;
RECONFIGURE;
GO
EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;
4 Ensure 'CLR Enabled' Server Configuration Option is set to '0'
SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'clr enabled';
EXECUTE sp_configure 'clr enabled', 0; RECONFIGURE;
Move Database
(A) Move USER database :3 methods
1 Backup and restore on new location
2. attach and detach database
3. Alter Command
First check current location
sp_helpdb 'database name'
or
SELECT name,physical_name FROM AdventureWorks.sys.database_files
ALTER DATABASE AdventureWorks SET OFFLINE
ALTER DATABASE AdventureWorks
MODIFY FILE (NAME = AdventureWorks_Data, FILENAME ='D:\MSSQL\Data\databasename.mdf');
ALTER DATABASE AdventureWorks
MODIFY FILE (NAME = AdventureWorks_Log, FILENAME ='D:\MSSQL\Log\databasename_Log.ldf');
ALTER DATABASE AdventureWorks SET ONLINE
1 Backup and restore on new location
2. attach and detach database
3. Alter Command
First check current location
sp_helpdb 'database name'
or
SELECT name,physical_name FROM AdventureWorks.sys.database_files
ALTER DATABASE AdventureWorks SET OFFLINE
ALTER DATABASE AdventureWorks
MODIFY FILE (NAME = AdventureWorks_Data, FILENAME ='D:\MSSQL\Data\databasename.mdf');
ALTER DATABASE AdventureWorks
MODIFY FILE (NAME = AdventureWorks_Log, FILENAME ='D:\MSSQL\Log\databasename_Log.ldf');
ALTER DATABASE AdventureWorks SET ONLINE
(B) Move master Database to another drive
(C) Move Temp Database to another drive
12 July 2019
SQL Query Performance
common issues with performance such as:
- deadlocks
- blocking
- missing and unused indexes
- I/O bottlenecks
- poor query plans
- statistics
- wait stats
- fragmentation
Tools to collect performance related data.
- Dynamic Management Views (DMVs) and System Catalog Views
- Profiler and Server Side Traces
- Windows Performance Monitor
- Built in performance reports in SSMS
- Query Plans
- Database Tuning Advisor
Subscribe to:
Posts (Atom)
Resource Governor
Resource Governor is a feature that you can use to manage SQL Server workload and system resource consumption. Resource Governor enables y...
-
SQL Server Services 1) List out various services which are important for SQL Server and its components functionality? · SQL ...
-
There are various methods available for bulk data operations. BCP utility BULK INSERT Using OPENROWSET Import/Expor...
-
SELECT @@VERSION --Returns the version of MS SQL Server running on the instance. SELECT @@SERVERNAME --Returns the name of the MS SQL ...

