2011/01/19

How to backup SQL Server 2008 Express

I’m facing a lot of situations where customers prefer to use a bunch of free SQL Server 2008 Express or SQL Server 2005 Express Editions - mostly installed by every Client-Server-App they use - instead of using a paid but more powerful SQL Server.  The last time I had to use an Express Edition and implemented the backup for the databases I took the time to review my SQL backup script.
 
How to backup SQL Server 2008 (Express Edition) using the command line - the whole script is downloadable below:
  • Adjust the parameters within the sql file:
    • @BACKUP_PATH = <Backup target path> - the path where the sql server creates the media set for the backup
    • @MEDIASET_PREFIX = <Backup filename prefix> - Used to give backups meaningful names. The files get automatically a timestamp attached.
    • @RETENTION = <number of backups to keep> - Specifies the of backup sets to keep.

  • Call sqlcmd from a command line or trigger a batch job calling sqlcmd and pass through the sql script doing the backup for you:
sqlcmd -i <sqlfile> -o <logfile>

-i <sqlfile>: this sql-file to be executed
-o <logfile>: a log file for stdout redirection
Whats done within the sql script (You don't need to care about this - everything is put into the script):
  • Create a media set
EXEC sp_addumpdevice @devtype, @logicalname,@physname

@devtype: In our case set to 'disk' as we do a backup to disk not to tape.
@logicalname: the name of the mediaset created using the defined @MEDIASET_PREFIX and the current timestamp
@physname: the path and filename of the mediaset, simply the backup file
  • Iterarte through all online databases - offline databases cannot be backed up and do a backup to the created media set
DECLARE databaseNamesCursor CURSOR FOR
    SELECT 
        name
    FROM
        master.dbo.sysdatabases
    WHERE
        name != 'tempdb'
        AND DATABASEPROPERTYEX(name, 'Status') = 'ONLINE'
OPEN databaseNamesCursor;

FETCH NEXT FROM databaseNamesCursor INTO @databaseName;

WHILE @@FETCH_STATUS = 0
BEGIN
    /* create a backup of the current database*/
    BACKUP DATABASE @databaseName TO @mediaset;
    FETCH NEXT FROM databaseNamesCursor INTO @databaseName;
END

CLOSE databaseNamesCursor;
DEALLOCATE databaseNamesCursor;
  • Delete not needed backups 
sp_dropdevice @logicalname, @delfile='DELFILE'

@logicalname: the name of the mediaset to delete
@delfile: if set to 'delfile' the physical file behind the mediaset will be deleted


Download the files: 
- link broken, suggest  you send me an email if you need the scripts -

2011/01/10

The owner () of job does not have server access.

New week new troubles: SnapManager SQL created some backup jobs within the SQL Server 2005 - the job itself could not be run/executed.

The owner (...) of job <Job Name> does not have server access.

This strange behaviour i got only with SQL Server 2005. With SQL Server 2008 i could not reproduce it.  The user who created the job and was the owner of the job had SQL sysadmin role assigned. I found some hints to this behaviour: a restart of the SQL Server Agent should work. In my case i didn't work that easy. 

If i change the owner of the job to the builtin user sa the job is able to run...

It would be nice to understand the issue....

2011/01/06

Can’t create a new Receive connector after installing Update Rollup 1 for Exchange Server 2007 Service Pack 3

Recently i had to migrate Exchange Server 2007 to another host. I installed the latest release with SP3 included and ran the install of the Update Rollup 1 for Exchange Server 2007 Service Pack 3. Pretty easy straight forward until i tried to create a new Receive Connector
  

Error:
Active Directory operation failed on xxxx.local. This error is not retriable. Additional information: The parameter is incorrect.

Active directory response: 00000057: LdapErr: DSID-0C090C26, comment: Error in attribute conversion operation, data 0, v1772
The requested attribute does not exist.


I longer research took me to the hint - i didn't expect that comming with a Service Pack - that you have to extend the AD schema prior installing Exchange Server 2007 SP3[1]:

If you want to run the Setup program in upgrade mode to perform an in-place upgrade from a beta version of Exchange 2007 SP3, you must first prepare Active Directory and the domains. 


Download the Service Pack 3  again or like in my case use the install media including the SP3 and run Setup.com /PrepareSchema agains the schema master. This should fix the LDAP errors.


2010/12/17

Host CPU is incompatible...

Ups... i forgot somethign basic: If i power on a Windows 2008 R2 virtual machine within a ESX testing environment i get the following error:

Host CPU is incompatible with the virtual machine's requirements at CPUID level 0x80000001 register 'edx'.
Host bits: 0000:1100:0001:0000:0000:1000:0000:0000
 Required: xx1x:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
Mismatch detected for these features:
* Longmode; required when a virtual machine is configured for a 64-bit guest OS. For systems with Intel CPUs, enabling VT in the BIOS is required for longmode support.
 
For incompatibilities other than NX/XD or longmode: if possible, use a cluster with Enhanced vMotion Compatibility (EVC) enabled; see KB article 1003212. In the absence of EVC, see KB article 1993.

The solution is so simple that i forgot it the second time during the last months: Enable "virtualisation technology" and "Execute Disable" within the servers bios. After a reboot you should be able to power on the VM.

2010/12/16

SnapManager SQL RPC error on initial configuration wizard setup

 If you get the following error during the initial configuration wizard you should verify if all required SQL Server services are running even if the databases are running fine. Some of the services are set to manual start by default.

[SQL-DMO API Error]: The RPC server is unavailable

2010/12/14

Dell iDRAC 6 IP port requirements

I got a "connection failed" error if i opened the console redirection within the Integrated Dell Remote Access Controller 6 (iDRAC6)  of a customers server. Two days ago i was able to get the connection.


Solution simple: The firewall between me and the server was turned on yesterday, so that the port for the redirection got blocked: 


If you check the dell manuals (support.dell.com) you'll find these default ports used by the iDRAC:


  • 80 (HTTP) 
  • 443 (HTTPS)
  • 22 (SSH)
  • 23 (Telnet)
  • 161(SNMP)
  •  5900, 5901 (Console Redirection)

2010/12/06

SnapManager VI fails to create snapshots

Currently troubleshooting the backup of a brand new VMware 4.1.0 installation... 

VMware shows up with the following error:

Cannot create a quiesced snapshot because the create snapshot operation exceeded the time limit for holding off I/O in the frozen virtual machine

After some research[1][2] i found a hint to follow these steps:
  1. Backup the following regkey: _HKLM\Software\Microsoft\EventSystem _
  2. Erase the regkey HKLM\Software\Microsoft\EventSystem{26c409cc-ae86-11d1-b616-00805fc79216} an below
  3. Reboot
  4. Verify that things are working by running

Even if it might worke well you never should follow these steps!


Better: Uninstall the VMware Tools and Reinstall them using the custom installation option. Disable the VMware VSS provider component and retry the backup.


----
[1] http://communities.vmware.com/docs/DOC-11987
[2] https://kb.netapp.com/support/index?page=content&id=2014932