Sunday, 29 March 2015

Error with creating maintenance plans

Issue:

There are situations where a COM related error thrown while creating maintenance plan in SQL Server SSMS.


Error Message:
=======================================================================
==============================================================
Creating an instance of the COM component with CLSID {17BCA6E8-A95D-497E-B2F9-
AF6AA475916F} from the IClassFactory failed due to the following error: c001f011.
(Microsoft.SqlServer.ManagedDTS)




  

Step 1:

Traverse to the C:\Program Files\Microsoft SQL Server\100\DTS\binn directory and run the
Following from the command Prompt:
REGSVR32.EXE dts.dll




Step 2: 

Once done with registering the dts.dll you will get an successful information.




Step 3: You have to close the SSMS and which will solve the problem in creating the maintenance problem.



  

Maintenance plan will be created without any issues once the above troubleshooting is performed.

To study more about COM Class object and CLSID's Click Here


Appreciate your suggestions. Please comment your feedback and reach me out via email

Regards,
Ganapathi varma
Senior SQL Engineer, MCP





Sunday, 1 March 2015

How to change the file location of Tempdb database - SQL Server




What is tempdb?

The tempdb database is a global resource that is available to all users connected to the instance of SQL Server System. This tempdb database is maintains user defined global or local temporary tables, temporary stored procedures, table variables, cursors along with database engine defined versions of the tables for snapshot isolation and temporary sorted rowsets when rebuilding indexes.

Tempdb database information is stored in the tempdb.mdf data file and templog.ldf log file. Tempdb database size is effect on the performance of user defined database operation. Temporary stored information is dropped automatically when shut down SQL Server System and tempdb is re-created automatically when SQL Server is started so the system starts with a clean copy of the database.

More Reference URL

http://msdn.microsoft.com/en-us/library/ms190768.aspx

Why would you change tempdb file location?

Few Reasons:

1) tempdb Drive full
2) disk corrupt issue
3) client request to move the files to specified location
4) tempdb should be on a SATA drive instead of an IDE drive and should not be on the same drive as the SQL Server software or the operating system

Optimizing tempdb performance 

More Reference URL

https://technet.microsoft.com/en-us/library/ms175527%28v=sql.105%29.aspx


How to change the file location of Tempdb database

       


By default, Tempdb is placed on the same drive that SQL Server is installed on. 

a) Open SQL server SSMS and click new query
b) Run the below T-SQL Script to find the folder location of Tempdb database files.

USE TempDB
GO
EXEC sp_helpfile
GO








c) Execute the below T-SQL script to change the path of tempdb by providing new folder location for tempdb files

USE master; 
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'D:\Tempdb folder\tempdb.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'D:\Tempdb folder\templog.ldf');
GO




d) Now, Go to the SQL server configuration manager and then Select SQL Server Services.
e) Stop and restart SQL Server (MSSQLSERVER)



f)  Execute the following to verify that tempdb was moved to the desired location





Regards,
Ganapathi varma
Senior SQL Engineer, MCP


Monday, 23 February 2015

Know How SQL Server Executes a Query in Short

The present blog explains the entire process as to how MS SQL server, the client-server platform executes a query request, issued by user. Sending requests, which is the only means of communication with the server database can be achieved by the use of some specific in-built commands that the database in SQL server understands. The reason for acquiring the way SQL server executes a query is that it shall assist developers to write better coding for the database. Though understanding requires a complete know how and is a lengthy task, an attempt has been made to make users acquaint with the process in short by means of the image displayed below.


Summary of ‘Query Execution’ Procedure:  The complete procedure of query execution can be summarized as below:
                                                                                          
Step 1: At the very beginning a Request is sent, the Request in turn creates a new Task. In fact this step involves Creation of Task.

Step 2: If workers are not free to take up a Task for execution, a queue of Task gets formed and remains in pending state for execution.

Step 3: When any Worker in the threadpool becomes free after the execution of any Task, the idle Worker then picks up a pending Task. This step is all about an idle worker picking up a Pending Task.

