#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Copying database without killing DB connections


    Hello,

    I need to copy database 1:1. I found it feasible with CREATE DATABASE dbname TEMPLATE templatename command but issue is, that this requires me to close all existing connections with exception of my own. I need to somehow avoid this and still be able to copy my database.

    Can you give me some advice on how to do it or how to go around it?

    Thanks a lot,

    Tom.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,784
    Rep Power
    348
    You will need to use pg_dump / pg_restore to achieve this then.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

IMN logo majestic logo threadwatch logo seochat tools logo