List all triggers with SQL Server 2000

November 8th, 2010

Creating a SVN repository on a Synology DS210j NAS

October 2nd, 2010

In this step-by-step guide I am telling how I am creating repositories on my Synology DS210j NAS. It is assumed you have installed SVN using this guide provided by Synology. I am initially logging into the NAS using Putty. You have to enable the SSH Service under the Terminal section under the Network Services in DiskStation Manager 2.3. You can login using the root command. The password for this user is the same as the admin user. After logging in, you have to type the following command:

su svnowner

This will switch the current user to the user account running SVN. Move to the location of the repositories by providing the following command:

cd /volume1/svn

Then, type:

svnadmin create Example

to create a repository named Example. Navigate to the repository directory:

cd Example/conf

Modify the security settings for the file that contains the passwords for the users accessing the repository:

chmod 600 passwd

Now open an editor to edit the passwords file.

vi passwd

Go to the end of the document and hit shift+A.

Then add the following line, replacing the username and password with the username and password of your liking:

username = password

Now hit Esc and type:

:wq

followed by Enter.

Finally edit the svnservce.cnf file with the following command:

vi svnserve.cnf

Go to the general section and hit shift+A again. Add the following lines to disable anonymous login and specify which file contains the usernames and passwords.

[general]
anon-access = none
auth-access = write
password-db = passwd

Now hit Esc and type:

:wq

followed by Enter. You now have created and configured a new SVN repository on your Synology DS210j NAS.

Setting up RAID 1 using Synology Disk Station Manager 2.3 (DSM 2.3)

September 11th, 2010

In this article it is discussed how to set up a RAID-1 configuration using Synology Disk Station Manager 2.3, further referred to as DSM 2.3. Other RAID configurations are possible also, but are not illustrated here. In this short tutorial the DSM 2.3 is hostedon a Synology DS210j, but the DSM will work on other Synology NAS’ in a similar fashion. It is assumed that the NAS has already been configured properly and the next step is to create a volume. To do this, go to the section [Storage] and select [Volume Manager]. From here, start the [Volume CreationWizard].

Volume Creation Wizard - step 1

Then click [Next].

Volume Creation Wizard - step 2

Select the option [Custom] and click [Next].

Volume Creation Wizard - step 3

Select the option [Volume] and click [Next].

Volume Creation Wizard - step 4

Select all the available drives, two in picture above, and click [Next].

Volume Creation Wizard - step 5

A pop-up specifying that all data will be erased. Click [Yes] if you have secured all relevant data from the selected drives.

Volume Creation Wizard - step 6

Choose the proper RAID configuration. In this example RAID 1 is chosen, so the two disks will be mirrored. Other RAID configurations are also possible, but might require more disks (e.g. RAID 5) of offer higher performance, but no data protection in case of disk failures (e.g. RAID 0).

Volume Creation Wizard - step 7

If you are sure that the drives are fine, select the option [No] and click [Next]. This will save a lot of time during the initialization and preparation of the disks.

Volume Creation Wizard - step 8

Review the settings and, if everything is configured properly, click [Finish]. The wizard then closes and the file system is being created. This will take several minutes, depending on the size of the disks.

Using local cursors in SQL Server

September 7th, 2010

Below is a simple script that can be used in SQL Server 2000, SQL Server 2005 and SQL Server 2008 to create, initialize, use, close and deallocate a cursor. In this example the cursor is defined as a local cursor, so it can be used in code that is called simultaneously by different users, e.g. trigger code, stored procedures, and so forth.

DECLARE
  @localID

DECLARE Identifier CURSOR LOCAL FOR
SELECT
  Column_1
FROM
  TableIdentifier
WHERE
  — Filter

OPEN Identifier

FETCH NEXT FROM Identifier
INTO @localID

WHILE @@FETCH_STATUS = 0
BEGIN
  — Execute statements for the specific row
  — Fetch next record, if any.
  FETCH NEXT FROM Identifier
  INTO @localID
END

CLOSE Identifier
DEALLOCATE Identifier

Piriform Defraggler, defragmenting your hard drives (via schedules)

August 22nd, 2010

Use Defraggler to defrag your entire hard drive, or individual files. This compact and portable Windows application supports NTFS and FAT32 file systems. The software can be downloaded from:

http://www.piriform.com/defraggler

I installed the program and it works very intuitively. I first started the initial analysis of my primary system disk/partition, i.e. the one running Windows. After only a few seconds I received a nice overview of thefile system’s fragmentation. The analysis results in a nice color diagram.

Screenshot after disk is analyzed

How Defraggler presents the disk analysis

First drawback of the application is that I cannot see what the different colors mean. I am missing the legend explaining the different colors. But you already know that if a disk segment is red, this is not good and it most likely is fragmented. In the settings you can edit the legend and that is also a way to see what each individual color means.

Defraggler Legend

The legend for the drive map

After running the analysis you determine whether or not the file needs defragmenting. The application provides two defrag modes, i.e. [Defrag] and [Quick defrag]. I have never used the [Quick defrag], so I can only judge about the “regular” defrag mode. You can tweak all sorts of rules for the [Quick defrag] mode, but in my opinion you should just let the entire drives be defragmented, not skip some parts of it. The application provides two priorities. It can run as a background process or as a normal process. Even with running it as a normal process, I can still use my computer normally.

Defraggler provides many settings, among which scheduled defragmentation. I have set it to run once a month. I don’t believe that defragmenting my hard drive daily will greatly increase the running speed of my OS, so I do not run it more often than once a month. However, by setting the schedule, I do not even have to think about it anymore, I can simply trust on Defraggler to keep my drives maintained properly. The scheduling uses the Windows scheduled tasks, so the application is only started when it is actually scheduled to run.

Other nice features are(1)  shutting down after defragmenting, (2) excluding files, file types, drives or folders from the defrag process and (3) easily swapping the language for the interface. Also, Defraggler can defragment free disk space, so that the files are grouped together. I am not yet sure if this will increase or decrease performance, since placing all files behind each other will cause fragmentation when any of these files will increae. This will greatly lengthen the run of the defragmentation process, and I do not feel like it will improve performance, so I am not using that option.

In summary

My general opinion about Defraggler is that it is a great replacement for the defragment tool integrated into Windows. It offers many additional features like scheduling, excluding files, nice graphical user interface and so forth. I recommend using this application instead of the  tool integrated into Windows.