Tuesday, October 8, 2013

How to restart an unresponse Windows VM from the command line in Citrix xen server

If you have tried to restart or force restart a windows VM from the Citrix console and it does not work you can follow this procedure to make sure it restarts.

Run xe-toolstack-restart from the command line and it will show the virtual machine running state. In this case the virtual machine is not responding.

The dom-id associated with the vm is unresponsive in the xenserver control domain.
You can recover by terminating the dom-id for the virtual  machine or reboot the xen server.

This is the procedure as listed in http://support.citrix.com/article/CTX131421
  1. Run the following command to check the dom-id of the virtual machine in the XenServer control domain:
    list_domains | grep

    Following is a sample of the preceding command:
    [root@Xen6 ~]# list_domains | grep bcdb1445-1f28-9600-ae84-53c254167ae6
    Output :
    51 | bcdb1445-1f28-9600-ae84-53c254167ae6 | H
    51 – the dom-id of the VM
    bcdb1445-1f28-9600-ae84-53c254167ae6 – UUID of the VM
    H – state of the virtual machine (H indicates that this is a HVM guest, typically it means this is a Windows virtual machine.)
    Refer to the Knowledge Center article CTX127896 – How to Use the XenServer Xentop Utility for more information about the other possible Virtual Machine states.
  2. Run the following command to destroy the dom-id of the virtual machine:
  3. destroy_domain –dom-id
  4. Following is a sample of the preceding command:
    /opt/xensource/debug/xenops destroy_domain –domid 51

Monday, October 7, 2013

How to change the owner of a SQL database when the owner has been removed.


On a  server some of the databases are inaccessible to the SA user.
This requires running this command to see who the owner is

sp_helpdb DBNAME

Once you know how to change the owner just run this to change the owner to the SA and you can then perform the admin you require


USE dbname
EXEC sp_changedbowner 'SA'