When running with "--debug", the only output is: Gtk-Message: 17:14:35.419: GtkDialog mapped without a transient parent. This is discouraged. However, I see all my data has been removed from every table (other than accounts_back), while the tables themselves are still present. Fortunately, my database was backed up.
What version of GnuCash before 3.1 did you last use to open the DB? If you're willing, please try again, this time with --log gnc.backend.dbi=debug. That will record all of the sql queries and may point to where in the process it failed.
I just managed to reproduce this by creating an accounts_back table. It looks like the failed-backup-recovery code is a bit too aggressive. You can probably work around the problem by removing any %_back tables after restoring your backup. Please let me know if that solves the problem.
I've fixed the problem of clearing all tables if any backup tables are found, that will be in 3.2. If you can confirm that was the problem we can close this.
Nothing heard about whether it works in 3.2 so I'll assume that it does and close this. By all means reopen it if the problem persists.