1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Oracle PDBは利用時にはOPENする必要がある

Posted at

現象

Oracleを起動したはずなのに、Sqldeveloperから接続しようとすると「データベースをオープンされていません」「database not open」とエラーが出てしまい接続できないとエラーが出ることがある。
接続の対象がPDBで会った場合には以下の手順でデータベースをオープンすることで現象が解決する。

エラーメッセージ
リクエストされた操作の実行中にエラーが発生しました:
 
ORA-01109: データベースがオープンされていません。
01109. 00000 -  "database not open"
*Cause:    A command was attempted that requires the database to be open.
*Action:   Open the database and try the command again
ベンダー・コード1109

解決法

上記のようなエラーが出た場合、PDBをホストするCDBが起動してPDBをマウントだけしている状態である。
まずは、Oracleのホストサーバーを開きDBA権限で接続しよう。

DBAで接続
sqlplus <user>/<password> AS SYSDBA

ここで、PDBのステータスを確認するために以下のコマンドを実行する。

PDBステータス確認
show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 <PDBNAME>                      MOUNTED

読み書きを可能にするには状態を変更する必要があるので、以下のコマンドを実行する。

alter pdb
alter pluggable database <PDBNAME> open;

あるいは、特定のPDBのみを変更するには

alter specific pdb
alter pluggable database <PDBNAME> open;

あらためてステータスを確認して、以下のようになっていればOKである。

PDBステータス確認
show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 <PDBNAME>                      READ WRITE NO
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?