カタカタブログ

SIerで働くITエンジニアがカタカタした記録を残す技術ブログ。Java, Oracle Database, Linuxが中心です。たまに数学やデータ分析なども。

Oracle Database 12c (12.1.0.2.0) で遊んでみた(その1) 〜インストール〜

やっと会社が終わり休みに入ったので、冬休みの自由研究として、Oracle DB 12cを検証環境にインストールして遊んでみることに。12cはプラガブルデータベースとかインメモリオプションとか、新しい概念も多いのでその辺を触ってみようと思います。まずは、いつもどおり新規インストールしてみます。環境はCent OS6.4の環境で、Oracle 11gR2がすでに入っているのですが、別ディレクトリに独立して入れてみようと思います。

Oracle DB 12cのインストールメディアを入手する

以下のURLからOracle Database 12c Release 1 (12.1.0.2.0) - Enterprise Edition のメディアをダウンロード
http://www.oracle.com/technetwork/jp/database/enterprise-edition/downloads/index.html

・・・しようとしたものの、なぜかエラーになって落とせなかったのでedeliveryから落とすことに。

f:id:osn_th:20141229113317p:plain
下記2ファイルをダウンロード。

V46095-01 Part 1 of 2
V46095-01 Part 2 of 2

f:id:osn_th:20141229113227p:plain

ダウンロードしたメディアを展開する。

$ pwd
/home/oracle/installer/oracle/db_12.1.0.2.0
$ ls -l
合計 3522120
-rw-r-----. 1 oracle oinstall 1673544724 12月 26 21:05 2014V46095-01_1of2.zip
-rw-r-----. 1 oracle oinstall 1014530602 12月 26 21:06 2014V46095-01_2of2.zip
-rw-r-----. 1 oracle oinstall  918555219 12月 26 21:07 2014 V46097-01.zip
$ unzip V46095-01_1of2.zip
$ unzip V46095-01_2of2.zip
$ unzip V46097-01.zip

Oracle DB12cをインストールする

rootユーザでGUI(VNCサーバ)でログインしxhostを許可する。

# xhost +
access control disabled, clients can connect from any host

oracleユーザにスイッチし、インストーラを解凍したディレクトリ中のrunInstallerを実行する。

$ cd installer/oracle/db_12.1.0.2.0/database/
$ ./runInstaller

インストーラが起動するので、以下指示に従っていく。
f:id:osn_th:20141229113231p:plain
・次へ
f:id:osn_th:20141229113239p:plain
・はい
f:id:osn_th:20141229113322p:plain
・次へ
f:id:osn_th:20141229113201p:plain
・「サーバー・クラス」にして次へ
f:id:osn_th:20141229113242p:plain
・次へ
f:id:osn_th:20141229113255p:plain
・拡張インストール
f:id:osn_th:20141229113218p:plain
・「日本語」「英語」が選択されるので、次へ
f:id:osn_th:20141229113151p:plain
・次へ
f:id:osn_th:20141229113306p:plain
・ソフトウェアの場所を指定し、次へ
(デフォルトの/u01/app/oracleは11gR2のDBがすでに使用していたので/u01/app/oracle12cに変更した)
f:id:osn_th:20141229113205p:plain
・次へ
f:id:osn_th:20141229113127p:plain
・すでに11gR2でSID=orclを使っていたので、o12cにし、あわせてプラガブル・データベース名もpdbo12cにしてみた。次へ
f:id:osn_th:20141229113302p:plain
・メモリはデフォルト
f:id:osn_th:20141229113310p:plain
・キャラクタ・セットをUnicode(UTF8)に変更
f:id:osn_th:20141229113146p:plain
・サンプル・スキーマを作成にチェックを入れ、次へ
f:id:osn_th:20141229113215p:plain
・次へ
f:id:osn_th:20141229113154p:plain
・次へ
f:id:osn_th:20141229113248p:plain
・次へ
f:id:osn_th:20141229113158p:plain
・パスワードは全て”oracle”にして、次へ
f:id:osn_th:20141229113252p:plain
・はい
f:id:osn_th:20141229113246p:plain
・次へ
f:id:osn_th:20141229113313p:plain
・前提条件チェックが実行されるので、完了まで待つ
f:id:osn_th:20141229113138p:plain
・すでに11gR2の前提条件をクリアしているせいか、パッケージ不足はほとんどないよう。「修正および再チェック」でOSカーネル・パラメータだけ修正しておく。
f:id:osn_th:20141229113131p:plain
・以下の修正スクリプトを実行し、OK
f:id:osn_th:20141229113236p:plain
rootユーザで指示されたスクリプトを実行する。

# /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh
All Fix-up operations were completed successfully.

・カーネルパラメータが修正されたことを確認
f:id:osn_th:20141229113211p:plain
・kshだけないようだが、「すべて無視」し、次へ
f:id:osn_th:20141229113222p:plain
・はい
f:id:osn_th:20141229113320p:plain
・インストール
f:id:osn_th:20141229113142p:plain
・インストールが開始されるので、完了まで待つ
f:id:osn_th:20141229113208p:plain
・しばらく待つと構成スクリプト実行のウィンドウが出るので、スクリプトを実行し、0K
f:id:osn_th:20141229113124p:plain
11gR2がすでにある環境のせいか、各種ファイルの上書き確認メッセージが出ている。よく分からなかったが、11gR2の環境も特に壊れても良い環境なので、適当に許可してみた。

# /u01/app/oracle12c/product/12.1.0/dbhome_1/root.sh
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle12c/product/12.1.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.

Now product-specific root actions will be performed.

・しばらくたつとDBCAが起動し、DB作成が開始されるので、完了まで待つ
f:id:osn_th:20141229113233p:plain
・完了すると以下の画面が表示されるので、OK
f:id:osn_th:20141229113259p:plain
・閉じる
f:id:osn_th:20141229113135p:plain

Oracle DB 12cに接続してみる

まずいつも通り、環境変数を設定する。oracleユーザの.bashrcにORACLE環境変数を定義し、ログイン時に読めるようにする。

$ cat .bashrc
(・・・略)
# Oracle DB 12c
export ORACLE_HOME=/u01/app/oracle12c/product/12.1.0/dbhome_1
export ORACLE_SID=o12c
export PATH=$PATH:$ORACLE_HOME/bin

oracleユーザで再ログインし.bashrcを読み込んだ状態で、sqlplusでつないでみる。

$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Dec 29 11:26:03 2014
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
o12c

無事、接続できた!

Oracle DB12cの起動・停止

起動・停止コマンドは11gR2と同じよう。ただしプラガブルなので、CDBやらPDBやらがあるのだがそれは次回に細かく検証することにする。

停止

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

起動

SQL> startup
ORACLE instance started.
Total System Global Area  792723456 bytes
Fixed Size     2929400 bytes
Variable Size   545262856 bytes
Database Buffers   239075328 bytes
Redo Buffers     5455872 bytes
Database mounted.
Database opened.

まとめ

Oracle Database 12cを新規インストールしてみた。ここまでの手順は11gR2と大きく変わったところはなく、簡単に入れられた。新機能検証は次回以降に書くことにする。とりあえずここまで。

関連記事