How to Perform Database Repairs

From TrainzOnline
Revision as of 07:51, 6 November 2023 by Pware (Talk | contribs)

Jump to: navigation, search
The information in this Wiki Page applies to TANE, TRS19, Trainz Plus and TRS22.
This guide will take you through the process of performing manual database repairs and clean database installs. Trainz will automatically perform database repairs when it detects corruption in the Trainz database but sometimes a manual repair or even a manual clean install of the database is required.

Contents

  Top   Next Down Bottom

What is the "Trainz Database"?

BlueDot10x10.png The Trainz Database contains all the installed assets
In the earliest Trainz versions all the assets that came installed with Trainz, or that you installed from the DLS or downloaded as .cdp files, were stored as separate folders on your designated data drive. This made it easy to access the assets for editing and other operations. However the penalty was that each time you started Trainz it had to scan the assets to check their integrity and the more assets you had the longer the startup took. This led to a great many complaints from users.

Today, all installed Trainz assets are added as records in an asset database which has significantly sped up the startup process and has reduced the possibility of accidental data corruption by users. The penalty is that users can no longer access the installed assets by using Windows Explorer. Access to the assets in the database for editing and examination is through the Content Manager program.

Because it is a database manager, Content Manager also provides users with many more search, display and management options than were ever previously possible. Each entry in the display shown below is a single record in the Trainz database. Each entry can be easily opened for editing, it can be deleted, copied (cloned) and updated. New assets can be manually created or installed from other sources.


DBR EDBR20.png


  Top Next Up Next Down Bottom

Why Would a Database Repair (DBR) Be Needed?

A Quote from N3V

     "In terms of DB repairs, it should only be necessary if the program is updated or crashes. My understanding of the additional repairs are for things that are done outside the program function [i.e. outside of Content Manager and Surveyor] (like manually adding content into the local data folder) so in that case the db repair 'discovers' the new content".
When Trainz is operating there is a great deal of database activity going on with records being opened and closed, and data being read and written. Corruption of the data is always possible, particularly if the power supply is interrupted or the program is suddenly terminated (a "crash") while records are open or being written. For this reason, Content Manager comes equipped with automatic and manual database repair tools.


PencilTips.PNG A common, but not exclusive, cause of database problems and even CTDs (crashes to desktop) may be your antivirus program. Everytime Trainz accesses the database your AV program may perform a scan of the database.

Adding TANE.exe, TRS19.exe and TRS22.exe to your AV programs real time scan exclusion list can potentially resolve many of these issues by preventing the AV from accessing the database.


  Top Next Up Next Down Bottom

How to Perform a Database Repair (a DBR)

BlueDot10x10.png A DBR performs a "surface scan" of the database detecting missing content and content errors. It will update your database and can clean up some corrupted data.


This is the simplest and (usually) the fastest option.

NotePad.PNG Notes:

Perform a DBR if you have:-

DotPoint.JPG unexpected problems with missing content
DotPoint.JPG content errors with installed assets (particularly if those assets did not previously show any problems)
A DBR updates your database, revalidates the content and can often clear up any corruption that has occurred.
PencilTips.PNG If you have installed a new asset that Content Manager reports has having missing or unknown assets then a DBR is very unlikely to find those missing assets.


Steps:
DotPoint1.JPG Open the Developer Menu
From either the Launcher (below left) or Content Manager (below right) open the Developer menu and select the Rebuild Database option
DBR EDBR01.png DBR EDBR02.png
The process will proceed automatically and unaided through a number of steps, only some of which are shown below. The time required for each step will vary enormously (some will take much longer than others) and the total time involved will depend on the number of assets installed, the speed of your system and other factors.
DotPoint1Blue.png Scanning for deleted asset files
DBR EDBR03.png
DotPoint2Blue.png Scanning for added asset files
DBR EDBR04.png
DotPoint3Blue.png Importing built in assets
DBR EDBR06.png
DotPoint4Blue.png Rebuilding cached asset data
DBR EDBR07.png
The Rebuilding Trainz Asset Database window will disappear if the DBR process has been successfully completed without finding any errors. If errors have been found then the window will remain on the screen to report on the number of errors and warnings.


  Top Next Up Next Down Bottom

How to Perform an Extended Database Repair (an EDBR)

BlueDot10x10.png An EDBR performs a "deep scan" of the database and checks that the data in every asset conforms to the rules for that type of asset


NotePad.PNG Notes:

