Renaming a Database
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    22

    Default Renaming a Database

    Is it possible to rename a database?

  2. #2
    [Former] HM Support fabio's Avatar
    Join Date
    Jul 2008
    Posts
    2,067

    Default

    You can rename your database(s) with pgAdmin

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    22

    Default

    I looked around in pgAdmin III and I couldn't find anywhere to rename it. It seems as if the names are locked in and unable to edit.

  4. #4
    Member
    Join Date
    Jul 2008
    Posts
    36

    Default

    Try this:

    1. Create a backup of your database with PGAdmin.
    2. Create a new database with the name that you want.
    3. Restore the old database on top of the database you just created.

  5. #5
    Junior Member
    Join Date
    Oct 2008
    Location
    No.Cal
    Posts
    4

    Default

    (You may want to back up your DB before you try this, but it worked fine for me.)

    Found the trick:

    - Go into "PSQL to 'postgres'" (not pgAdmin)

    - Enter this line exactly, but where xxx = old DB name and nnn = new DB name:

    ALTER DATABASE "xxxxxxx" RENAME TO "nnnnnnn" \g

    (Here's the PostgreSQL Doc page for it: http://www.postgresql.org/docs/8.3/s...rdatabase.html ) (the "\g" part is what executes the command)

    - When you next open HEM, you will get an error "Database not found" or something. Click "OK" and Database Maintenance should open. Connect and make your newly named DB the default.

    Then you're set!!
    Last edited by Stick66; 10-21-2008 at 12:20 PM. Reason: disclaimer at top

Posting Permissions

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