Manchester Web Design & SEO Specialists


Happy New Year from Web Vitality!

• posted by Chris Buckley on Sunday, 3 January 2010 16:50
2010? That's so ummm futuristic. At least it seemed that way a decade or so ago. Time really does fly quick doesn't it. After all, when Stanley Kubrick made his film "2001: A Space Odyssey", it was set in a time far, far away, but now we've moved on even further ahead!

We're full of energy and enthusiasm about the future here, and we're packed full of new ideas, new projects and a new commitment to deliver the very best that we can.

If you want to keep up to date with the latest happenings at Web Vitality HQ, why not subscribe to our blog. This way you'll receive updates on our latest posts and you won't miss an ounce of the action.

We hope you all had a fantastic 2009, and wish everyone the very best for the new decade.

For something to ponder, give a thought to this. We've had the sixties, seventies, eighties, nineties, and we've just moved out of the noughties. However, what will we name the current decade?  The tensies? The teensies? Answers on a postcard :) We just can't decide here.

Labels: , , ,

SQL Server 2008 Web Maintenance Plans

• posted by Editor on Friday, 27 November 2009 10:52
If you're trying to setup a Maintenance plan in SQL Server 2008 Web Edition then read this article! It's not possible because SQL Server Integration Services does not come with Workgroup or Web Editions of SQL Server 2008.

If you naively setup a plan and try to execute it you will see an error message in the event logs stating:

"SQL Server Scheduled Job 'Web Vitality.Subplan_1' (0x0A776D635B886345B458F02C9D9877A1) - Status: Failed - Invoked on: 2009-11-27 08:28:55 - Message: The job failed. The Job was invoked by User XXXXXX\Administrator. The last step to run was step 1 (Subplan_1)."

However, it is possible to create SQL Agent Jobs with T-SQL scripts (Transact-SQL). For example, to add a job which will backup all databases, open the SQL Server Management Studio, right click on the SQL Server Agent and select 'New' then 'Job' and give the job a suitable name. Select the 'Steps' option and add a new step with the following T-SQL script (this will create a directory for each database in a folder located at C:\SQL_Backups):

DECLARE @basePath varchar(300);
SET @basePath = N'C:\SQL_Backups\';

DECLARE @db sysname;
DECLARE user_db_cursor CURSOR FOR
SELECT name FROM sys.databases WHERE name NOT IN ('master', 'model', 'msdb', 'tempdb')
OPEN user_db_cursor
FETCH NEXT FROM user_db_cursor
INTO @db

WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @backupPath varchar(1000);
SET @backupPath = @basePath + @db + '\';

DECLARE @backupName varchar(1000);
DECLARE @time datetime2;
SET @time = SYSDATETIME();
SET @backupName = @db + '_backup_' + REPLACE(REPLACE(REPLACE(CONVERT(varchar, @time, 20),'-','_'),':',''),' ','_')
+ '_' + CAST(DATEPART(NANOSECOND, @time)/100 as varchar)

--Create sub-directory
EXECUTE master.dbo.xp_create_subdir @backupPath

DECLARE @backupFileName varchar(1000);
SET @backupFileName = @backupPath + @backupName + '.bak';

--Backup database
BACKUP DATABASE @db TO
DISK=@backupFileName
WITH RETAINDAYS=14, NOFORMAT, NOINIT, NAME=@backupName,
SKIP, REWIND, NOUNLOAD, STATS=10

FETCH NEXT FROM user_db_cursor
INTO @db

END
CLOSE user_db_cursor
DEALLOCATE user_db_cursor

Labels: , ,