Connecting Tech Pros Worldwide Forums | Help | Site Map

Dropping a tablespace - windows

Newbie
 
Join Date: Aug 2009
Posts: 4
#1: Aug 21 '09
I have a tablespace that is not being used and I want to drop it. When I try to drop the tablespace either via pgAdmin III or an sql command I get the following error:

cannot read directory "pg_tblspc/20612": No such file or directory

I have tired to manually create those directories in the location listed as the target folder for the tablespace. Error still occurs. The tablespace may have encountered errors during creation.

Ideas how I get rid of this tablesapce?

Thanks
Mark

Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 293
#2: Aug 21 '09

re: Dropping a tablespace - windows


What does the query show
Expand|Select|Wrap|Line Numbers
  1. select * from pg_tablespace;
  2.  
Newbie
 
Join Date: Aug 2009
Posts: 4
#3: Aug 21 '09

re: Dropping a tablespace - windows


spcname | spcowner | spclocation | spcacl
-------------+----------+--------------------+--------
pg_default | 10 | |
pg_global | 10 | |
cmatblspace | 10 | /dbdata/cmadbfiles |
(3 rows)
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 293
#4: Aug 21 '09

re: Dropping a tablespace - windows


Can you connect via psql client and run query
Expand|Select|Wrap|Line Numbers
  1. drop tablespace tablespace_you_want_to_delete;
  2.  
I guess you want to drop cmatblspace, don't you?

You can also try to run this query via pgadmin3.
Newbie
 
Join Date: Aug 2009
Posts: 4
#5: Aug 21 '09

re: Dropping a tablespace - windows


correct, i wish to drop the cmatblspace tablespace.

drop tablespace cmatblspace;

ERROR: could not read directory "pg_tblspc/20612": No such file or directory
Newbie
 
Join Date: Aug 2009
Posts: 4
#6: Aug 21 '09

re: Dropping a tablespace - windows


Some additional info:

I found information in the 8.1 documentation (I am using 8.4) that pg_tblspc is a directory under the data dir for postgres for holding soft links to files. Sure enough there is a pg_tblspc/20612 folder under the data folder for postgres. When I click on the 20612 folder, I get the following:

C:\Program Files (x86)\PostgresSQL\8.4\data\pg_tblspc\20612refers to a location that is unavailable. It could be a hard drive on this computer, or on the network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a differenct location.
Reply