DBCC SHRINKFILE on the distribution databaseIs it possible to shrink an .MDF file on a drive with low free space?Shrinking the log file does not reduce sizeStrange behaviour DBCC ShrinkfileShrink the database only up to its initial size which is set after creating databaseCannot drop distribution database in SQL Server 2012How to shrink the .ldf(log) file of the particular live production database?Need assistance shrinking MDF FileWhy did DBCC SHRINKFILE never complete but shrink successfully after cancellation?DBCC ShrinkFile not workingWhat is DBCC SHRINKFILE actually doing?
Fastest way from 10 to 1 with everyone in between
Past vs. present tense when referring to a fictional character
Harley Davidson clattering noise from engine, backfire and failure to start
Is there a term for someone whose preferred policies are a mix of Left and Right?
Dedicated bike GPS computer over smartphone
Why is it bad to use your whole foot in rock climbing
What's the reason for the decade jump in the recent X-Men trilogy?
How to search for Android apps without ads?
Does WiFi affect the quality of images downloaded from the internet?
Opposite of "Concerto Grosso"?
Why do the “Shtei HaLechem” not play a prominent part in the davenning for Shavuos?
Can Mage Hand be used to indirectly trigger an attack?
Why is my Taiyaki (Cake that looks like a fish) too hard and dry?
Why are backslashes included in this shell script?
What is the color associated with lukewarm?
Print "N NE E SE S SW W NW"
DBCC SHRINKFILE on the distribution database
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
Velocity of rotation of a sphere
Why is Skinner so awkward in Hot Fuzz?
My parents claim they cannot pay for my college education; what are my options?
Was the Lonely Mountain, where Smaug lived, a volcano?
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
How can religions without a hell discourage evil-doing?
DBCC SHRINKFILE on the distribution database
Is it possible to shrink an .MDF file on a drive with low free space?Shrinking the log file does not reduce sizeStrange behaviour DBCC ShrinkfileShrink the database only up to its initial size which is set after creating databaseCannot drop distribution database in SQL Server 2012How to shrink the .ldf(log) file of the particular live production database?Need assistance shrinking MDF FileWhy did DBCC SHRINKFILE never complete but shrink successfully after cancellation?DBCC ShrinkFile not workingWhat is DBCC SHRINKFILE actually doing?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have an .mdf file from distribution database which is growing.
I know the advantages and disadvantages of shrinking database/files.
Is it okay to shrink the .mdf file to some a smaller size.
Is there any data loss during this time and does this affect the replication.?
sql-server replication transactional-replication shrink
add a comment |
I have an .mdf file from distribution database which is growing.
I know the advantages and disadvantages of shrinking database/files.
Is it okay to shrink the .mdf file to some a smaller size.
Is there any data loss during this time and does this affect the replication.?
sql-server replication transactional-replication shrink
1
There would not be any data loss.
– Shanky
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
1
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago
add a comment |
I have an .mdf file from distribution database which is growing.
I know the advantages and disadvantages of shrinking database/files.
Is it okay to shrink the .mdf file to some a smaller size.
Is there any data loss during this time and does this affect the replication.?
sql-server replication transactional-replication shrink
I have an .mdf file from distribution database which is growing.
I know the advantages and disadvantages of shrinking database/files.
Is it okay to shrink the .mdf file to some a smaller size.
Is there any data loss during this time and does this affect the replication.?
sql-server replication transactional-replication shrink
sql-server replication transactional-replication shrink
edited 7 hours ago
Ramakant Dadhichi
1,117320
1,117320
asked 8 hours ago
user9516827user9516827
4581211
4581211
1
There would not be any data loss.
– Shanky
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
1
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago
add a comment |
1
There would not be any data loss.
– Shanky
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
1
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago
1
1
There would not be any data loss.
– Shanky
8 hours ago
There would not be any data loss.
– Shanky
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
1
1
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
You need to check WHY the distribution database is growing rather than trying to shrink. If there is no available free space inside the file then you will not be able to shrink it anyway.
Check for the retention period and any other reasons why the distibution database would be growing e.g. Replication is erroring out.Below blog would give some areas you can look into :
Distribution database growth
Answering your question exactly : Yes you can shrink the file ,given it has free space available.
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run thesp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = yand if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?
– user9516827
7 hours ago
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
add a comment |
It is ok to shink the datafile, there WON'T be any data loss.
The "issues" when shrinking could be performance, during the rellocation of data pages. Also if you know that your DF will grow again to the same size, shrink is not recommended. If it was because a one time only operation, or other stuff where the DF won't grow at the same big size again, it is ok to perform your shrink operation.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f240384%2fdbcc-shrinkfile-on-the-distribution-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to check WHY the distribution database is growing rather than trying to shrink. If there is no available free space inside the file then you will not be able to shrink it anyway.
Check for the retention period and any other reasons why the distibution database would be growing e.g. Replication is erroring out.Below blog would give some areas you can look into :
Distribution database growth
Answering your question exactly : Yes you can shrink the file ,given it has free space available.
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run thesp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = yand if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?
– user9516827
7 hours ago
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
add a comment |
You need to check WHY the distribution database is growing rather than trying to shrink. If there is no available free space inside the file then you will not be able to shrink it anyway.
Check for the retention period and any other reasons why the distibution database would be growing e.g. Replication is erroring out.Below blog would give some areas you can look into :
Distribution database growth
Answering your question exactly : Yes you can shrink the file ,given it has free space available.
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run thesp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = yand if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?
– user9516827
7 hours ago
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
add a comment |
You need to check WHY the distribution database is growing rather than trying to shrink. If there is no available free space inside the file then you will not be able to shrink it anyway.
Check for the retention period and any other reasons why the distibution database would be growing e.g. Replication is erroring out.Below blog would give some areas you can look into :
Distribution database growth
Answering your question exactly : Yes you can shrink the file ,given it has free space available.
You need to check WHY the distribution database is growing rather than trying to shrink. If there is no available free space inside the file then you will not be able to shrink it anyway.
Check for the retention period and any other reasons why the distibution database would be growing e.g. Replication is erroring out.Below blog would give some areas you can look into :
Distribution database growth
Answering your question exactly : Yes you can shrink the file ,given it has free space available.
answered 8 hours ago
Ramakant DadhichiRamakant Dadhichi
1,117320
1,117320
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run thesp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = yand if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?
– user9516827
7 hours ago
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
add a comment |
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run thesp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = yand if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?
– user9516827
7 hours ago
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
I have error in replication monitor in one of publisher/subscriber.The issue is on Distributor to subscriber.So i am trying to figure it out.Meanwhile can i turn off the Distribution agent so that the MSRepl_Commands don't get filled.?
– user9516827
8 hours ago
1
1
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
If you Stop Distribution agent, the log reader agent will still keep pushing data to for Distribution. You should stop the replication all together and check out for the actual issue. Once found,fix and re-enable.
– Ramakant Dadhichi
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run the
sp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = y and if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?– user9516827
7 hours ago
I understand what you are saying.I checked and MSRepl_Commands have 422 millions records.If i run the
sp EXEC dbo.sp_MSdistribution_cleanup @min_distretention = x, @max_distretention = y and if it removes the commands from the MsRepl_Commands table,then i would loose the changes that needs to be applied to subsciber since i have error in replication.Am i right?– user9516827
7 hours ago
1
1
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
sp_MSdistribution_cleanup is more of a retention thing. So it deletes things which have been replicated (distributed) to subscriber.
– Ramakant Dadhichi
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
One final question: If i disable the replication and enable it after a day ,do i loose all those transactions in between.?
– user9516827
7 hours ago
add a comment |
It is ok to shink the datafile, there WON'T be any data loss.
The "issues" when shrinking could be performance, during the rellocation of data pages. Also if you know that your DF will grow again to the same size, shrink is not recommended. If it was because a one time only operation, or other stuff where the DF won't grow at the same big size again, it is ok to perform your shrink operation.
add a comment |
It is ok to shink the datafile, there WON'T be any data loss.
The "issues" when shrinking could be performance, during the rellocation of data pages. Also if you know that your DF will grow again to the same size, shrink is not recommended. If it was because a one time only operation, or other stuff where the DF won't grow at the same big size again, it is ok to perform your shrink operation.
add a comment |
It is ok to shink the datafile, there WON'T be any data loss.
The "issues" when shrinking could be performance, during the rellocation of data pages. Also if you know that your DF will grow again to the same size, shrink is not recommended. If it was because a one time only operation, or other stuff where the DF won't grow at the same big size again, it is ok to perform your shrink operation.
It is ok to shink the datafile, there WON'T be any data loss.
The "issues" when shrinking could be performance, during the rellocation of data pages. Also if you know that your DF will grow again to the same size, shrink is not recommended. If it was because a one time only operation, or other stuff where the DF won't grow at the same big size again, it is ok to perform your shrink operation.
answered 8 hours ago
dbamexdbamex
1416
1416
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f240384%2fdbcc-shrinkfile-on-the-distribution-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
There would not be any data loss.
– Shanky
8 hours ago
@Shanky : This is the distribution database i am talking about and does this affect transactional replication i have in place?
– user9516827
8 hours ago
1
Shrinking may slow things but would not cause any loss. Do it when load is relatively very less
– Shanky
8 hours ago