TheDevTeam

  • Home
  • Services
  • Industry Sectors
  • Meet The Team
  • O&M manuals
  • Contact Us
  • +44(0)1424 442400
  • Request a call
We are bespoke software developers with over 22 years experience of making things work, we have a wide range of Web Development tools that we can rapidly bring to bear on any problem and are confident of delivering on our promises In many cases we have worked with our clients for over 10 years covering East Sussex and surrounding areas
  • 1
    Web

    Web Development

    Web Development from The Dev Team The websites and web applications that we build are more akin to bespoke software applications than traditional websites. They incorporate complex business logic and processes from stock control and fulfilment to CRM functionality and data manipulation tools.

  • 2
    Software

    Software Development

    Software Development from The Dev Team Whether it's websites, web applications, PC based software, services or server based software we've got tonnes of development experience going back more than 20 years.

  • 3
    PM

    Project Management

    Project Management from The Dev Team Project Management is all about having good tools to collaborate and a team able to deliver

  • 4
    Mapping

    Dynamic Mapping

    Dynamic Mapping from The Dev Team It's quick, easy and inexpensive (if you know how). One of the biggest advances over the last few years has been the ability for anybody to gather longitude and latitude information and then plot it onto maps. If you're not already doing it then contact us to find out how you can.

  • 5
    SEO

    Search Engine Optimization

    Search Engine Optimization from The Dev Team For most websites, being accessible to Google is probably the most important requirement. The only way that this can be done is to make it carefully thought out and integrated part of your website. If anybody phones up offering to get you to the top of the search engine rankings for a few hundred pounds, don't believe them.

  • 6
    Data Visualisation

    Big Data & Data Visualisation

    Big Data & Data Visualisation from The Dev Team The amount of data that we, as humankind, are collecting is increasing exponentially. If you know what to do with the data, as we do, it can also be turned into a vital competitive advantage and business critical information that makes a real difference....

  • 7
    E-Commerce

    E-Commerce

    E-Commerce from The Dev Team Shopping carts, online shops and taking payments online is one of the more standard implementations in a website but the choice available to you is huge. We can help you implement your online shop whether it's a 3rd party plugin or built from scratch. We've done it all!

  • 8
    Collaboration

    Collaboration Tools

    Collaboration Tools from The Dev Team The ability to work on the same documents, build specifications together, build projects together, share ideas and collaborate are essential for modern business. Effective collaboration is at the core of every project that we work on and we use a variety to tools and skill-sets to facilitate this.

  • 1
    Construction

    Construction

    Construction from The Dev Team Denaploy has been deeply involved in may aspects of the construction industry since its inception and has worked with Main Contractors, Sub-contractors, Architects, Surveyors and CDMCs. We understand the pressures of the industry and its sometime arcane vocabulary.

  • 2
    Property

    Property

    Property from The Dev Team There are over 22 million homes in the UK and we move once every six years on average throughout our lifetime. That's a lot of data and we deal with a good proportion of it.

  • 3
    NFP

    Not for Profit & Charities

    Not for Profit & Charities from The Dev Team We do a number of different projects for Charities and Not for Profit organisations. Most of the problems needing to be solved are still the same and it suits our skillset to have a more hands-on approach to the project management.

  • 4
    Publishing

    Publishing

    Publishing from The Dev Team We have been working with magazine distributors since the earliest days of the Internet to sell British magazines both locally in the UK and around the world. If you're after a fully integrated stock control and automatic ordering system or something as simple as data feed integration then look no further.

  • 5
    Blue Chip

    Blue Chip

    Blue Chip from The Dev Team We've worked with many blue chip companies over the last 20 years and continue to receive work on a regular basis underlying the fact that we are competitively priced and possess a skills that are hard to come by even for companies with thousands of employees.

  • 6
    International

    International

    International from The Dev Team The World is getting smaller by the day and the ability to work at a desk thousands of miles away is something we've been doing for years. Why let the logistics of getting from A to B get in the way of getting the software solutions you need when everything from meetings to deployment can be done remotely?

  • 7
    Mininingware

    Eclipse Mininingware

    Eclipse Mininingware from The Dev Team Our Eclipse Miningware Solution is a cost effective solution for any startup mining company.

  • 8
    Small Business

    Small Businesses

    Small Businesses from The Dev Team Even if you've got a small business then you can afford a big IT department because you'll be hiring our skills and services for a fraction of the time and therefore cost compared to hiring permanent staff.

  • 9
    Joint Ventures

    Joint Ventures

    Joint Ventures from The Dev Team One of the downfalls of working in IT is that everybody and his dog has an idea of how they're going to make a fortune with the Internet. They usually have no money to invest but they do know somebody in the industry who might listen. Sometimes they do listen....

