Job from removed maintenance plan

Posted in DBA, Microsoft Sql server, TSQL at 11:36 am by

You removed a maintenance plan and it didn’t delete the job. You got the following error:

The DELETE statement conflicted with the REFERENCE constraint “FK_subplan_job_id”. The conflict occurred in database “msdb”, table “dbo.sysmaintplan_subplans”, column ‘job_id’.
The statement has been terminated. (.Net SqlClient Data Provider)

You can remove the job by executing the following code:

– Set @job_name to the job name you want to delete

USE [msdb]
DECLARE @job_name varchar(100)
SET @job_name = ‘job name’

–Delete the logs for the plan

sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
INNER JOIN sysmaintplan_log ON
subplans.subplan_id = sysmaintplan_log.subplan_id
syjobs.name = @job_name;

–Delete the subplan

sysmaintplan_subplans AS subplans
INNER JOIN sysjobs_view AS syjobs ON
subplans.job_id = syjobs.job_id
syjobs.name = @job_name;

–delete the job

name = @job_name;

Transaction log grows with Bulk Logged?

Posted in DBA, Microsoft Sql server, TSQL at 10:55 am by

When using the Bulk-Logged recovery model your server logs the bulk commands minimally, our so you think. For sql server to log minimally other criteria should be met!

First off the table should not be replicated. And when you do your bulk logged command you also need to lock the table.


sp_tableoption target_table, 'table lock on bulk load', 1

INSERT INTO target_table

sp_tableoption target_table, 'table lock on bulk load', 0


Huge transaction log with sql server

Posted in DBA, Microsoft Sql server, TSQL at 5:24 pm by

Your transaction log is huge and has free space.
So you want to shrink it and it shrinks very little. You can solve this by running following script.

USE your_db
DBCC SHRINKFILE(your_log, 200)
DBCC SHRINKFILE(your_log, 200)

The TRUNCATE_ONLY which we use and the NO_LOG options of the BACKUP LOG statement will be removed in a future version of SQL Server. These options remove the inactive part of the log without making a backup copy of it, and truncate the log by discarding all but the active log. This breaks the log chain. Until the next full or differential database backup, the
database is not protected from media failure. Therefore, we strongly recommend that you avoid using either of these options in new development work and that you plan to modify applications that currently use it.
Your transaction log is huge and has no free space.
First we need to find out why it’s in use.


Read Factors That Can Delay Log Truncation, this page explains the result.


Exit program in vb .net (application.exit)

Posted in Visual Basic .NET at 2:20 pm by

What methods are there?

  • System.Windows.Forms.Application.Exit() – Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed. This method stops all running message loops on all threads and closes all windows of the application. This method does not force the application to exit. The Exit method is typically called from within a message loop, and forces Run to return. To exit a message loop for the current thread only, call ExitThread. This is the call to use if you are running a WinForms application. As a general guideline, use this call if you have called System.Windows.Forms.Application.Run.
  • System.Environment.Exit(exitCode) – Terminates this process and gives the underlying operating system the specified exit code. This call requires that you have SecurityPermissionFlag.UnmanagedCode permissions. If you do not, a SecurityException error occurs. This is the call to use if you are running a console application.
  • End – (Visual Basic only) Terminates execution immediately. The End statement can be placed anywhere in a procedure to end code execution, close files opened with an Open statement, and clears variables at module and class level and all static local variables in all modules. The End statement calls System.Environment.Exit. The End statement stops code execution abruptly, without invoking the Finalize method or any other Visual Basic code. Object references held by other programs are invalidated. The End statement provides a way to force your program to halt. For normal termination of a Visual Basic program, you should unload all forms. Your program closes as soon as there are no other programs holding references to objects created and no code executing.

I want to close the application and I want to close it now

For instance you are handling an exception yourself and want the program to terminate immediately. Then you should do it with Environment.Exit(0)

You would like to exit your windows form based application in a clean way.

You are calling the routine from a menu item. You should use application.exit


Installing programs without a package manager.

Posted in Debian, Linux at 10:44 pm by

Installing programs without a package manager.

I have been a webmaster for about two years now. But webmaser doesn’t really describe my level of proficiency with managing a linux server.
Truth be told, I got my linux server with LAMP on it out of the box. So I had to install very little on it. It’s a webserver not a desktop.
And when I had to install stuff manually I just wgeted the tar file which was needed, prayed to the gods that be, and did the configure, make and make install.

Now I have a new web server and I’m installing it from scratch and while I was installing some un named obscure software. My friend, which I ‘ll hereafter refer to by the name of Payne, was watching my shell session so he could aid me. And when I did my configure, make, make install routine he uttered NOooooooooo. Turns out that installing it like that is just a bad practice. Many of the thousands of people who ‘ll read this will frown and be slightly stunned, isn’t that how most of the people are doing this?

