Script to backup Cognos content store from sql server express

I like to have the Cognos content store setup on sql server express for couple of reasons
a)  No need to involve DBA's
b) Easy to maintain and schedule backup's.
c) No need for reboots or outage monitoring /alerts from other groups.

Cons:
a) Not accepted as a production content store as Cognos doesn't support the express version and also not a corporate standard.

So I have DEV and UAT on SQL server Express 2005.
Here is the script that you can automate to take regular backups at database level.(from within cognos you can do a full export of CS)


DECLARE@cursor AS CURSOR DECLARE@dbname
@query
AS VARCHAR(50), AS VARCHAR(200) SET@cursor = CURSOR SCROLL FOR SELECT NAME FROM MASTER.dbo.Sysdatabases WHERE NAME IN ( 'COG_84_CS') OPEN@cursor FETCH
NEXT
FROM @cursor INTO @dbname WHILE@@FETCH_STATUS = 0 BEGIN SET
TO DISK = ''C:\DBbakup\'
@query = 'BACKUP DATABASE '+ @dbname +' + @dbname+'_20'+ convert(varchar,getdate(),2)+'.bak ''WITH INIT' EXEC(@query) FETCH NEXT FROM @cursor INTO @dbname END CLOSE@cursor DEALLOCATE@cursor

Comments

Popular posts from this blog

Query Cognos 8/10 Content Store

Cognos 8/10 CAMID-User ID/LDAP ID report

Cognos Cross-tab Report Studio Report Ungroup Items to display as list on every line