Jump to content

Internal.db and Registry.db


skybad

Recommended Posts

I'm pretty sure you can safely delete them (though I'd advise just moving them into a seperate directory at first if you believe you want to migrate at least some of the data from there at some point) and start up the server, which should generate new internal.db and registry.db files, without any data.

Link to comment
  • MTA Anti-Cheat Team
15 hours ago, Addlibs said:

I'm pretty sure you can safely delete them

internal.db contains all player accounts (unless you're using a custom account system, rather than the default one). 99% of the servers use built-in account system in accordance with the ACL.

Besides that, it contains other data as well, such as stored with setAccountData which a lot of resources to date use (less than ideal, yes).

So basically, deleting this file would bring destruction to most servers.. whoever is reading this: don't do that.

 

server\mods\deathmatch\databases\global > registry.db is used (for example) by the default admin resource, to store player screenshots taken through the admin panel. For this example, deleting only the .db (and not the contents of conf/screenshots folder) will create inconsistencies and untracked files.

I'm not sure of the potential contents of the other registry.db (located in the main server\deathmatch folder), e.g in my case it's always empty (no tables) but judging from the source code at https://github.com/multitheftauto/mtasa-blue/blob/927509565ab3a8d48df006440654c38e0942aa89/Server/mods/deathmatch/logic/CGame.cpp#L836 i wouldn't want to mess with it, also not knowing what it may contain on a variety of servers.

Back to the original question though @skybad

15 hours ago, skybad said:

how can I clean both files?

It's called defragmenting, you can do that using either of the following 2 methods:

Method 1): open mtaserver.conf and set defragmentation to instant on server launch:

    <!-- This parameter specifies when the internal sqlite databases should be defragmented.
		 http://www.sqlite.org/lang_vacuum.html
	     Values: 0 - Never, 1 - On server start only after basic backup, 2 - On server start always.  Default - 1 -->
    <compact_internal_databases>0</compact_internal_databases>

Change the value to 2 - On server start always so it will be like this:

<compact_internal_databases>2</compact_internal_databases>

Now launch the server, wait for it to output this in console:

Compacting accounts database 'internal.db' ...
Compacting database 'registry.db' ...

Then shut it down, and change back the value in mtaserver.conf (to 1). You just forced defragmentation for now.

Method 2): use SQLite browser (download and install from https://sqlitebrowser.org/), this software allows you to open the .db file and defragment it using "Compact database" option from the Tools bar:

hTn4rEH.png

I personally prefer this because i found that defragmentation results using this software are better than built-in mtaserver.conf vacuum. You can also first defrag it with the software and then with the config vacuum, even though it's probably unnecesary.

I also prefer it for the reason that it supports .db files that belong to any resources on the server that use SQLite. The built-in config vacuum only supports databases like internal.db and registry.db.. with SQLite Browser, you could just perform a search for all database files in your server folder (e.g in Windows explorer: *.db) and optimize them one by one.

Obviously, no matter the method you use to defragment/optimize your .db files, back them up in a safe location first.

  • Like 2
Link to comment
On 06/04/2020 at 19:16, skybad said:

[...] how can I clean both files [...] in order to start without accounts?

9 hours ago, Dutchman101 said:

internal.db contains all player accounts (unless you're using a custom account system, rather than the default one). 99% of the servers use built-in account system in accordance with the ACL.

Besides that, it contains other data as well, such as stored with setAccountData which a lot of resources to date use (less than ideal, yes).

So basically, deleting this file would bring destruction to most servers.. whoever is reading this: don't do that.

Isn't that exactly what he wants? Cleaning (not defragmenting) can be achieved by removing those files (either by deleting or moving somewhere else - as I stated in the previous post, I recommend the latter) and starting up the server to generate new blank DB files. The point is you don't actually have to completely delete the whole server to start fresh, you just need to wipe the databases by removing them; and you don't "download cleaned" files, you let the server generate new, blank, DBs if you want to remove all of the data in them.

 

9 hours ago, Dutchman101 said:

For this example, deleting only the .db (and not the contents of conf/screenshots folder) will create inconsistencies and untracked files.

This is very true. It would be wise to wipe the contents of directories with dynamically filled content, and perhaps reset configurations but I guess the reason one would want to wipe the database without wiping the server directory is to keep resources and configurations.

Edited by Addlibs
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...