0
0

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 1 year has passed since last update.

Oracle マルチテナントDBでPDBの起動を自動化するコマンド

Posted at

PDBの自動起動

11gや12cから19cになるとマルチテナント構成が必須となるため、
不慣れだとPDBを起動し忘れることがある。
その場合はPDBを自動起動に設定することで解消される。

通常起動の場合
sqlplus / as sysdba
SQL>startup
SQL>show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL>show pdbs
# CDBを起動するとPDBMOUNT状態
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SAMPLEPDB                      MOUNTED

# ALTER文でOPENする必要がある
SQL>alter pluggable database SAMPLEPDB open;

SQL>show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SAMPLEPDB                      READ ONLY  NO
自動起動の設定
SQL>alter pluggable database SAMPLEPDB save state;

※上記のコマンドは現在の状態をセーブするため、PDBを起動した状態で実行する必要がある。

自動起動の場合
sqlplus / as sysdba
SQL>startup
SQL>show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SAMPLEPDB                      READ ONLY  NO
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?