Orcle 12c 新特性---PDB支持logging

1 说明

The PDB LOGGING or NOLOGGING clause can be specified in a CREATE or ALTER PLUGGABLE DATABASE statement to set or modify the logging attribute of the pluggable database (PDB). This attribute is used to establish the logging attribute of tablespaces created within the PDB if the LOGGING clause was not specified in the CREATE TABLESPACE statement.

If a PDB LOGGING clause is not specified in the CREATE PLUGGABLE DATABASE statement, the logging attribute of the PDB defaults to LOGGING.

从12.1.0.2开始,PDB支持logging子句。可以通过CREATE或者ALTER PLUGGABLE DATABASE语句来设置或修改PDB的logging属性。如果CREATE TABLESPACE没有执行logging属性,那么会继承所在的PDB的logging属性。如果在创建PDB时,没有指定logging子句,那么默认为LOGGING。这个新特性提高了PDB的管理性。

  • LOGGING:控制DML操作是否记录到redo日志文件中。

2 实验

2.1 查看当前PDB LOGGING属性

SQL> col name for a20
SQL> select LOGGING,t.NAME from dba_pdbs s,v$pdbs t
where s.CON_ID=t.CON_ID;
LOGGING    NAME
------------------ --------------------
LOGGING    PDB$SEED
LOGGING    LEI1
LOGGING    LEI2

2.2 修改PDB

注意:PDB要以restrict模式打开。否则报错:ORA-65045: pluggable database not in a restricted mode

SQL> shutdown immediate;
Pluggable Database closed.

SQL> startup restrict;
Pluggable Database opened.

SQL> alter pluggable database lei1 NOLOGGING;
Pluggable database altered.

SQL> show pdbs;
    CON_ID CON_NAME	OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
 3 LEI1   READ WRITE YES

SQL> select LOGGING,t.NAME from dba_pdbs s,v$pdbs t
where s.CON_ID=t.CON_ID;  2  
LOGGING    NAME
------------------ --------------------
NOLOGGING	   LEI1

已经修改成功,重启启动PDB,正常方式打开PDB。

2.3 创建PDB-NOLOGGING

–创建用于存储PDB数据文件的目录

[oracle@db12CR2 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/sihong

–通过种子库(PDBSEED)来创建PDB

以NOLOGGING创建PDB,因为默认是LOGGING

SQL> create pluggable database sihong admin user cndba identified by cndba
file_name_convert=('/u01/app/oracle/oradata/orcl/pdbseed/','/u01/app/oracle/oradata/orcl/sihong/') NOLOGGING;  2  
Pluggable database created.

–查看新建PDB的LOGGING属性

SQL> COL NAME FOR a20
select LOGGING,t.NAME from dba_pdbs s,v$pdbs t
where s.CON_ID=t.CON_ID;
LOGGING    NAME
------------------ --------------------
LOGGING    PDB$SEED
NOLOGGING	   LEI1
LOGGING    LEI2
NOLOGGING SIHONG

猜你喜欢

转载自blog.csdn.net/qianglei6077/article/details/92579330