Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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 disk is full

The database is about 36 GB and the drive that I'm running it on looks like (via df -h):

/dev/sda2       406G  171G  215G  45% /home

So I am clearly above the double size limited needed. What can I do to allow the vacuum command to run?

share|improve this question
up vote 5 down vote accepted

To allow the VACUUM command to run, change the directory for temporary files to one that has enough free space.

SQLite's temporary directory is

  1. whatever is set with the PRAGMA temp_store_directory command; or
  2. whatever is set with the SQLITE_TMPDIR environment variable; or
  3. whatever is set with the TMPDIR environment variable; or
  4. /var/tmp; or
  5. /usr/tmp; or
  6. /tmp.
share|improve this answer
1  
Thanks, I'll try that tomorrow. The PRAGMA link mentions that this is a depriecated command but doesn't give the alternative. Is the enviorment variable the recommended way? – Hooked Apr 23 '14 at 21:33
    
Yes, but everything except PRAGMA temp_store_directory is OS-dependent. – CL. Apr 24 '14 at 6:33
    
Note, that SQLITE_TMPDIR was only introduced in SQLite v3.8.1... See sqlite.org/releaselog/3_8_1.html – mBardos Feb 15 at 14:19
    
SQLITE_TMPDIR and TMPDIR both don't seem to work with sqlite3 2.6.0 under python 3.5 (Ubuntu). PRAGMA is deprecated. What to do? – max Apr 2 at 3:27
    
@max Python has modified the default temp_store settings. Anyway, that would be a new question. – CL. Apr 2 at 6:51

Probably 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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.