mandag den 13. januar 2014

Fun way to change your daily path

I really enjoy finding new processes/tools to enhance the daily challenge of getting things done. Getting things done can both be tasks at work or private stuff that needs your attention. Changing daily routines, or in my case, trying to incoporate a new daily training session is for me, not just a walk in the park.

Right now I’m trying to see if the online webtool called habitrpg (http://habitrpg.com) is the right helping hand. It uses this rewarding system (the carrot) where you set up some daily tasks (or todo’s or long-term things to either do or not do). You also setup the award you can cash in, when X number of tasks have been done. In my case I’m allowed to bye a cake AND a special beer.

torsdag den 20. juni 2013

Biztalk Sql Agent Job Failed orphaned messages

Today I received an alert on a failing Sql Agent Job on a Biztalk Sql Server. The job was failing cause of errors in the Biztalk Msg Database. The cure for the issue is by using the Terminator Tool. More information on Tord's blog: http://biztalkadmin.com/orphaned-messages-in-the-tracking-database/

torsdag den 8. november 2012

RDP - session hanging

In some cases on some systems I have experienced that my RDP session hangs, and the only thing I can see when logging in on the server is a black screen.

When this happens I have 2 options:

  1. Complain, complain and complain
  2. Call some support fellow, or disturb a colleague who might happen to have access to the same server, and let him kill my RDP session
But this was until today, when I thought to myself: Myself, there must be another way, and there is. Using the commands: quser.exe /server:[servername] from a different server actually tells you which users logged on to the target server. Read out the session-id from the user you want to "kill" and use: logout [session-id] /server:[servername]. This will do the trick.

Thanks Dan Rigsby for sharing this [http://www.danrigsby.com/blog/index.php/2008/08/26/remotely-log-off-remote-desktop-users/]

fredag den 26. oktober 2012

Are your SQL Server Queries slow?

Run this query to see if any of your indexes needs a rebuild or reorganize:
(linked back from this site: http://weblogs.asp.net/okloeten/archive/2009/01/05/6819737.aspx)

SELECT 'ALTER INDEX [' + ix.name + '] ON [' + s.name + '].[' + t.name + '] ' +
       CASE WHEN ps.avg_fragmentation_in_percent > 40 THEN 'REBUILD' ELSE 'REORGANIZE' END +
       CASE WHEN pc.partition_count > 1 THEN ' PARTITION = ' + cast(ps.partition_number as nvarchar(max)) ELSE '' END
FROM   sys.indexes AS ix INNER JOIN sys.tables t
           ON t.object_id = ix.object_id
       INNER JOIN sys.schemas s
           ON t.schema_id = s.schema_id
       INNER JOIN (SELECT object_id, index_id, avg_fragmentation_in_percent, partition_number
                   FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL)) ps
           ON t.object_id = ps.object_id AND ix.index_id = ps.index_id
       INNER JOIN (SELECT object_id, index_id, COUNT(DISTINCT partition_number) AS partition_count
                   FROM sys.partitions
                   GROUP BY object_id, index_id) pc
           ON t.object_id = pc.object_id AND ix.index_id = pc.index_id
WHERE  ps.avg_fragmentation_in_percent > 10 AND
       ix.name IS NOT NULL

onsdag den 3. oktober 2012

SQL Server Bulk Insert

How to insert bulk data into a SQL Server Table from a CSV file:


BULK
INSERT TugLookup
FROM 'c:\temp\tuglookup.csv'
WITH
(
FIELDTERMINATOR = ';',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
SELECT *
FROM TugLookup
GO

torsdag den 7. juni 2012

Notes on BizTalk 2010

Some notes around installing and configuration of BizTalk 2010

The installation was done on a virtualized Win 2008R2. Follow this document from Microsoft:

The installation consists of following components:
- SQL Server 2008R2 with SSAS,SSRS and SSIS installed. But be sure to read the installation guide
- Visual Studio 2010 (download the trial version from Microsoft)
- Configuration of the SQL Server (deactivate shared memory on the instance)
- Installation of BizTalk 2010
- Configuration of BizTalk 2010

After this, launch the Administration application.

Tutorial for developing your first BizTalk solution:

torsdag den 26. april 2012

Create multiple scheduled tasks across n-servers

Needed to create the same scheduled task on several servers. Using a bit of Powershell made the task a bit easier. Below functions can be used to create, delete and view scheduled tasks on a specific server:

Function Get-ScheduledTask
 {
 param([string]$ComputerName = "localhost")
 Write-Host "Computer: $ComputerName"
 $Command = "schtasks.exe /query /s $ComputerName"
 Invoke-Expression $Command
 Clear-Variable Command -ErrorAction SilentlyContinue
 Write-Host "`n"
 }
 
# EXAMPLE: Get-ScheduledTask -ComputerName Server01
 
Function Remove-ScheduledTask
 {
 param(
 [string]$ComputerName = "localhost",
 [string]$TaskName = "blank"
 )
 If ((Get-ScheduledTask -ComputerName $ComputerName) -match $TaskName)
  {
  If ((Read-Host "Are you sure you want to remove task $TaskName from $ComputerName(y/n)") -eq "y")
   {
   $Command = "schtasks.exe /delete /s $ComputerName /tn $TaskName /F"
   Invoke-Expression $Command
   Clear-Variable Command -ErrorAction SilentlyContinue
   }
  }
 Else
  {
  Write-Warning "Task $TaskName not found on $ComputerName"
  }
 }
 
# EXAMPLE: Remove-ScheduledTask -ComputerName Server01 -TaskName MyTask
 
Function Create-ScheduledTask
 {
 param(
 [string]$ComputerName = "localhost",
 [string]$RunAsUser = "System",
 [string]$TaskName = "MyTask",
 [string]$TaskRun = '"C:\Program Files\Scripts\Script.vbs"',
 [string]$Schedule = "Monthly",
 [string]$Modifier = "second",
 [string]$Days = "SUN",
 [string]$Months = '"MAR,JUN,SEP,DEC"',
 [string]$StartTime = "13:00",
 [string]$EndTime = "17:00",
 [string]$Interval = "60" 
 )
 Write-Host "Computer: $ComputerName"
 $Command = "schtasks.exe /create /s $ComputerName /ru $RunAsUser /tn $TaskName /tr $TaskRun /sc $Schedule /mo $Modifier /d $Days /m $Months /st $StartTime /et $EndTime /ri $Interval /F"
 Invoke-Expression $Command
 Clear-Variable Command -ErrorAction SilentlyContinue
 Write-Host "`n"
 }
 
# EXAMPLE: Create-ScheduledTask -ComputerName MyServer -TaskName MyTask02 -TaskRun "D:\scripts\script2.vbs"

Borrowed from: this link