• ベストアンサー

Initdbの取消って可能なのでしょうか?

お世話になっております。 Postgresなんですが、Linuxをインストールすると同時にpostgresが インストールされ、Initdbも実行されてしまいました。 標準のPGDATAのpathでInitdbされてしまっていますが、別の領域に PGDATAを作成したいため、initdbを取り消したいのです。 単純に旧のPGDATAを削除してInitdbの再実行でいいのでしょうか? それとも、単にinitdbの再実行でいいのでしょうか? それとも他の方法があるのでしょうか? 調べてみましたけど不明でした。 どなたか。お助けください。 お願いします。

質問者が選んだベストアンサー

  • ベストアンサー
  • nino2
  • ベストアンサー率88% (8/9)
回答No.1

ディストリビューション付属の Postgresql は使ったことないので 正確なことはわかりません。 1 postgresが起動していたら、停止する 2 PGDATA で指定されている dirを削除する。 3 PGDATA を設定しているファイルを編集して 新しいpathを設定する。   ( postgresqlの起動ファイルと postgresユーザの .bssh_profile等 ) 4 initdb を行う。 5 postgresを起動する でいけるとおもいますが 以下は ご存知であれば、読み飛ばしてください。 initdbを行うときは encoding と locale 設定に注意しましょう。 (日本語を扱う場合は --no-locale 設定は必須です)

papope
質問者

お礼

ご回答ありがとうございます。 やはりPGDATAの削除と各pathの修正でいけるんですね・・・。 ありがとうございます。 助かりました。