Step 4: This is the Task Execution step of the query execution process. Here, firstly an execution plan is compiled. This in turn involves parsing, compilation and optimization. Thereafter, Query plan is executed where the operators access data through the buffer pool.

Step 5: Then, Result set is returned during execution.

Step 6: Finally, at the end the Task gets executed and complete. The involved Worker returns to idle state and the process gets over.

The process of SQL Server execution of queries can be understood easily by the below mentioned steps.

1.    Creation of ‘Request’

At the very beginning when a new request is completely sent over the Tabular Data Stream (TDS), a protocol that is used for communication between the sender’s application and the server database; task is created by server database engine for handling the placed request. Once the request gets formed it can take any one of the three below mentioned forms.

1.    Batch Request
2.    Remote Procedure Call Request
3.    Bulk Road Request

Note - The list of requests in the server can be queried from sys.dm_exec_requests.

2.    Creation of ‘Task’

The task that is created to handle the request represents the request right from the start to end. When a new request reaches the server and then the task that is created to handle the particular request remains in ‘pending’ state. The reason being, that at the current stage the server has no clue as to what exactly the request signifies. Thus, a pile of tasks gets formed and remains in queue. In such a case the task has to be executed first, for which the server database engine should assign a worker to it.

Note - The list of tasks in the server can be attained by sys.dm_os_tasks query. 

3.    Assigning ‘Worker’ a Task

Workers are one of the main components and actually the threadpool of SQL Server. Multiple of them are created in the beginning i.e. at the very start of the server. Although more of them can be formed on-demand up to a limit of configured maximum worker threads. All the workers remain in waiting state for the ‘pending’ tasks to become available, from requests coming into the server. Thereafter, each idle worker picks up exactly one task and executes it. In the mean time all the engaged worker remains unavailable until the execution of task gets over. Therefore, Tasks that remain in ‘pending’ state due to lack of available workers, shall have to stay pending until execution of any task gets complete and the worker that executed the particular task becomes available.

Note - The lists and state of workers inside SQL Server can be checked by querying sys.dm_os_workers.

4.    Parsing and Compilation

Thereafter, an execution plan is complied. In this step, before a Task starts executing a Request the first thing it needs to do is to gain a proper understanding about the content of the specific Request. The T-SQL text that exists inside the request gets parsed and an abstract syntax tree gets formed for representation of the particular Request. Actually, the conclusion is that all the existing Requests are parsed and thereby compiled in this step. However, in case any error occurs at this stride the Requests gets terminated with a compilation error.

5.    Optimization

Optimization is the next important phase in the complete life cycle of Task Execution, so as to select an optimum data path access. In case of SQL server, the best way of optimization is chosen by first observing the costs of each possible alternative. Thereby, the alternative with the lowest cost is chosen as the query plan to be utilized, to make the process economical. It is quite obvious that exploring all the possible alternatives consumes much time. Hence, once a query plan is created it is also cached, for use in future. So, similar Requests that might be requested in future can skip over the optimization phase; provided an already compiled and optimized query plan is found in the internal cache of SQL Server. 

6.    Execution & Result

Finally, after compilation the Requests gets executed, the Task gets completed and the Worker becomes available and free to pick up another Task in pending condition. Once a query plan is selected by the Optimizer, the ‘Request’ or say the ‘Query plan’ can be executed. Actually, this is the last important step as to how SQL server executes a query. Finally, the Result set is given back which is the end of the process.

Friday, 3 October 2014

SQL Server 2008 SP4 released


SQL Server 2008 SP4 contains fixes to issues that have been reported internally, through our customer feedback platforms, and Hotfix solutions provided since SQL Server 2008 Service Pack 4 up to and including Cumulative Update 17. It also includes the MS14-044 update. It is primarily a roll up of Cumulative Updates as it is the last Service Pack for SQL Server 2008. We will not release Cumulative Updates for SQL Server 2008 SP4

