• 検索結果がありません。

資料・データ laclassroom

N/A
N/A
Protected

Academic year: 2018

シェア "資料・データ laclassroom"

Copied!
3
0
0

読み込み中.... (全文を見る)

全文

(1)

■環境設定(WindowsXP)

□事前に決めておく事項

 ※PostgreSQL 用の管理ユーザ(OS ユーザ)

 ※インストール先:C:\Program Files\PostgreSQL\9.0(デフォルト)

 ※データディレクトリ:C:\Program Files\PostgreSQL\9.0\data(デフォルト)  ※ポート番号:5432(デフォルト)

 ※データベース・クラスタのロケール:C

□インストールと基本設定 1.PostgreSQL ダウンロード   http://www.postgresql.jp/

  ※Windows 版インストーラのダウンロード

2.インストーラーを起動し、インストール開始

  ※事前に決めておく事項の内容を参考にしながらインストールを進める

  ※インストールが完了したらスタックビルダのチェックをはずして「Finish」ボタンを押下

3.postgresql.conf の編集

  listen_addresses = '*' → listen_addresses = 'localhost'   client_encoding = sql_ascii → client_encoding = sjis

4.環境変数の設定

  Path の先頭に以下のパスを追加

  ※注意!Path の設定されている他の設定を削除しないように気をつけること   

  C:\Program Files\PostgreSQL\9.0\bin;

5.接続と切断

  ※コマンドプロンプトで psql を使用   

  ex)管理者ユーザでログイン・ログアウト   <接続> psql postgres postgres   <切断> \q

6.起動と終了

  ※PostgreSQL はサービスに登録されているため Windows にログインすると自動起動となる   ※サービスに登録されているプログラムは、サービスの画面で起動と終了を管理できる   ※手動で起動したい場合は、自動起動の設定を手動に変更し、コマンドで起動する   

   →PostgreSQL 用の管理ユーザでログインしている場合     <起動>pg_ctl start

    <終了>pg_ctl stop    

   →他のユーザでログインしている場合

    <起動>net start サービス名  → 例)net start postgresql-9.0     <終了>net stop サービス名   → 例)net stop postgresql-9.0

7.テキストのサンプル用データの設定

  1)講義で使用するファイルを保存するためのディレクトリを作成    c:\ossdb

  2)c:\ossdb フォルダに以下のファイルをコピー    CreateSalesData_sjis.sql

  3)ユーザの作成

   ※PostgreSQL ログイン前:createuser コマンド    

    createuser -d -U ログインするユーザの名前 -P 新規に作成するユーザの名前    

   ex) createuser -d -U postgres -P sales

(2)

   

   新しいロールのためのパスワード:      ※入力したパスワードは表示されないので注意    もう一度入力してください:        ※入力したパスワードは表示されないので注意    新しいロールをスーパーユーザにしますか? (y/n)n

   新しいロールに対して別のロールを作成する権限を与えますか? (y/n)n

   パスワード:        ※ここにはログインするユーザのパスワードを入力       ※入力したパスワードは表示されないので注意

  4)作成したユーザの確認

   ※管理者ユーザ(postgres)でログイン    

   ※コマンドでユーザ一覧を表示     \du

ロール一覧

     ロール名 | 属性 | メンバー     ---+---+---      postgres | スーパーユーザ, ロールを作成できる, DB を作成できる | {}      sales | DB を作成できる | {}     

   ※管理者ユーザでログオフ    

   ※sales ユーザでログイン    ※sales ユーザでログオフ

  5)データベースの作成

   ※PostgreSQL ログイン前:createdb コマンド    

    createdb -U ログインするユーザの名前 新規に作成するデータベースの名前     

   ex) createdb -U sales sales

  6)作成したデータベースの確認    ※sales ユーザでログイン    

   ※コマンドでデータベース一覧を表示     \l

                   

     データベース一覧

     名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権     ---+---+---+---+---+---      postgres | postgres | UTF8 | C | C |

     sales | sales | UTF8 | C | C |

     template0 | postgres | UTF8 | C | C | =c/postgres +      | | | | | postgres=CTc/postgres      template1 | postgres | UTF8 | C | C | =c/postgres +      | | | | | postgres=CTc/postgres    

   

   ※sales ユーザでログオフ

  7)ファイルからデータを設定    ※PostgreSQL ログイン前:    

   psql sales sales < c:\ossdb\CreateSalesData_sjis.sql    

   

   ※PostgreSQL ログイン後(sales ユーザで sales データベースにログイン後):    

   \i c:/ossdb/CreateSalesData_sjis.sql    

  8)設定したデータを確認    ※sales ユーザでログイン    

(3)

   ※コマンドでテーブル一覧を表示     \d

    

     リレーションの一覧

     スキーマ | 名前 | 型 | 所有者     ---+---+---+---      public | customer | テーブル | sales      public | department | テーブル | sales      public | employee | テーブル | sales      public | nextsalary | テーブル | sales      public | packedsales | テーブル | sales      public | product | テーブル | sales      public | sales | テーブル | sales     (7 行)

参照

関連したドキュメント

Begin applications prior to disease development and continue throughout the season on a 7-10 day interval. Make no more than 2 consecutive applications before switching to

Pursuit may be applied in a tank mix with a registered grass herbicide or applied preemergence following a preplant incorporated application of a registered grass

Depending on specific crop application directions, Verdict may be applied for residual control of germinating weed seedlings before planting (preplant) or after planting but before

Air application: Apply in sufficient spray volume to obtain full coverage of the foliage or target area. ULV application: Paradigm may be mixed with once-refined vegetable oil

Apply Poast ® herbicide to actively growing grass weeds by aerial or ground application at the rates and timing (maximum height) listed in Table 5 (annual grass weeds),

Apply Beyond early postemergence when weeds are actively growing and before broadleaf weeds exceed a height of 3 inches and grass weeds exceed 4 to 5 leaves (unless otherwise

Additional applications per year are permitted when a lower Product Use Rate per Application is used, as long as the Maximum Product Rate per Year is not exceeded..

Physical incompatibility, reduced disease control, crop injury, or incompatibility due to additives, adjuvants or other products used in combination with Merivon may result from