- Below are the steps to start pluggable DB automatically during startup of container database.
1.
Pre validation
-
Check
the current status of pluggable database if it no-mount status then open
it in read write mode.
[oracle@19cnode1 ~]$ sqlplus
SQL*Plus: Release
19.0.0.0.0 - Production on Thu Mar 26 23:17:28 2020
Version 19.3.0.0.0
Copyright (c) 1982,
2019, Oracle. All rights reserved.
Enter user-name: /as
sysdba
Connected to an idle
instance.
SQL> startup;
ORACLE instance
started.
Total System Global
Area 1593832624 bytes
Fixed Size 9135280 bytes
Variable Size 956301312 bytes
Database Buffers 620756992 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
-
Check
status of pluggable database(sale).
CON_ID NAME OPEN_MODE
---------- -------- ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 SALE NOMOUNT
-
Startup
pluggable database in read write mode.
SQL> alter
pluggable database sale open;
Pluggable database
altered.
CON_ID NAME OPEN_MODE
---------- -------- ----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 SALE READ WRITE
2.
Change setting to enable Auto start
pluggable database.
SQL> select CON_ID,
CON_NAME, STATE from dba_pdb_saved_states;
no rows selected
SQL>
SQL> alter
pluggable database sale save state;
Pluggable database
altered.
SQL> alter
pluggable database sale close;
Pluggable database
altered.
SQL> shut
immediate;
Database closed.
Database dismounted.
ORACLE instance shut
down.
3.
Validation.
-
Start
container database and check pluggable database status it should be read
write.
SQL> startup;
ORACLE instance
started.
Total System Global
Area 1593832624 bytes
Fixed Size 9135280 bytes
Variable Size 956301312 bytes
Database Buffers 620756992 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
SQL> select
CON_ID, NAME, OPEN_MODE from V$CONTAINERS;
CON_ID NAME OPEN_MODE
---------- --------
----------
1 CDB$ROOT READ WRITE
2 PDB$SEED READ ONLY
3 SALE READ WRITE
SQL>