debugsqlMinor
Transaction Log won't shrink, DB thinks it is replicating
Viewed 0 times
logreplicatingthinksshrinktransactionwon
Problem
I've got a SQL Server 2008 R2 Express database running Kaspersky Security Center, and I have no idea under what circumstances the install happened, but the database appears to think that it's being replicated and will not free any space from the transaction log. e.g.:
returns:
Also there's nothing listed in the
So far I've tried a couple statements gleaned from Google results:
But I've had no luck in getting this DB to stop thinking it's being replicated.
Full
`+-----------------------------------+------------------------------------------------------------+
| name | KAV |
| database_id | 5 |
| source_database_id | NULL |
| owner_sid | 0x0105000000000005150000004EB006B0C3554AB049CEA01BE8030000 |
| create_date | 2013-07-04 10:31:28.947 |
| compatibility_level | 90 |
| collation_name | Latin1_General_CI_AS |
| user_access | 0 |
| user_access_de
USE master;
SELECT
name, log_reuse_wait, log_reuse_wait_desc, is_cdc_enabled
FROM
sys.databases
WHERE
name = 'KAV';
SELECT DATABASEPROPERTYEX('KAV', 'IsPublished');returns:
name | log_reuse_wait | log_reuse_wait_desc | is_cdc_enabled
-----|----------------|---------------------|---------------
KAV | 6 | REPLICATION | 0DATABASEPROPERTYEX('KAV', 'IsPublished')
----------------------------------------
0 [not published]Also there's nothing listed in the
Replication section in SSMS.So far I've tried a couple statements gleaned from Google results:
USE KAV;
EXEC sp_repldone null, null, 0,0,1;
EXEC sp_removedbreplication KAV;But I've had no luck in getting this DB to stop thinking it's being replicated.
Full
sys.databases info:`+-----------------------------------+------------------------------------------------------------+
| name | KAV |
| database_id | 5 |
| source_database_id | NULL |
| owner_sid | 0x0105000000000005150000004EB006B0C3554AB049CEA01BE8030000 |
| create_date | 2013-07-04 10:31:28.947 |
| compatibility_level | 90 |
| collation_name | Latin1_General_CI_AS |
| user_access | 0 |
| user_access_de
Solution
Solution for restoring a published database
We faced a similar problem: A published database is stored on Server1. Every day this database will be backed up and restored on Server2.
LOG full due to REPLICATION
Solution
After restoring the database enable publication and remove it:
We faced a similar problem: A published database is stored on Server1. Every day this database will be backed up and restored on Server2.
- We frequently got error messages:
LOG full due to REPLICATION
log_reuse_wait_descwas set toREPLICATION.
- Replication could not be removed, because this database was not published on Server2.
Solution
After restoring the database enable publication and remove it:
USE MyDatabase
GO
-- 1.) enable publication for MyDatabase
EXEC sp_replicationdboption
@dbname = 'MyDatabase',
@optname = N'publish',
@value = N'true';
GO
-- 2.) remove publication from database. Use the PUBLICATION-name (not database name)
sp_removedbreplication 'Publ_MyDatabase','both'
-- 3.) disable publication for MyDatabase
EXEC sp_replicationdboption
@dbname = 'MyDatabase',
@optname = N'publish',
@value = N'false';
GO
-- Verify: log_reuse_wait_desc should have changed from REPLICATION to NOTHING
SELECT name, log_reuse_wait_desc, * FROM sys.databases WHERE name = 'MyDatabase'Code Snippets
USE MyDatabase
GO
-- 1.) enable publication for MyDatabase
EXEC sp_replicationdboption
@dbname = 'MyDatabase',
@optname = N'publish',
@value = N'true';
GO
-- 2.) remove publication from database. Use the PUBLICATION-name (not database name)
sp_removedbreplication 'Publ_MyDatabase','both'
-- 3.) disable publication for MyDatabase
EXEC sp_replicationdboption
@dbname = 'MyDatabase',
@optname = N'publish',
@value = N'false';
GO
-- Verify: log_reuse_wait_desc should have changed from REPLICATION to NOTHING
SELECT name, log_reuse_wait_desc, * FROM sys.databases WHERE name = 'MyDatabase'Context
StackExchange Database Administrators Q#83894, answer score: 9
Revisions (0)
No revisions yet.