関連するQ&A

  • initdbのオプション

    PostgreSQL7.2.3インストール後、 $ /usr/local/pgsql/bin/initdb を実行したところ、 You must identify where the data for this database system will reside. Do this with either a -D invocation option or a PGDATA environment variable. と表示されます。これは、.bashrcで追加した下記内容が読み込まれていないからでしょうか? POSTGRES_HOME=/usr/local/pgsql export PATH="$PATH":/usr/local/pgsql/bin export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man 上記オプションはどちらを選べばよいでしょうか?また、PGDATAの場合、"-"なしでそのままPGDATAでしょうか?

  • postgresのWindows版でinitdbで初期化するには

    postgresのWindows版でinitdbで初期化するには どうすれば良いですか? postgresユーザで # initdb --encoding=UTF8 --no-locale を実行するという記事を見つけました。 linuxの場合、 su - postgres の後、実行すればよいのでしょうが、 Windows版ではどうなりますか? とりあえず、やってみましたが、以下のような状態です。 C:?Program Files?PostgreSQL?8.1?bin>initdb --encoding=UTF8 --no-locale initdb: no data directory specified You must identify the directory where the data for this database system will reside. Do this with either the invocation option -D or the environment variable PGDATA.

  • postgresqlでinitdbが実行できない

    Vine Linux2.6r4 + PostgreSQL 7.4.3で、インストールが終了して、initdbを実行すると、 creating directory /data... mkdir: ディレクトリ `/data' を作れません: 許可がありません とメッセージがでてきて、実行できません。 ユーザもpostgresでやっていて、問題はないとおもっていますが。。 どなたかご存知のかたがいらっしゃいましたらお教え願えませんでしょうか?

  • initdb: command not find について教えてください。

    REDHAT LINUX9 postgreSQL8.0.4←7.2.3からのアップグレードで、 rootからsu postgresして initdbをしようとしたら。 initdb: command not find となるのですが、これって正常にインストールできていないのでしょうか? それとも、設定不良でしょうか? どなたか教えていただけませんでしょうか? 宜しくお願いします。

  • postgreSQLのinitdb

    postgreSQL7.2.3のインストールを行いました。 % tar vxfz postgresql-7.2.3.tar.gz % cd postgresql-7.2.3 % ./configure --enable-locale --enable-multibyte=EUC_JP |& tee Configure.out % make | & tee Make.out % su # tcsh % make install | &tee Make_install.out % chown -R postgres:postgres /usr/local/pgsql ここまでは何も問題なく終わったのですが、 次に initdb を実行したところ以下エラーが出ます。 % su postgres % /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data ld.so.1: /usr/local/pgsql/bin/pg_encoding: 重大なエラー: libgcc_s.so.1: open に 失敗しました: ファイルもディレクトリもありません。 initdb: pg_encoding failed Perhaps you did not configure PostgreSQL for multibyte support or the program was not successfully installed. ↑ここまで 「マルチバイトサポートしていません」 「インストールに失敗しています」というような内容なのですが、 何がダメだったのでしょうか? ちなみにOSは Solaris9/02です。

  • PostgreSQLのinitdbでエラーが出てしまいます。

    どなたか教えて下さい。 RedhatLinux6.2J に PostgreSQL7.0.3をインストールしようとしています。 ソースファイルのコンパイルとインストールは正常に終了したつもりです。 postgres用ユーザーの環境変数も設定したつもりです。 しかし、postgres用ユーザーでinitdbを実行したところ、 Creating template database in /usr/local/pgsql/data/base/template1 ERROR: Error:unknown type 'oidvector'. ERROR: Error:unknown type 'oidvector'.  syntax error 12: parse errorinitdb:could not create templatedatebase というエラーメッセージが出てしまいます。 template1というデータベースが作成できなかった、ということは何となく わかるのですが、エラーの原因が何かさっぱり分かりません。 どうぞ、教えて下さい。お願いします。

  • PostgreSQLはインストールされている?

    $ /usr/local/pgsql/bin/postmaster -D PGDATA を実行すると、 database system is ready と表示されますが、 # rpm -qa|grep postgres を実行すると、何も表示されません。PostgreSQL7.2.3はインストールされているといえるのでしょうか?

  • ".bashrc" E509: バックアップファイルを作れません (! を追加で強制作成)

    fedora core1 でpostgreSQLをインストール中です。 # .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi に、 export PATH=$PATH:/usr/local/pgsql/bin export MANPATH=$MANPATH:/usr/local/pgsql/man export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=/home/postgres/data を追加して :wq すると ".bashrc" E509: バックアップファイルを作れません (! を追加で強制作成)というエラーが出ます。 どうしたらいいかわかりません。

  • 接続出来ない その2

    自分のPC(XP)からTelnetで LINUX(Red Hat Linux release 9 (Shrike))に接続して、 PostgreSQLを使いたいと思っています。 http://oshiete1.goo.ne.jp/kotaeru.php3?q=944720 の方で「PostgreSQLが接続出来ない」という 質問をさせて頂いた者です。 PATHを通したので以前のようなエラーはなくなりました。 ただ今度は次のようなエラーが出てします。 $ postmaster FATAL: XX000: failed to initialize lc_messages to "" LOCATION: InitializeGUCOptions, guc.c:1866 また、initdbをすると、 $ initdb initdb: no data directory specified You must identify the directory where the data for this database system will reside. Do this with either the invocation option -D or the environment variable PGDATA. というエラーが出てします。 自分なりに色々とやってみたのですが どうしても分かりません。 ご教授して頂けたら幸いです。

  • cronでpg_dumpの実行

    こんにちわ。 Linuxでcronを設定しPHPからexecで「pg_dump」を実行しようとしています。 エラーになり実行ができません。 設定は /var/spool/cron ディレクトリに 『crontab -e -u postgres』でコマンドを実行し SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO='' HOME=/ 08 19 * * * postgres /usr/bin/php /home/var/b_dump.php とcrontabに記載しています。 コマンドの実行はrootユーザで 権限は777 にしています。 メールを届くようにしているのですが、届くメールは 『postgres does not know where to find the server configuration file. You must specify the --config-file or -D invocation option or set the PGDATA environment variable.』 と届きます。 googleで検索したのですが、解決方法がわかりません…。 読みにくい文章で申し訳ないのですが、解決方法のご教授を お願いします。