The continuing evolution of the internet creates many business opportunities needing specialist IT skills.

That's where we fit in. We are a highly skilled collective who are more than a match for most blue chip companies internal IT departments.

We're here to make IT and the Internet work for you.

  • Knowledge Base
  • Physically shrinking SQL Transaction log files
                    
Share:
Written on 09 April 2014

Physically shrinking SQL Transaction log files

SQL
SQL

This post describes the process of shrinking the SQL transaction log file size, without using the ‘cheat’ method of switching the recovery mode from ‘full, to ‘simple’ and back to ‘full’ again, thus creating a hole in your transaction logs effecting database recovery.

To summarise the steps, we are going to

  • Locate the file_id or filename of the physical log file
  • View the status of the virtual log files
  • Backup the transaction log if required
  • Perform a shrink command, and view the results to determine any further actions

Locating the file_id

To perform a shrink you will need to know the file_id of the physical transaction log file. This can be done by querying the following within your database.

 

SELECT file_id, name, physical_name FROM sys.database_files;

 

Viewing virtual log status

Now we want to locate which virtual logs are in use by using the following command.

DBCC LOGINFO;

Here we can see the state of each virtual log contained within the log file. The Status column shows whether the virtual log is empty ’0′, or in use ’2′.

When shrinking files, the empty virtual logs are physically removed from the end of the file moving forwards until it hits the first virtual log in use. The SQL server does not always use virtual logs in physical sequence, which is why shrinking a transaction log file sometimes shrinks it part way, but does not remove all free virtual logs which you might expect. Subsequent shrinks will therefore not free any more space as the last virtual log will be in use, even though the log file itself could appear mostly empty.

 

Detecting if a Transaction log backup is required

If you notice any status 2′s that occur after 0′s, this is blocking the shrink from fully shrinking the file. To get around this do another transaction log backup, then immediately run the DBCC SHRINKFILE (file_id, LogSize_MB) command, supplying the file_id found above, and the size you would like your log file to be reduced to.

The below will attempt to shrink file_id 2 to 100MB, and then show the resulting virtual log allocation

DBCC SHRINKFILE (2, 100);
DBCC LOGINFO;

Hopefully you’ll notice that it’s been reduced somewhat. Because virtual logs are not always allocated in order, you may have to backup the transaction log a couple of times and run this last query again; but I can normally get it shrink down to the chosen size within two backups. The key is to do this straight after a transaction backup has occurred, thus reducing the chance that a virtual log will be assigned in an awkward place.


Related to Physically shrinking SQL Transaction log files

CIS and VAT

From the 1st March 2021 main contractors in the construction industry have to account for the VAT of their CIS subcontractors

Find out more

Source code recovery

Losing source code can leave you in a costly predicament. If the software is important, the cost of redeveloping it from scratch is extremely painful. We can ease the burden by recovering large parts of your lost code and giving you back control.

Find out more

Test your Admin efficiency

Can you see anybody in your offices who • Is manually re-inputting data that originated in one computer into another computer? • Is anybody using spreadsheets to record and report on regular activities? • Spending a lot of time updating the data in a standard report on a periodic basis? See why they shouldn't be doing that…..

Find out more

Using APIs to enhance your supply chain

Get the most value from your software by integrating their API (Application Programming Interface) into your in house applications.

Find out more

Grants for preparing for new Customs declarations

The government has made available £50m of grants to assist exporting companies to adjust to the new documentation requirements

Find out more

Knowledge Base

INEA

A website and bespoke database system for the Independent Network of Estate Agents, enabling Agents to work together in an MLS (Multi Listing Service)
Find out more

SQL Import tool Fails with converted OpenOffice Documents

The ‘SQL Server Import and Export Wizard’ can fail when trying to import a spreadsheet which was originally created by Open Office and converted by Excel into an Excel format.
Find out more

Advantages of Sub-contracting your Software development

Software development has become increasingly specialised, so only the largest companies can have all the skills necessary to be leading edge in all areas.
Find out more

SQL Copy-Only Backup

It is important that the 'Copy-Only Backup' option is used while performing one time backups for a database which has existing regular backup plans running.
Find out more

Address:
TheDevTeam
8 The Lawn,
St Leonards-On-Sea,
East Sussex, TN38 0HH

Email:
enquiries@thedevteam.co.uk

Phone:
+44(0)1424 442400

©2025 The Dev Team | Registered in England and Wales Company No. 000000

TheDevTeam CoPilot