Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2011
    Posts
    14

    Unanswered: 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 ?

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    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 08:09.

  3. #3
    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

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    "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.

  5. #5
    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.

  6. #6
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    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.

  7. #7
    Join Date
    Apr 2011
    Posts
    14
    hello shammat,
    thanks a lot for the info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •