I need to move few DB files to another location on same server due to low disk space. Replication is present with that DB and this scenario is on subscriber server. Is there any way to do this without doing reconfiguration?
Sql-server – How to change DB file location with Replication
sql serversql-server-2008
Related Question
- Sql-server – Is it possible to shrink an .MDF file on a drive with low free space
- SQL Server – Replication Breaks After DBCC CheckDB with Allow Data Loss on Primary
- SQL Server 2012 – How to Change Location of Database with Merge Replication
- Sql-server – Replication DB move
- SQL Server Replication – Move Transactional Replication Subscriber to Another Server Without Re-Snapshotting
- Sql-server – Snapshot Folder Location for Replication with Clustered Instance
- Sql-server – How to change entire SQL server location from C:\ program file to another drive
Best Answer
Here's how I'd do it:
alter database [foo] modify file (name = 'foo_1', filename = 'new location here'
) statementsalter database [foo] set offline
(you'll have to kill any active spids in the db or wait for them to finish their business)alter database [foo] set online
If you want to be really clean about this, you can stop the distribution agent while the database is offline and restart it when it's back online. But that's not necessary. Just so you know, I've also done this with a distribution database and would imagine that it would work fine with a publisher, too.