The good

You should download the source do a

Explaining the debuild process is a bit large so I won’t get into it, but to summeraize it:
When you look at your software and you see a debian directory then it has already everything which is needed to turn it into a package with debuild.
You just launch debuild and when everything goes well you get a debian package in the parent directory.

The Bad

make install

What makes this bad is that you bypass the package management system. Which means that package management doesn’t know about the
software you just installed. Later on you can install the same software through the packet manager. Then you end up with 2 versions in 2 different locations. The make install method doesn’t take care of dependencies. When you want to uninstall libraries which your make install software depend on
you will get no warning. After you uninstalled it, you will be baffled to find out your ‘make install’ software stopped working. Last problem with this method is uninstalling of the software itself. Other software can depend on it. So when you uninstall this software you can run into the same trouble as mentioned before.

The Ugly

configure –sysconfdir=/etc –prefix /usr/xx
checkinstall -D make install

Answer the question ‘The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]:’ with ‘y’ .
Enter a description for your package.
Fill in what you like, need. In the end press enter to continue.

Your software is installed and a Debian package is created, you can find in the installation directory.
You can use this package on other pc’s
dpkg -i /path/to/software.deb

Uninstalling can be done by call the dpkg with -r parameter.

dpkg -r the_software

This is the ugly way because your package does not come with dependency checks nor does it come with our of the box init scripts.


Fix for iTunes 5002 Error

Posted in Miscellaneous at 4:11 pm by

Since upgrading to iTunes 7.3, I got the following error when searching iTunes Store for songs: “We could not complete your Music Store request. An unknown error occurred (5002).”

This problem is related to the iTunes shopping cart. To fix, go to edit/preferences/store, activate one-click shopping and press OK. The problem should now be fixed. If you want, you may also now re-enable the shopping cart.


Restarting services from a batch

Posted in windows at 2:33 pm by

When some of your servers are running services which leak memory, you’ll find yourself in the position where you are restarting these services all the time. A good admin will get tired off this very soon and look for a way to automate this.
Automating this is very easy. You can use the windows scheduled tasks to run a bat file.

The bat file has to contain something similar to this:

net stop "ASP.NET State Service"
net stop "FTP Publishing Service"
net stop "ReportServer"
net stop "World Wide Web Publishing Service"
net stop "Simple Mail Transport Protocol (SMTP)"
net stop "IIS Admin Service"

net start "IIS Admin Service"
net start "Simple Mail Transport Protocol (SMTP)"
net start "World Wide Web Publishing Service"
net start "ReportServer"
net start "FTP Publishing Service"
net start "ASP.NET State Service"

When restarting theses services you must lookout for dependencies tho. For instance in the above bat file the World Wide Web Publishing Service depends on the IIS Admin Service. this means you can’t restart the IIS admin Service when the World Wide Web Publishing Service is still running.


Install and config Proftpd on debian linux

Posted in Debian, Linux at 2:22 pm by

This is a small howto on getting a ftp server on your linux box. After we got it on the box we want to config it. The way we config it is far from a definite guide to security :) If you are concerned about security you should not run a common ftp server without sll encryption in the first place. The ftp protocol sends user/password in plain text! That is why I opt not to set the ftp server up with the normal shell logins but with a speparate file in which the ftp users and passwords are stored.
First get the package

apt-get install proftpd

This installs the ftpd server and even creates a default config located at /etc/proftpd.conf.

Open up this file with your favorite text editor. And add the following 2 lines.

SystemLog /var/log/proftpd/system.log
AuthUserFile /etc/ftpd.passwd
The SystemLog directive sets up logging to /var/log/proftpd/system.log. This is handy when you get errors  or want to audit the ftp server you can do it by checking this file.

AuthUserFile  sets up  the separate password file .

The server should be ok now. We only have to add users. On the shell go to /etc and execute the following commands.

mkdir /home/itkb

ftpasswd –passwd –name=itlk –uid=1002 –home=/home/itkb –shell=/bin/bash

You will be prompted for a password. Once you have done this you created a user itkb who can read files from /home/itkb.


Protected: Lotus notes Read mail

Posted in Miscellaneous at 2:52 pm by

This post is password protected. To view it please enter your password below:


Argument list too long.

Posted in Linux, RubyOnRails at 8:21 pm by

I was trying to delete all rails sessions of a site tonight and I encountered the following error:

Argument list too long.

The workaround is easy:

find . -name 'ruby_sess.*' | xargs rm

Voila, all those files are gone.

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »