• 设置pdb自动启动


    参考文档:
    How to Preserve Open Mode of PDBs When the CDB Restarts (Doc ID 1933511.1)


    -- 查看pdb的保留状态.无保留状态

    1. select * from DBA_PDB_SAVED_STATES;
    2. SYS@cdbtest SQL> select * from DBA_PDB_SAVED_STATES;
    3. no rows selected
    4. SYS@cdbtest SQL>

    -- 查看pdb 的当前的open mode

    select CON_ID, NAME, OPEN_MODE, RESTRICTED, OPEN_TIME  from gv$containers;

    -- 将pdb状态设置为保持现状(当前各个pdb状态为open)

    ALTER PLUGGABLE DATABASE all SAVE STATE;

    -- 取消pdb的保持状态

    1. ALTER PLUGGABLE DATABASE all DISCARD STATE;
    2. SYS@cdbtest SQL> ALTER PLUGGABLE DATABASE all SAVE STATE;
    3. Pluggable database altered.
    4. SYS@cdbtest SQL>

    -- 重启库测试,pdb可以自动起来 

    1. SYS@cdbtest SQL> ALTER PLUGGABLE DATABASE all SAVE STATE;
    2. Pluggable database altered.
    3. SYS@cdbtest SQL>
    4. SYS@cdbtest SQL> shutdown immediate
    5. Database closed.
    6. Database dismounted.
    7. ORACLE instance shut down.
    8. SYS@cdbtest SQL> startup
    9. ORACLE instance started.
    10. Total System Global Area 2785014256 bytes
    11. Fixed Size 9167344 bytes
    12. Variable Size 1191182336 bytes
    13. Database Buffers 1577058304 bytes
    14. Redo Buffers 7606272 bytes
    15. Database mounted.
    16. Database opened.
    17. SYS@cdbtest SQL> show pdbs;
    18. CON_ID CON_NAME OPEN MODE RESTRICTED
    19. ---------- ------------------------------ ---------- ----------
    20. 2 PDB$SEED READ ONLY NO
    21. 3 TEST READ WRITE NO
    22. 4 ORCL READ WRITE NO
    23. 5 BAK READ WRITE NO
    24. SYS@cdbtest SQL>

    -- 在12.2.0.1上,可以设置触发器,来使pdb自动启动
    As it was mentioned above saving the open state of a PDB is available since 12.1.0.2.
    For 12.1.0.1 you may create a database startup trigger to place PDB(s) into a particular open mode at DB startup.

    e.g. To open all PDBs at CDB startup, create the following trigger in CDB:

    1. CREATE TRIGGER open_all_pdbs
    2. AFTER STARTUP ON DATABASE
    3. BEGIN
    4. EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
    5. END ;
    6. /

    -- 补充推荐在rac上保留pdb的状态

    Saving the state for PDBs for RAC databases is not recommended. 

    Oracle RAC will open PDBs on a node if Services are defined on that PDB. It is no longer necessary to save state in Oracle RAC environments. 
    PDBs may open on nodes where it was not intended.
    Per note "Services running simultaneously on preferred and available instances in a multitenant RAC database (Doc ID 2757584.1),"

    > In RAC it is not recommended to save the state of PDBs. RAC will open the PDBs on a node if the services are defined on that PDB. 
    > It is no longer necessary to save the state in RAC environments.
    > Saving state leads to opening the service/PDB on the nodes where it is not intended and the performance may be affected adversely.
    > An additional check is introduced in Oracheck to give warning about the saved state.
     

    END

  • 相关阅读:
    解决 Could not resolve com.android.tools.build:gradle:4.2.2 问题
    浅谈深度学习中的概率
    这些并发容器的坑,你要谨记!
    【Canvas与艺术】绘制铜质钢底24周年纪念章
    利用idea基于java springboot框架开发环境搭建
    Docker安装Elasticsearch 8.x 、Kibana 8.x等
    qt pro如何增加自定义值为的字符串的宏
    Spring Cloud Stream详解
    前端是leyui后端sqlserver和maraDB进行分页
    快速排序超详细讲解C语言
  • 原文地址:https://blog.csdn.net/xxzhaobb/article/details/134503881