Msg 3154, The backup set holds a backup of a database other than the existing database

This is a repost of a post from an old blog, made on March 15, 2012, that used to be on:

Original post:

I got asked for help today at work by a coworker who got the following error when trying to restore a database to a different already existing database:

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing ‘database_name’ database. (Microsoft.SqlServer.Smo)

when trying to restore with script he would get something like this:

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing ‘database_name’ database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

The solution for this is simple: you need to add WITH REPLACE option when restoring.

If you’re using script it should look something like this:

RESTORE DATABASE [database_name] FROM  DISK = N'C:\some_directory\backup.bak' WITH  FILE = 1,  NOUNLOAD,  STATS = 10

If you’re using GUI you need to mark the on the Options section.

Hyper-V server Event ID 3112: The virtual machine could not be started because the hypervisor is not running – How to fix

This is a repost of a post from an old blog, made on March 25, 2012, that used to be on:

Original post:

Today I was encountered with a problem with one of the computers that was running Windows Server 2008 R2 with Hyper-V. When I would try to start any of the virtual machines installed on it I would get the following error:

The virtual machine could not be started because the hypervisor is not running

I instinctively checked the BIOS if VT is enabled and it was.

When looking in the Event Viewer I would see Event ID 3112 so I started looking the Technet for other possible errors on that ID.

The problem for me was in BCD and Intel VT-d (Intel Virtualization Technology for Directed I/O), I needed to enable VT-d and put hypervisor in Boot Configuration Data to autolaunch with the following command (you need to runa cmd as an Administrator with elevated privileges):

bcdedit /set hypervisorlaunchtype auto

Here is a little checklist if you get this kind of error:

  1. Check if Intel VT or AMD-V hardware extensions are supported on your CPU and are enabled in BIOS
  2. Check if No eXecute (NX) for AMD and eXecute Disable (XD) for Intel CPU are enabled in BIOS
  3. Check your BCD with bcdedit (the problem with me was, that it was a classroom computer with dual boot Windows 7/Server 2008, and the BCD was changed with Win 7 reinstallation)
  4. Check if Intel VT-d is and Trusted Execution enabled/disabled (This one is little strange to me, because if you look here it states it needs to be disabled, but for me I had to enable VT-d in BIOS)
  5. Check if you enabled Hibernation or Sleep on your server, it changes your “hvboot” registry value. Try to start it in elevated Command Prompt with command:
  6. net start hvboot

Hope this helps somebody, because I got a little frustrated with this error today

FortiGate and iPad dial-up VPN IPsec phase 2 error: no matching gateway for new request

This is a repost of a post from an old blog, made on July 12, 2012, that used to be on:

Original post:

I was asked at work to connect the iPad of one of the employees to our company VPN on FortiGate and it took me some time to set it up right.

I was always getting “The VPN server did not respond” message on the iPad when trying to connect to the IPsec VPN. At the same time the log on the FortiGate would get IPsec phase 2 error messages with negotiate_error as Status and “no matching gateway for new request” as error reason.

After some searching on Google it turned out to be the problem with the peer ID settings on FortiGate and Group Name settings on iPad, they were not matched.

The group name on the iPad must match the peer ID on FortiGate, In my case that meant that my group name on iPad had to be the same as the username, because on Fortigate I had set the IPsec Phase 1 to accept peer ID from the dialup group.

So if you are having problems with setting the IPsec VPN between iPad or iPhone and FortiGate, and are having the same errors as me try one of these as solution:

  • either change your Phase 1 so it accepts any peer ID
  • either change your iPad group name in IPsec config to match the username you are using, if your Fortigate is set to accept peer ID in dialup group
  • either set Phase 1 on Fortigate to accept specific peer ID, for example “ipad” and set that as the group name on you iPad

Here is a Fortinet article on setting the iPhone and iPad Dialup User IPSec VPN

Add sidebar in WordPress Twenty Eleven single post pages

This is a repost of a post from an old blog, made on January 3, 2012, that used to be on:

Original post:

The big disappointment to me was the fact that on single-post pages you don’t get to have sidebars, which made the page really odd looking  to me, so I started looking how to add it through the editor directly in code of the pages.

I looked through several sites and blogs that tell you how to do that but then found that there’s no need to add any child themes or make any modification through the editor.

There is a simple WordPress plugin that lets you do that with only a few clicks:

Twenty Eleven Theme Extensions

Once you install it and activate it you will get Theme Extensions option under the Appearance section which lets add sidebar widget to single-post pages and pages, plus a few other options.

Hope that helps someone.

Common FortiClient SSL VPN errors

This is a repost of a post from an old blog, made on July 13, 2012, that used to be on:

Original post:

I see from the stats that one of the posts with the most visits is the one about the FortiClient SSL VPN error “the vpn server may be unreachable. (-5)” so i decided to add another post describing some of the most common errors that may come up when connecting to FortiGate with SSL VPN.

  1. Connecting process stops at 10, error “Unable to establish the VPN connection. The VPN server may be unreachable.”

    This is most commonly caused by, either the firewall blocking any kind of traffic towards the VPN server IP address or the FortiClient application itself by the firewall on the host or on the network, or either by routing errors towards the IP address of the VPN server.
    The problem can usually be solved by adjusting the host or network firewall rules on the client side.
    Sometimes in rare cases I have found the problem is caused by error on the FortiGate device, in this case no one is able to connect to the VPN neither using SSL VPN or IPsec but the internal networks can go to all local networks and the external internet connection. In that case a simple reboot of the device solves the problem.
  2. Connecting process stops at 80, error “Unable to logon to the server. Your username or password may not be configured properly for this connection. (-12)”

    As the error states itself the most common problem is that either the username or the password isn’t matching the one of the device.
    Other problems might be:
    – the user is not in the correct user group that has VPN access (either the local firewall group or the LDAP server group if you’re using one)
    – there isn’t a corresponding firewall policy rule that allows access for the user group to any of the internal networks. You need to have the rule from the wan interface to one of the internal interfaces with action SSL-VPN and select the group of users which will have access, check if your user is in correct group.
    – you might be trying to connect to VPN from the wrong side of the interface (from one of your internal networks or from the network of one of the sites you already have a site to site connection.
    – UPDATE: Special characters are being used in the password. (See this serverfault thread)
  3. Connecting process stops at 40, error “Unable to establish the VPN connection. The VPN server may be unreachable -5”

    As you can see in one of my earlier posts “the vpn server may be unreachable. (-5)”,  the problem can sometimes be caused by some sort of VNC server on the machine.
    Other possible problems can be:
    – the firewall rules on local machine, or on the network gateway ( I have rarely found      this to be the problem with this error)
    – problems with the FortiGate device, in most of the time the device would be the problem and the problem would go away after the reboot of the FortiGate device, but would come again after the few days. In this case the problem would most of the time be with the extensive logging of the traffic and the events on the device. So try to remove  traffic logging on some of the rules or events.