Thursday, July 10, 2014

Open dtsconfig files in Notepad ++ (formatted as xml)


I often use Notepad++ as a quick way to open text files, and I want to open dtsconfig files formatted as xml :
in the settings Menu chose style configurator
image
then add the dtsconfig file extension to xml config:
image

Friday, May 30, 2014

SSRS 2008R2 refuses to start after upgrade from SSRS 2008

Scenario : After upgrading from SQL 2008 to SQL 2008 R2, reporting services refuses to start. All other SQL server services run normally after the upgrade. steps performed:

 If a AD Domain account is used, it has to be local admin for SSRS To start.
 Local services account do not work either.
uninstall/reinstall reporting services brought another issue : the setup finds - fails the IA64 OS check. The OS is not IA64.
Tried using the command line with the SKIPRULES switch without success.
New error Message : "SQL Path Element is missing" and the setup fails. 

I spent quit some time on Google looking for a solution for this, none of which works. I finally found out how to fix the issue:
 From the command line run
SETUP.EXE /ACTION=RunDiscovery.
On the report below we can notice 2 SQL2008 component for which the instance is highlighted : MSSQLSERVER.INACTIVE
Resolution Steps to remove the inactive instance:

 First search for files called Datastore_discovery.xml and open the most recent one. List of files left after uninstalling SQL Server Look for the places containing "MSSQLSERVER.INACTIVE" below is a sample
Urn="Machine[@ID='IWE']/Product[@ID='SQLVNEXT']/Instance[@ID='MSSQLSERVER.INACTIVE']" ID="MSSQLSERVER.INACTIVE" Name="MSSQLSERVER.INACTIVE" ........
Then look for the related lines containing ProductCode = "{B5153233-9AEE-4CD4-9D2C-4FAAC870DBE2}" (of course yours will be different)
The number of times you have to look for these product codes depend on how many components are listed as inactive. For each of the product codes that you found run: ** msiexec /x {B5153233-9AEE-4CD4-9D2C-4FAAC870DBE2} **
Do this for each product code related the MSSQLSERVER.INACTIVE that you found.

Then run setup again, click on Tools then "Installed SQL Server Features discovery report". If you can still see an instance MSSQLSERVER.INACTIVE you missed one of the Product Codes.

 After cleaning the server completely, I noticed : The existing SQL SERVER 2008R2 instance , SSIS etc.. were still running. I reinstalled SSRS and everything went fine. I did not perform any additional steps.

Wednesday, March 19, 2014

Configure SQL user to Write to the Event log

The case scenario is : I'm using a SSIS Script task to zip a large number of files and I want to log the 7zip errors to the Event log using System.Diagnostics. Here is the procedure I use to allow the SQL user to write to the event log.

You will need wevtutil normally found in %system32%, if not available you will have to use the registry editor.
1. configure credential for the user
2. determine permissions for the application log : wevtutil gl application > D:\temp\out.txt
3. open the file out.txt :
           name: application    
           enabled: true    
           type: Admin    
           owningPublisher:    
           isolation: Application    

            channelAccess: O:BAG:SYD:(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)
   
            logging:
  logFileName: %SystemRoot%\System32\Winevt\Logs\application.evtx
  retention: false
  autoBackup: false
  maxSize: 20971520
  publishing:
  fileMax: 1

4.          Using the Registry Editor (see original post  from Beth Massi)

You can allow any authenticated user write access to your log or you can allow the specific user SID write access. Open up the registry editor to your event log CustomSD key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Eventlog\MyLogName\CustomSD

To allow all authenticated users write access add the following security permission:
(A;;0x0002;;;AU)
To allow a specific user write access you would specify their SID:
(A;;0x0002;;;SID-OF-USER-ACCOUNT) 
5.       Modify the registry using wevtutil 
 wevtutil sl Application /ca:<updated channel line>

 Example to give read/write access to authenticated users will will use the 0x3 value:
 wevtutil sl Application /ca: O:BAG:SYD:(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)(A;;0x3;;;AU)

Friday, February 21, 2014

Shrink TempDb Without Restart

USE tempdb
GO
--sp_helpfile
DBCC FREEPROCCACHE
GO
DBCC DROPCLEANBUFFERS
go
DBCC FREESYSTEMCACHE ('ALL')
GO
DBCC FREESESSIONCACHE
GO
--second parameter is targe in percent
DBCC SHRINKDATABASE(tempdb,10)