初心者用pg_dumpの方法
Apr 30, 2008pg_dumpは
|
1 |
pg_dump database_name > database_name.sql |
を実行すればできると、あるが実際はいろいろと気をつけないことが、たくさんあるのでそのメモ
その一、ユーザの準備
postgresでDBを作成しているなら、postgresユーザがいります。
|
1 |
useradd -d /home/postgres/ postgres |
このときに、ホームディレクトリーも作っておきます。
その二、ファイルの準備
先ほど上のつくったホームディレクトリーの中にdatabase_name.sqlのファイルを作っておきます。
|
1 |
touch database_name.sql |
その三、bushが引けてない場合があるのでlocateでpg_dumpを調べてひいいておきましょう。
その四、いざ実行
|
1 |
[postgres@www postgres]$ pg_dump database_name.sql > database_name.sql |
Twitter:
Warning: Undefined array key "Twitter" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0 | Facebook: 0 | Google Plus:
Warning: Undefined array key "Google+" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0 | Hatena: 2 | Pocket: 0 | Total: 2 | Feedly: 0