DotPoint.JPG An EDBR is a more complex, slower and potentially more troublesome repair process
DotPoint.JPG An EDBR puts every single asset in the database through the same error and compliance checks that are run when a new asset is installed
DotPoint.JPG Perform an EDBR if you have serious problems with your database that a DBR does not fix


Stop.PNG CAUTION:

It is not unusual for Content Manager to display a list of faulty assets after an EDBR that were not shown as faulty before the EDBR was run


Steps:
DotPoint1.JPG Open the Developer Menu
DBR EDBR01.png DBR EDBR02.png
From either the Launcher (left) or Content Manager (right):-
DotPoint1Blue.png open the Developer menu
DotPoint2Blue.png hold down the  Ctrl  key
DotPoint3Blue.png select the Rebuild Database option


A possible result of an EDBR.

DBR EDBR10.png


  Top Next Up   Bottom

How to Create a "Clean Database"

BlueDot10x10.png Creating a Clean Database:-
DotPointBlueSquare.png will return your Trainz database to its original, newly installed, condition
DotPointBlueSquare.png is usually performed when the Trainz Database contains faulty installed assets that are causing crashes and other major problems
DotPointBlueSquare.png does not destroy your original database


NotePad.PNG Notes:

This process will create a new Trainz database containing only the built in and base assets that came with the original Trainz installation (a "clean" database). Use this option if you want to remove from your Trainz install all:-

DotPoint.JPG DLS assets
DotPoint.JPG DLC assets - these will have to be reinstalled if you want them back
DotPoint.JPG third party assets
DotPoint.JPG assets you have created yourself (e.g. routes, sessions, etc) - make sure that you have them backed up (as .cdp files)


Stop.PNG You will be creating another copy of the database but without any downloaded content. You will need enough space on your selected data drive to hold the data.

Your original database will not be affected and will remain in its current location until you choose to delete, move or restore it.


Steps:
DotPoint1.JPG Create a Container:
DotPoint1Blue.png use Windows File Explorer to create a new folder on your data drive (D: if you have one, C: if you don't)
DotPoint2Blue.png give the folder a meaningful and easy to remember name such as TRS19_Clean_Database
DBR EDBR30.png
DotPoint2.JPG In Trainz Launcher:
DotPoint1Blue.png Left Click the Trainz Settings button
DotPoint2Blue.png Left Click the Install tab
DotPoint3Blue.png write down the location of the Local Data Folder - you may need it again!
DotPoint4Blue.png Left Click the button [...] next to the local folder display name
DotPoint5Blue.png browse to your new data folder created in Step 1: Create a Container above
DotPoint6Blue.png select (Left Click on but do not open) your new data folder
DotPoint7Blue.png Left Click the button [Select folder]
DotPoint8Blue.png close any open File Explorer windows

You will see a progress bar as the built in assets are copied across to the new folder

DBR EDBR31.png
DotPoint3.JPG Restart Trainz and Reconfigure Settings:
DotPoint1Blue.png restart Trainz when you are prompted to do so
DotPoint2Blue.png open the Trainz Settings again and Left Click the MyTrainz tab (in T:ANE and TRS19 versions up to SP2 the MyTrainz tab is named Internet)
DotPoint3Blue.png delete and re-enter your username and password
DotPoint4Blue.png when your username/password have been accepted, restart Trainz again
DotPoint5Blue.png open the Trainz Settings again and Left Click the General tab
DotPoint6Blue.png adjust the settings to your preferred values
DotPoint7Blue.png Left Click the Performance tab and adjust the settings to your preferred values
DotPoint8Blue.png exit Trainz Settings. Depending on which settings you have changed, you may be prompted to restart Trainz again
DotPoint9Blue.png Left Click on Start Trainz
In TANE you will be prompted to download any DLC assets that you may have previously purchased. You can install them now or delay their install until later.

In Trainz Plus and TRS19/22 the Content Store, accessed from the Trainz Launcher, will allow you to select and re-install any previously purchased DLC assets.

NotePad.PNG Notes:

Your original database is still on your system at the location you recorded in Step 2 above. You may choose to:-

DotPoint.JPG leave it there (it will take up many GBs of space)
DotPoint.JPG archive or move it to offline storage
DotPoint.JPG delete it


  Top Next Up    


Trainz Wiki

TrainzWiki.png

More Tutorials and Guides to Using Trainz


This page was created by Trainz user pware in January 2019 and was last updated as shown below.


Personal tools