By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

I want to drop a tablespace, but it says tablespace is not empty. What am I missing?

P: 1
Hello everyone,

I moved all tables and indices out of a tablespace to a different tablespace (different hard drive and different mountpoint). Now I want to drop the old tablespace but it says the tablespace is not empty.

If I go into the tablespace directory i see bunch of files. I was told that these cannot be deleted, but if I'm trying to drop this tablespace anyway, can I just delete these files? Will this affect the tables that are moved to the new tablespace

Expand|Select|Wrap|Line Numbers
  1. <code>PG_9.5_201510051/259388 # du -sh *
  2. 1.1G    2935335227
  3. 1.1G    2935335227.1
  4. 1.1G    2935335227.2
  5. 138M    2935335227.3
  6. 1.1G    2935335230
  7. 1.1G    2935335230.1
  8. 1.1G    2935335230.2
  9. 1.1G    2935335230.3
  10. 1.1G    2935335230.4
  11. 1.1G    2935335230.5
  12. 266M    2935335230.6
  13. 139M    2935335232</code>
Any guidance would be appreciated
Thanks in advance
4 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,387
!! Very important, make absolutely sure you have a backup of your database. It's very difficult to recover !!

Have you tried the following:
https://www.postgresql.org/docs/8.4/...ag-dropdb.html
Login to the database as the owner or superuser
Expand|Select|Wrap|Line Numbers
  1. DROP DATABASE dbYourDbNameHere;
  2. DROP TABLESPACE yourTableSpaceNameHere;
4 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.