Jump to content

SQL Lite Syntax


Go to solution Solved by Luke,

Recommended Posts

Barbablanca
Posted

I know that I have a corrupt library database.  I made a copy as librarycorrupt. When I open the original in SQL Lite and run VACUUM, I get this error. What am I doing wrong?Screenshot01.jpg.ff2447347a6a8bf32d3f946907c37d9c.jpg

Posted

I can fix that with an ip login, other than that you need to wait for answers.

Happy2Play
Posted
35 minutes ago, Barbablanca said:

I know that I have a corrupt library database.  I made a copy as librarycorrupt. When I open the original in SQL Lite and run VACUUM, I get this error. What am I doing wrong?Screenshot01.jpg.ff2447347a6a8bf32d3f946907c37d9c.jpg

You will have to try and repair your corrupt db as you will not be able to vacuum it. 

https://emby.media/support/articles/Corrupt-Database.html

Barbablanca
Posted

How do I run the recover command?

Barbablanca
Posted
.output recovered-librarydb.sql
.recover

How do I do that?

Lyfesaver
Posted (edited)
51 minutes ago, Barbablanca said:
.output recovered-librarydb.sql
.recover

How do I do that?

Depends on the tool you are using to manage the database (I think)

EDIT: Ahhhh I see by your first post that you are using DB Browser


AI Says:

To perform a recovery in DB Browser for SQLite,

use the PRAGMA integrity_check command to diagnose the database, then export the database to an SQL file, and finally import the SQL file back to create a new, fixed database. 

 
 
Step 1: Check for corruption
 
  • Open your .db file in DB Browser for SQLite.
  • Navigate to the Execute SQL tab.
  • Type PRAGMA integrity_check; and click the Play button to run the query.
  • If errors are reported, proceed with the next step. 
 
Step 2: Export the database 
 
  • Go to File > Export > Database to SQL file.
  • Choose the tables and options you want to export.
  • Click OK to start the export process. This will create a .sql file containing the database structure and data. 
 
Step 3: Import the database 
 
  • Go to File > Import > Database from SQL file.
  • Select the .sql file you just created.
  • Click OK to begin the import process. This will create a new, recovered database file
Edited by Lyfesaver
  • Agree 1
Barbablanca
Posted

I wasn't sure what data/tables to include when I exported to the SQL file, so I opted for everything. When I try to import the SQL file and save it as library.db, it hangs at 12%. This is what the integrity check on the original database looks like

Screenshot01.jpg

Barbablanca
Posted

Obviously I shouldn't be exporting EVERYTHING to the SQL file. What Tables/Data do I need to export to get an uncorrupted SQL file?

Posted
3 hours ago, Barbablanca said:

I wasn't sure what data/tables to include when I exported to the SQL file, so I opted for everything. When I try to import the SQL file and save it as library.db, it hangs at 12%. This is what the integrity check on the original database looks like

Screenshot01.jpg

Hi it’s probably just taking a little while. Did you give it some time?

Barbablanca
Posted

I waited at least an hour and it stays at 12% progress. What are the minimum tables/data that I can export to SQL and then import back to a database file without it hanging?

  • Solution
Posted

I don't think you're going to be able to successfully slice and dice and just pick and choose certain tables. There are data relationships and that's why all of the data needs to be there. You might just have to start with a fresh database file.

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
×
×
  • Create New...