Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

sqlite - SQLITE3 VACUUM, "database or disk is full"

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):

Filesystem      Size  Used Avail Use% Mounted on
/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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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):

  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; or
  7. ., the current working directory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...