The experiment environment creates two PDB, this experiment realizes when the database is opened, realizes pluggable database PDB2 self-start:
Original environment:
Sql> Shu Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> Startup
ORACLE instance started.
Total System Global area 943718400 bytes
Fixed Size 2931136 bytes
Variable Size 650118720 bytes
Database buffers 285212672 bytes
Redo buffers 5455872 bytes
Database mounted.
Database opened.
Sql> select Name,open_mode from V$pdbs;
NAME Open_mode
------------------------------ ----------
Pdb$seed READ only
PDBYCR Mounted
PDB2 Mounted
Sql>
Create TRIGGER:
sql> CREATE TRIGGER OPEN_PDB_PDB2
2 after STARTUP
3 on DATABASE
4 BEGIN
5 EXECUTE IMMEDIATE ' alter pluggable database PDB2 open ';
6 END Open_all_pdbs;
7/
Trigger created.
Sql> Shu Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> Startup
ORACLE instance started.
Total System Global area 943718400 bytes
Fixed Size 2931136 bytes
Variable Size 650118720 bytes
Database buffers 285212672 bytes
Redo buffers 5455872 bytes
Database mounted.
Database opened.
Sql> select Name,open_mode from V$pdbs;
NAME Open_mode
------------------------------ ----------
Pdb$seed READ only
PDBYCR Mounted
PDB2 READ WRITE
Implemented PDB2 self-booting, you can start different PDB by modifying the SQL statement in the trigger script or implement the self-boot of all PDB, the script is as follows:
CREATE TRIGGER OPEN_PDB_PDB2
After STARTUP
On DATABASE
BEGIN
EXECUTE IMMEDIATE ' alter pluggable database PDB2 open ';
END Open_all_pdbs;
/
Observe the alert log with the following message:
Opening pdb Pdb$seed (2) with no Resource Manager plan active
Alter pluggable database PDB2 Open
Database Characterset for PDB2 is we8mswin1252
Due to limited space in shared pool (need 6094848 bytes, with 3981120 bytes), limiting Resource Manager entities from 2048 to 32
Opening pdb PDB2 (4) with no Resource Manager plan active
Pluggable database PDB2 opened read Write
Completed:alter Pluggable Database Pdb2 Open
Starting background Process CJQ0
Completed:alter DATABASE OPEN
Oracle 12C Pluggable database self-booting