четверг, 20 сентября 2012 г.

Модели востановления

Просмотр текущей модели восстановления
SELECT name, recovery_model_desc 
   FROM  sys.databases
Изменение модели восстановления
ALTER DATABASE  
   SET RECOVERY FULL | SIMPLE | BULK LOGGED

понедельник, 10 сентября 2012 г.

The error

The error occurs when i want to execute the following statement:

EXEC sys.sp_cdc_enable_db

It returns this error:

Could not update the metadata that indicates database AdventureWorks2008R2 is enabled for Change Data Capture. The failure occurred when executing the command 'SetCDCTracked(Value = 1)'. The error returned was 15517: 'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'. Use the action and error to determine the cause of the failure and resubmit the request.

Solution
Execute the following statements:
USE AdventureWorks2008R2
GO
EXEC sp_changedbowner 'sa'
and the database owner changes to sa

link


понедельник, 3 сентября 2012 г.

Enable and Disable Change Data Capture (SQL Server)


Enable and Disable Change Data Capture (SQL Server)


Enable Change Data Capture for a Database
-- ================================
-- Enable Database for CDC template 
-- ================================
USE MyDB
GO
EXEC sys.sp_cdc_enable_db
GO


Disable Change Data Capture for a Database
-- =================================================
-- Disable Database for Change Data Capture template 
-- =================================================
USE MyDB
GO
EXEC sys.sp_cdc_disable_db
GO