SQL SERVER – SQL Daily Tips – Space Unused Vs Space Unallocated

Space Unused:


Are pages allocated on extends, however this pages are not used yet by any kind of objects. It means, SQL Server has 8 pages by each extent. If an object reside in a page of a certain extend, this space is allocated and used, but the rest of the space of the extend is allocated but unused because there are not objects.


Space Unallocated:


Space (extends) that is not in use, it means extends that are not allocated by SQL Server. Any kind of grow will produce a space unallocated.



SQL SERVER – SQL Error – MsiGetProductInfo failed to retrieve ProductVersion for package with Product Code = '{8BDD006D-7863-4D25-9806-08527E285EA4}'.

Problem.


Overall summary:

Final result: Failed: see details below

Exit code (Decimal): 2064843076

Exit facility code: 787

Exit error code: 324

Exit message: MsiGetProductInfo failed to retrieve ProductVersion for package with Product Code = '{8BDD006D-7863-4D25-9806-08527E285EA4}'. Error code: 1605.

Start time: 2009-07-28 18:30:43

End time: 2009-07-28 18:31:14

Requested action: ComponentUpdate

Log with failure: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20090728_182952\Detail_ComponentUpdate.txt

Exception help link: http%3a%2f%2fgo.microsoft.com%2ffwlink%3fLinkId%3d20476%26ProdName%3dMicrosoft%2bSQL%2bServer%26EvtSrc%3dsetup.rll%26EvtID%3d50000%26ProdVer%3d10.0.1600.22%26EvtType%3d0x4E099C65%400x7B130144


The error happened during the installation of a SQL Server 2008.



Solution / Fix / Workaround


The above remark line show us the product code related with the error. First, is necessary to know that SQL Server 2008 has around of 30 products registered on the Registry. Each product has a Product code and an installation code as well (GUID).


For this case the Product Code is the following:


{8BDD006D-7863-4D25-9806-08527E285EA4}



The Installation Code is build with the product code in reverse form:


D600DD8368752D460894AE582E72580



One time that you got the Installation Code look into the Windows Registry and delete all the entries found.


Then try again the installation and the result must to be SUCCESSFULLY.

SQL SERVER – SQL Daily Tips – Backup your database without affect the normal backup sequence.

Sometimes is necessary take a full backup or log backup for a database without affect the backup normal sequence for the database and log as well. This backup can be with different purpose as testing, development, etc. For this cases SQL Server provides an option for the backup statement, this is COPY_ONLY.


BACKUP DATABASE db_name TO disk='C:\db_name.bkp' WITH COPY_ONLY


This option COPY_ONLY, can be performed for any backup type. COPY_ONLY has certains behaviors depending of the backup type:


* A log backup taken using copy_only, does not truncate the transaction log.

* A data backup taken using copy_only cannot be used as base backup for differential or incremental backups.

* A differential backup has not effect with copy_only option.

SQL SERVER – Server Configurations Options – Allow updates

This option is present when sp_configure is executed or when sys.configuration is queried, but this functionality is unavailable since SQL Server 2005, it is obsolete. Direct updates to system objects are not allowed. If sp_configure is used to enable the option, this configuration has not effect. In previous versions as SQL Server 2000 this functionality is available.


Testing the option


The following code enable the option “allow updates”, then a table is created and finally an update to system table is executed:


sp_configure 'allow updates', 1

GO

RECONFIGURE with override

GO

CREATE TABLE TBLTEST (TESTFIELD INT )

GO

update sys.objects

set name = 'TBLTEST_1'

where name = 'TBLTEST'

GO


When the update to system table is triggered the following error is shown:


Msg 259, Level 16, State 1, Line 1

Ad hoc updates to system catalogs are not allowed.


This option is not advanced option and is not necessary enable the “show advanced options”. To understand in a better way if a certain option is or is not advanced, if it is dynamic or is necessary restart, please refer SQL SERVER – Server Configurations Options – Catalog View – sys.configurations

SQL SERVER – SQL Daily Tips – Monitoring progress for tasks.

SQL Server 2005 introduces Dynamic Management View, one of this objects allows us monitoring the progress for different tasks and process in SQL Server.


select percent_complete, estimated_completion_time, cpu_time, total_elapsed_time, *

from sys.dm_exec_requests


this query is very helpful in the daily work to monitoring different tasks.

SQL SERVER – Server Configurations Options – Agent XPs Option

The Server configuration option called Agent XPs is used to enabled the SQL Server Agent extended stored procedures on the server. When this option is disabled, the SQL Server Agent node is not enabled in SQL Server Management Studio and you can not use the SQL Server Agent Service.



When the SQL Server agent is restarted, the extended stored procedures are enabled automatically.


To enabled this option:


sp_configure 'show advanced options', 1

GO

RECONFIGURE with override

GO

sp_configure 'Agent XPs', 1

GO

RECONFIGURE with override

GO

sp_configure 'show advanced options', 0

GO

RECONFIGURE with override

GO



This option is an advanced option and is necessary enable first the “show advanced options”. To understand in a better way if a certain option is or is not advanced, if it is dynamic or is necessary restart, please refer SQL SERVER – Server Configurations Options – Catalog View – sys.configurations

SQL SERVER – Server Configurations Options – Catalog View – sys.configurations

The sys.configuration catalog view allow us to see the same values than sp_configure with “show advanced options” enabled. Even this Catalog view show us extra information because is possible to know if an option is or is not an advanced option, or if is or is not dynamic option.


Important Columns,


Value: Configured Value for the option

Minimum: Minimum Value for the option

Maximum: Maximum Value for the option

Value_in_use: current running value for the option.

Is_dynamic: it column allow us to know if the option is dynamic or not. 1 = the value takes effect when the RECONFIGURE statement is executed. 0 = the value takes effect when the SQL Server is restarted.

Is_advanced: it column allow us to know if the option is advanced. 1 = advanced option, it means that the option is displayed and can be changed just when “show advanced options” is set through sp_configure.



Now we are going to see statements using sys.configurations that are equivalent than sp_configure.


Normal View:


Using sys.configurations


select * from sys.configurations where is_advanced = 0


Using sp_configure:


sp_configure 'show advanced options', 0

GO

RECONFIGURE with override

GO

sp_configure

GO


Advanced Option View:


Using sys.configurations


select * from sys.configurations where is_advanced = 1


Using sp_configure:


sp_configure 'show advanced options', 1

GO

RECONFIGURE with override

GO

sp_configure

GO


Dynamic Option View


Using sys.configurations


To see all the dynamic options:

select * from sys.configurations where is_dynamic = 1


To see all the non dynamic options:

select * from sys.configurations where is_dynamic = 0


Using sp_configure is impossible to know if an option is dynamic.



Conclusion.


Using sys.configurations to see the server configuration is better than sp_configure because with a single select statement is possible to view all the server options with extra information as is_dynamic and is_advanced values, this extra information is impossible to obtain with sp_configure. Any changed necessary on the server configuration has to be performed with sp_configure.