Wednesday, June 25, 2014

Virtual Box - Error - starting VM shows "Couldn't read from the boot medium! System halted."

Environment
1. VirtualBox 4.3.12 (Windows)
2. Host operating system - Windows 2008 R2
3. Guest operating system - Windows 2012

Error description:
Copied the VM from another machine and tried to run the VM. In VM window, it shows error message "Couldn't read from the boot medium! System halted".


Solution-01Hard drive is not associated

Steps to follow - 
1. Select VM and go to settings
2. In the settings wizard, click storage from left navigation
3. At right side, under 'Controller: SATA", click "Add Hard Disk"
4. Point  to the hard drive which need to be associated to the VM



Virtual Box - Error - Cannot Access the kernel driver

Environment: Virtual Box 4.3.12 (windows)

Error description:
"Cannot Access the kernel driver! Make sure the kernel module has been loaded successfully."

Solution-01:
1. \Oracle\VirtualBox\drivers\USB\filter\VBoxUSBMon.inf - right mouse > install
2. \Oracle\VirtualBox\drivers\vboxdrv\VBoxDrv.inf - right mouse > install

Solution-02: this worked for me
1. Unistall VirtualBox
2. Restart machine
3. Install again VirtualBox



Wednesday, June 4, 2014

SQL Server - Setup - enable/disable SNAPSHOT isolation level

Environment:
1. SQL Server 2008

Background:
I need a script which would change isolation level to SNAPSHOT on current database. I tried to use CURRENT to make it work without much success. Instead used DB_NAME() built-in function to get the current database name and executed alter command as run time query.

Script snippet:

DECLARE @dbName VARCHAR(100) = '';
SELECT @dbName=DB_NAME();
IF ISNULL(@dbName, '') <> ''
BEGIN
DECLARE @cmd NVARCHAR(100) = 'ALTER DATABASE '+@dbName+'  SET ALLOW_SNAPSHOT_ISOLATION ON';
EXECUTE sp_executesql @cmd;
END;
GO


Helpful commands:


To enable:
ALTER DATABASE ABC SET ALLOW_SNAPSHOT_ISOLATION ON;

To disable:
ALTER DATABASE ABC SET ALLOW_SNAPSHOT_ISOLATION OFF;


How to check database isolation settings:
SELECT name
        , s.snapshot_isolation_state
        , snapshot_isolation_state_desc
        , is_read_committed_snapshot_on
        , recovery_model
        , recovery_model_desc
        , collation_name

FROM sys.databases s