If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > want to create database out of data directory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-13-11, 05:38
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
want to create database out of data directory

hi,
i have postgresql 8.4 install on my c drive but i want to create database in some other drive then c but dont want to cretae whole data directory with database
is ther any way to create database in some other drive or out of data directory ?
Reply With Quote
  #2 (permalink)  
Old 06-13-11, 07:03
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Create a new tablespace that is located in the directory that you want to use.
Then create the new database with that tablespace as the default.

Details are in the manual:

http://www.postgresql.org/docs/8.4/s...ablespace.html
http://www.postgresql.org/docs/8.4/s...edatabase.html

Make sure the user that runs the postgres service has full read and write access to that directory!

Last edited by shammat; 06-13-11 at 07:09.
Reply With Quote
  #3 (permalink)  
Old 06-13-11, 07:22
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
hi shammat,
thanks for ur reply ,i had tried this tablespace option
i had created a tablespace and database in it in d drive , and i can access this newly create database from c drive pgadmin ,but once i reinstall my postgresql software, i cant able to access this d drive tablespace and database from pgadmin,
is ther any command or some other option to access this previously created tablespace and database from pgadmin after reinstallation
Reply With Quote
  #4 (permalink)  
Old 06-13-11, 07:27
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
"i cant able" is not a valid postgres error message.

Please post the following information so that we can help you:

- the exact(!) SQL statements you used to create the tablespace and the database.
- the exact(!) error message you get from running those statements.

And make sure you format the SQL statements properly using [code] tags so they are readable.
Reply With Quote
  #5 (permalink)  
Old 06-13-11, 07:58
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
OMG,
i dont get any error while creating tablespace and database(named test),
both tablespace and database are created without any error ,
but then i uninstall postgres and again install it ,
now i want to access this database (test) from pgadmin
is ther any way to access this database(test) from pgadmin because after reinstallation database(tets) are not shown in pgadmin databases list.
Reply With Quote
  #6 (permalink)  
Old 06-13-11, 08:16
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Quote:
Originally Posted by shilpa24 View Post
is ther any way to access this database(test) from pgadmin because after reinstallation database(tets) are not shown in pgadmin databases list.
No, you cannot do it that way.

Before you uninstall Postgres you need to get a dump of your current database using pg_dump, then after installing it again, you have to re-create the database (and the tablespace) and import the dump.
Reply With Quote
  #7 (permalink)  
Old 06-13-11, 08:22
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
hello shammat,
thanks a lot for the info
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On