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
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
Post a Comment