Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1031403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:55:27+00:00 2026-05-16T13:55:27+00:00

I am doing a large archival of data from one DB to another DB

  • 0

I am doing a large archival of data from one DB to another DB on a linked server. I am copying from MS sql server 2000 to MS sql server 2005.
This involves copying millions of records and then deleting them. This all happens via a dynamic script. I would like to incorporate the shrinking of the log file for this process, but I am unable to get the DBCC SHRINKFILE to work for the linked server. Is this even possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T13:55:28+00:00Added an answer on May 16, 2026 at 1:55 pm

    You should be able to do it by calling sp_executesql through the linked server:

    EXEC [LINKED_SERVER].MyDatabase.dbo.sp_executesql
        @statement = N'DBCC SHRINKFILE(''LogFileName'',0)'
    

    You should probably rethink automatically shrinking the log file, though, especially if this script will be run so often that you need to automate it. You’ll be better off backing up the log or switching the recovery model to Simple so you can reuse the space. (If it’s going to grow back to the same size, did you really accomplish anything by shrinking it? In fact, you can make things worse by inadvertently introducing filesystem fragmentation.)

    I’m not saying you never need to shrink a file programmatically, but wanting to do so is usually a sign something else is wrong — the disk is too small for your expected volume, you have the wrong recovery model, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing image processing in C that requires copying large chunks of data
I'm in the process of doing a large scale server migration, as such I
When doing calculations on very large numbers where integral data types such as double
I recently ran into major problems inserting records into a SQL Server backend from
I'm not doing anything overly complex I believe. I'm presorting a large csv data
I've never really had this error before but I am doing a rather large
I have a batch process that imports large amounts of data. I am doing
I am doing a project which deals with large amount of data. I am
In our application we are doing large amounts of inserts/updates (anywhere from 1k to
I'm doing a large join in mysql, and then acting on the resulting data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.