You can download it from here.


Below are the list of Service packs release till date. Click on the version number to get redirected to the microsoft download page.




SQL CODE SQL Version RTM (Gold, no SP) SP1 SP2 SP3 SP4
    Katmai  SQL Server 2008 10.00.1600.22 10.00.2531 10.00.4000 10.00.5500 10.0.6000.29




Microsoft SQL Server 2008 Builds

BuildFile versionKB / DescriptionRelease Date
10.00.60002007.100.6000.0SQL Server 2008 Service Pack 4 (SP4)September 30, 2014*new
10.00.58692007.100.5869.02977322 MS14-044: Description of the security update for SQL Server 2008 SP3 (QFE)August 12, 2014
10.00.58612007.100.5861.02958696 Cumulative update package 17 (CU17) for SQL Server 2008 Service Pack 3May 19, 2014
10.00.58522007.100.5852.02936421 Cumulative update package 16 (CU16) for SQL Server 2008 Service Pack 3March 17, 2014
10.00.58502007.100.5850.02923520 Cumulative update package 15 (CU15) for SQL Server 2008 Service Pack 3January 20, 2014
10.00.58482007.100.5848.02893410 Cumulative update package 14 (CU14) for SQL Server 2008 Service Pack 3November 18, 2013
10.00.58462007.100.5846.02880350 Cumulative update package 13 (CU13) for SQL Server 2008 Service Pack 3September 16, 2013
10.00.58442007.100.5844.02863205 Cumulative update package 12 (CU12) for SQL Server 2008 Service Pack 3July 16, 2013
10.00.58412007.100.5841.02834048 Cumulative update package 11 (CU11) for SQL Server 2008 Service Pack 3 (updated)June 13, 2013
10.00.58402007.100.5840.02834048 Cumulative update package 11 (CU11) for SQL Server 2008 Service Pack 3 (replaced)May 20, 2013
10.00.58352007.100.5835.02814783 Cumulative update package 10 (CU10) for SQL Server 2008 Service Pack 3March 18, 2013
10.00.58292007.100.5829.02799883 Cumulative update package 9 (CU9) for SQL Server 2008 Service Pack 3January 23, 2013
10.00.58282007.100.5828.02771833 Cumulative update package 8 (CU8) for SQL Server 2008 Service Pack 3November 19, 2012
10.00.58262007.100.5826.02716435 Microsoft Security Bulletin MS12-070October 9, 2012
10.00.57942007.100.5794.02738350 Cumulative update package 7 (CU7) for SQL Server 2008 Service Pack 3September 21, 2012
10.00.57882007.100.5788.02715953 Cumulative update package 6 (CU6) for SQL Server 2008 Service Pack 3July 16, 2012
10.00.57852007.100.5785.02696626 Cumulative update package 5 (CU5) for SQL Server 2008 Service Pack 3May 19, 2012
10.00.57752007.100.5775.02673383 Cumulative update package 4 (CU4) for SQL Server 2008 Service Pack 3March 20, 2012
10.00.57702007.100.5770.02648098 Cumulative update package 3 (CU3) for SQL Server 2008 Service Pack 3January 16, 2012
10.00.57682007.100.5768.02633143 Cumulative update package 2 (CU2) for SQL Server 2008 Service Pack 3November 22, 2011
10.00.57662007.100.5766.02617146 Cumulative update package 1 (CU1) for SQL Server 2008 Service Pack 3October 18, 2011
10.00.55202007.100.5520.02977321 MS14-044: Description of the security update for SQL Server 2008 SP3 (GDR)August 12, 2014
10.00.55122007.100.5512.0Microsoft Security Bulletin MS12-070October 9, 2012
10.00.55002007.100.5500.0SQL Server 2008 Service Pack 3 (SP3)October 6, 2011
10.00.54162007.100.5416.0SQL Server 2008 Service Pack 3 CTPAugust 22, 2011
10.00.43712007.100.4371.0Microsoft Security Bulletin MS12-070October 9, 2012
10.00.43332007.100.4333.02715951 Cumulative update package 11 (CU11) for SQL Server 2008 Service Pack 2July 16, 2012
10.00.43322007.100.4332.02696625 Cumulative update package 10 (CU10) for SQL Server 2008 Service Pack 2May 20, 2012
10.00.43302007.100.4330.02673382 Cumulative update package 9 (CU9) for SQL Server 2008 Service Pack 2March 19, 2012
10.00.43262007.100.4326.02648096 Cumulative update package 8 (CU8) for SQL Server 2008 Service Pack 2January 30, 2012
10.00.43232007.100.4323.02617148 Cumulative update package 7 (CU7) for SQL Server 2008 Service Pack 2November 21, 2011
10.00.43212007.100.4321.02582285 Cumulative update package 6 (CU6) for SQL Server 2008 Service Pack 2September 20, 2011
10.00.43162007.100.4316.02555408 Cumulative update package 5 (CU5) for SQL Server 2008 Service Pack 2July 18, 2011
10.00.42852007.100.4285.02527180 Cumulative update package 4 (CU4) for SQL Server 2008 Service Pack 2May 16, 2011
10.00.42792007.100.4279.02498535 Cumulative update package 3 (CU3) for SQL Server 2008 Service Pack 2March 11, 2011
10.00.42722007.100.4272.02467239 Cumulative update package 2 (CU2) for SQL Server 2008 Service Pack 2February 10, 2011
10.00.42662007.100.4266.02289254 Cumulative update package 1 (CU1) for SQL Server 2008 Service Pack 2November 15, 2010
10.00.40672007.100.4067.0Microsoft Security Bulletin MS12-070October 9, 2012
10.00.40642007.100.4064.02494089 MS11-049: Description of the security update for SQL Server 2008 Service Pack 2 GDR: June 14, 2011June 14, 2011
10.00.40002007.100.4000.0SQL Server 2008 Service Pack 2 (SP2)September 29, 2010
10.00.37982007.100.3798.0SQL Server 2008 Service Pack 2 CTPJuly 7, 2010
10.00.28502007.100.2850.02582282 Cumulative update package 16 (CU16) for SQL Server 2008 Service Pack 1September 19, 2011
10.00.28472007.100.2847.02555406 Cumulative update package 15 (CU15) for SQL Server 2008 Service Pack 1July 18, 2011
10.00.28212007.100.2821.02527187 Cumulative update package 14 (CU14) for SQL Server 2008 Service Pack 1May 16, 2011
10.00.28162007.100.2816.02497673 Cumulative update package 13 (CU13) for SQL Server 2008 Service Pack 1March 22, 2011
10.00.28082007.100.2808.02467236 Cumulative update package 12 (CU12) for SQL Server 2008 Service Pack 1February 10, 2011
10.00.28042007.100.2804.02413738 Cumulative update package 11 (CU11) for SQL Server 2008 Service Pack 1November 15, 2010
10.00.27992007.100.2799.02279604 Cumulative update package 10 (CU10) for SQL Server 2008 Service Pack 1September 21, 2010
10.00.27892007.100.2789.02083921 Cumulative update package 9 (CU9) for SQL Server 2008 Service Pack 1July 21, 2010
10.00.27872007.100.2787.02231277 FIX: The Reporting Services service stops unexpectedly after you apply SQL Server 2008 SP1 CU 7 or CU8July 30, 2010
10.00.27752007.100.2775.0981702 Cumulative update package 8 (CU8) for SQL Server 2008 Service Pack 1May 17, 2010
10.00.27662007.100.2766.0979065 Cumulative update package 7 (CU7) for SQL Server 2008 Service Pack 1March 26, 2010
10.00.27572007.100.2757.0977443 Cumulative update package 6 (CU6) for SQL Server 2008 Service Pack 1January 18, 2010
10.00.27462007.100.2746.0975977 Cumulative update package 5 (CU5) for SQL Server 2008 Service Pack 1November 16, 2009
10.00.27402007.100.2740.0976761 FIX: Error message when you perform a rolling upgrade in a SQL Server 2008 cluster : "18401, Login failed for user SQLTEST\AgentService. Reason: Server is in script upgrade mode. Only administrator can connect at this time.[SQLState 42000]"November 24, 2009
10.00.27342007.100.2734.0973602 Cumulative update package 4 (CU4) for SQL Server 2008 Service Pack 1September 22, 2009
10.00.27232007.100.2723.0971491 Cumulative update package 3 (CU3) for SQL Server 2008 Service Pack 1July 21, 2009
10.00.27142007.100.2714.0970315 Cumulative update package 2 (CU2) for SQL Server 2008 Service Pack 1May 18, 2009
10.00.27122007.100.2712.0970507 FIX: Error message in SQL Server 2008 when you run an INSERT SELECT statement on a table: "Violation of PRIMARY KEY constraint '<PrimaryKey>'. Cannot insert duplicate key in object '<TableName>'"July 21, 2009
10.00.27102007.100.2710.0969099 Cumulative update package 1 (CU1) for SQL Server 2008 Service Pack 1April 16, 2009
10.00.25732007.100.2573.02494096 MS11-049: Description of the security update for SQL Server 2008 Service Pack 1 GDR: June 14, 2011June 14, 2011
10.00.25312007.100.2531.0SQL Server 2008 Service Pack 1 (SP1)April 7, 2009
10.00.25202007.100.2520.0SQL Server 2008 Service Pack 1 - CTPFebruary 23, 2009
10.00.18352007.100.1835.0979064 Cumulative update package 10 (CU10) for SQL Server 2008March 15, 2010
10.00.18282007.100.1828.0977444 Cumulative update package 9 (CU9) for SQL Server 2008January 18, 2010
10.00.18232007.100.1823.0975976 Cumulative update package 8 (CU8) for SQL Server 2008November 16, 2009
10.00.18182007.100.1818.0973601 Cumulative update package 7 (CU7) for SQL Server 2008September 21, 2009
10.00.18122007.100.1812.0971490 Cumulative update package 6 (CU6) for SQL Server 2008July 21, 2009
10.00.18062007.100.1806.0969531 Cumulative update package 5 (CU5) for SQL Server 2008May 18, 2009
10.00.17982007.100.1798.0963036 Cumulative update package 4 (CU4) for SQL Server 2008March 17, 2009
10.00.17872007.100.1787.0960484 Cumulative update package 3 (CU3) for SQL Server 2008January 19, 2009
10.00.17792007.100.1779.0958186 Cumulative update package 2 (CU2) for SQL Server 2008November 19, 2008
10.00.17712007.100.1771.0958611 FIX: You may receive incorrect results when you run a query that references three or more tables in the FROM clause in SQL Server 2008October 29, 2008
10.00.17632007.100.1763.0956717 Cumulative update package 1 (CU1) for SQL Server 2008October 28, 2008
10.00.17502007.100.1750.0956718 FIX: A MERGE statement may not enforce a foreign key constraint when the statement updates a unique key column that is not part of a clustering key that has a single row as the update source in SQL Server 2008August 25, 2008
10.00.16002007.100.1600.22SQL Server 2008 RTMAugust 7, 2008
10.00.14422007.100.1442.32Microsoft SQL Server 2008 RC0June 5, 2008
10.00.13002007.100.1300.13Microsoft SQL Server 2008 CTP, February 2008February 19, 2008
10.00.10752007.100.1075.23Microsoft SQL Server 2008 CTP, November 2007November 18, 2007
10.00.10492007.100.1049.14SQL Server 2008 CTP, July 2007July 31, 2007
10.00.10192007.100.1019.17SQL Server 2008 CTP, June 2007May 21, 2007



Appreciate your suggestions. Please comment your feedback and reach me out at email

Regards,
Ganapathi varma