I\'m trying to run the VACUUM
command on my database, but I seem to run out of space:
> sqlite3 mydatabase.db \"VACUUM\"
Error: database or d
To allow the VACUUM command to run, change the directory for temporary files to one that has enough free space.
SQLite's documentation says the temporary directory is (in order):
SQLITE_TMPDIR
environment variable; orTMPDIR
environment variable; or/var/tmp
; or/usr/tmp
; or/tmp
; or.
, the current working directoryProbably the drive, where your temporary files are created, has not enough space. See here Vacuum-command-is-failing-with-SQL-Error-Database-or-disk-is-full
The OP noted that during a VACUUM, SQLite creates a temporary file that is approximately the same size as the original database. It does this in order to maintain the database ACID properties. SQLite uses a directory to hold the temporary files it needs while doing the VACUUM. In order to determine what directory to use, it descends a hierarchy looking for the first directory that has the proper access permissions. If it finds a directory that it doesn't have access to, it will ignore that directory and continue to descend the hierarchy looking for one that it does. I mention this in case anyone has specified an environment variable and SQLite seems to be ignoring it.
In his answer CL gives the hierarchy for Linux and in his comment mentions that the hierarchy is OS-dependent. For completeness, here is the hierarchies (in so far as I can determine them from the code).
For Unix (and Linux) the hierarchy is:
For Cygwin the hierarchy is:
For Windows the hierarchy is:
GetTempPath(), which is documented to return:
Hope this helps.