博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle 12C R2-新特性-多租户:支持本地UNDO模式
阅读量:4071 次
发布时间:2019-05-25

本文共 5839 字,大约阅读时间需要 19 分钟。

在12.1中,所有的在一个实例中的PDB只能共享同一个UNDO表空间。在12.2中它们都有各自的undo表空间了。这种新的管理机制就叫做本地undo模式。与此同时,在之前的版本中现在就成为是共享undo模式。

一.shared undo 转换为local undo模式

1.查询当前模式

SQL> select property_name, property_value from   database_properties where  property_name = 'LOCAL_UNDO_ENABLED';no rows selectedSQL> select con_id, tablespace_name from   cdb_tablespaces where  tablespace_name like 'UNDO%' order by con_id;    CON_ID TABLESPACE_NAME---------- ------------------------------	 1 UNDOTBS1SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/shiyu/system01.dbf/u01/app/oracle/oradata/shiyu/pdbseed/system01.dbf/u01/app/oracle/oradata/shiyu/sysaux01.dbf/u01/app/oracle/oradata/shiyu/pdbseed/sysaux01.dbf/u01/app/oracle/oradata/shiyu/undotbs01.dbf/u01/app/oracle/oradata/shiyu/users01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/system01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/sysaux01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/users01.dbfSQL> alter session set container=ORCLPDB;                                                                                                  Session altered.SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/shiyu/undotbs01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/system01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/sysaux01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/users01.dbf

2.切换为local undo 模式

SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup upgradeORACLE instance started.Total System Global Area  843055104 bytesFixed Size		    8798360 bytesVariable Size		  591400808 bytesDatabase Buffers	  239075328 bytesRedo Buffers		    3780608 bytesDatabase mounted.Database opened.SQL> alter database local undo on;Database altered.SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startupORACLE instance started.Total System Global Area  843055104 bytesFixed Size		    8798360 bytesVariable Size		  591400808 bytesDatabase Buffers	  239075328 bytesRedo Buffers		    3780608 bytesDatabase mounted.Database opened.SQL> show pdbs    CON_ID CON_NAME			  OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------	 2 PDB$SEED			  READ ONLY  NO	 3 ORCLPDB			  MOUNTEDSQL> alter session set container=ORCLPDB;Session altered.SQL> alter database open;Database altered.SQL> show pdbs    CON_ID CON_NAME			  OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------	 3 ORCLPDB			  READ WRITE NO

3.验证:

SQL> col property_name for a25;SQL>col property_value for a25;SQL> select property_name,property_value from database_properties where property_name='LOCAL_UNDO_ENABLED';PROPERTY_NAME		  PROPERTY_VALUE------------------------- -------------------------LOCAL_UNDO_ENABLED	  TRUESQL> select con_id, tablespace_name from cdb_tablespaces where  tablespace_name like 'UNDO%' order by con_id;    CON_ID TABLESPACE_NAME---------- ------------------------------	 1 UNDOTBS1	 3 UNDO_1SQL> alter session set container=ORCLPDB;Session altered.SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/shiyu/orclpdb/system01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/sysaux01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/users01.dbf/u01/app/oracle/oradata/shiyu/orclpdb/system01_i1_undo.dbf

二、local undo 转换为shared undo模式

1.查看当前模式

SQL> col property_name for a25;SQL>col property_value for a25;SQL> select property_name,property_value from database_properties where property_name='LOCAL_UNDO_ENABLED';PROPERTY_NAME		  PROPERTY_VALUE------------------------- -------------------------LOCAL_UNDO_ENABLED	  TRUE

2.查看ROOT和自己定义的pdb对应的undo表空间

SQL> select con_id, tablespace_name from cdb_tablespaces where  tablespace_name like 'UNDO%' order by con_id;    CON_ID TABLESPACE_NAME---------- ------------------------------	 1 UNDOTBS1	 3 UNDO_1

3.切换成shared undo模式

SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup upgradeORACLE instance started.Total System Global Area  843055104 bytesFixed Size		    8798360 bytesVariable Size		  591400808 bytesDatabase Buffers	  239075328 bytesRedo Buffers		    3780608 bytesDatabase mounted.Database opened.SQL> alter database local undo off;Database altered.SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup ORACLE instance started.Total System Global Area  843055104 bytesFixed Size		    8798360 bytesVariable Size		  591400808 bytesDatabase Buffers	  239075328 bytesRedo Buffers		    3780608 bytesDatabase mounted.Database opened.

4.验证

QL> col property_name for a25;SQL> col property_value for a25;SQL> select property_name,property_value from database_properties where property_name='LOCAL_UNDO_ENABLED';PROPERTY_NAME		  PROPERTY_VALUE------------------------- -------------------------LOCAL_UNDO_ENABLED	  FALSE

注意:虽然已经不是本地undo模式了,但是之前存在的undo表空间不会自动删除。如果碍事,要手动删除。

SQL> select con_id, tablespace_name from   cdb_tablespaces  where  tablespace_name like 'UNDO%' order by con_id;    CON_ID TABLESPACE_NAME---------- ------------------------------	 1 UNDOTBS1	 3 UNDO_1

删除多余的undo表空间

SQL> alter session set container=ORCLPDB;Session altered.SQL> select file_name from dba_data_files where  tablespace_name = 'UNDOTBS1';no rows selectedSQL> select file_name from dba_data_files where  tablespace_name = 'UNDO_1';FILE_NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/shiyu/orclpdb/system01_i1_undo.dbfSQL> drop tablespace undo_1;Tablespace dropped.SQL> select file_name from dba_data_files where  tablespace_name = 'UNDO_1';no rows selected
随着所有老的undo表空间被移除了,现在该实例就是运行在共享undo模式上了。

转载地址:http://cdhji.baihongyu.com/

你可能感兴趣的文章
redis sharding方案
查看>>
程序员最核心的竞争力是什么?
查看>>
Node.js机制及原理理解初步
查看>>
linux CPU个数查看
查看>>
分布式应用开发相关的面试题收集
查看>>
简单理解Socket及TCP/IP、Http、Socket的区别
查看>>
利用HTTP Cache来优化网站
查看>>
利用负载均衡优化和加速HTTP应用
查看>>
消息队列设计精要
查看>>
分布式缓存负载均衡负载均衡的缓存处理:虚拟节点对一致性hash的改进
查看>>
分布式存储系统设计(1)—— 系统架构
查看>>
MySQL数据库的高可用方案总结
查看>>
常用排序算法总结(一) 比较算法总结
查看>>
SSH原理与运用
查看>>
SIGN UP BEC2
查看>>
S3C2440中对LED驱动电路的理解
查看>>
《天亮了》韩红
查看>>
Windows CE下USB摄像头驱动开发(以OV511为例,附带全部源代码以及讲解) [转]
查看>>
出现( linker command failed with exit code 1)错误总结
查看>>
iOS开发中一些常见的并行处理
查看>>