|
获取SCN号的两个办法:
- SQL> select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER from dual;
- GET_SYSTEM_CHANGE_NUMBER
- ------------------------
- 4658866
- SQL> select timestamp_to_scn(sysdate) from v$database;
- TIMESTAMP_TO_SCN(SYSDATE)
- -------------------------
- 4658868
复制代码
TSPITR的结论:
1. 与11g和12c普通的数据库除了语法上:表空间/插件数据库:表空间 以外,其他的没有任何区别。
2. 在克隆数据上做的不完全恢复,然后EXPDB再IMPDP进原数据库,IMPDP之后克隆数据库被删除。
PDB PITR与TSPITR还是有很大的区别:没有明确EXPDP 和IMPDP,没有换位置修,只是换实例修。首先要你自己去restore。
alter pluggable database pdb2 open要修文件,
正确的做法:alter pluggable database pdb2 open resetlogs;
在根容器上创建cdb资源计划:
- DECLARE
- spfileValue VARCHAR2(1000);
- execText VARCHAR2(1000);
- scopeValue VARCHAR2(30) := 'MEMORY';
- planName VARCHAR2(100) :='FAIRPLAN';
- BEGIN
- dbms_resource_manager.clear_pending_area();
- dbms_resource_manager.create_pending_area();
- dbms_resource_manager.create_cdb_plan( plan => 'FAIRPLAN', comment => 'FAIRPLAN');
- dbms_resource_manager.create_cdb_plan_directive(
- plan => 'FAIRPLAN',
- pluggable_database => 'PDB2',
- comment => '',
- shares => 1,
- utilization_limit => NULL,
- parallel_server_limit => NULL );
- dbms_resource_manager.create_cdb_plan_directive(
- plan => 'FAIRPLAN',
- pluggable_database => 'PDB2_2',
- comment => '',
- shares => 1,
- utilization_limit => NULL,
- parallel_server_limit => NULL );
- dbms_resource_manager.submit_pending_area();
- END;
-
复制代码- SELECT con_id, Plan from CDB_CDB_Rsrc_Plans
- WHERE Con_ID = 1 AND Plan IN ('FAIRPLAN', 'UNFAIRPLAN')
- ORDER BY 1;
- ----
- select Plan, Pluggable_Database, Shares
- from CDB_CDB_Rsrc_Plan_Directives
- where Con_ID = 1
- and Plan in ('FAIRPLAN', 'UNFAIRPLAN')
- and Pluggable_Database in ('PDB2', 'PDB2_2')
- order by 1, 2;
复制代码
做多租户书后练习P248要:
AWR的构成:
- select table_name , substr( table_name , 3,1 )
- from cdb_tables t
- where t.CON_ID=1 and
- table_name like 'WR_$\_%' escape '\';
-
- select substr( table_name , 3,1 ), count(*)
- from cdb_tables t
- where t.CON_ID=1 and
- table_name like 'WR_$\_%' escape '\'
- group by substr( table_name , 3,1 );
复制代码
CDB上的统一审计:
有没开这个功能:
- [oracle@station90 admin]$ sqlplus / as sysdba
- SQL*Plus: Release 12.1.0.2.0 Production on Mon May 28 20:18:05 2018
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
- and Unified Auditing options
复制代码
应该在每一个插件数据库里执行
- 包括细粒度审计等的所有审计的视图:
- select * from dict where table_name like '%AUDIT%';
- 查看已经创建的统一审计策略:
- select * from audit_unified_policies;
- 能够执行的统一审计品种:
- select * from AUDIT_ACTIONS;
- 生效的统一审计策略:
- select * from AUDIT_UNIFIED_ENABLED_POLICIES;
- 统一审计的轨迹:
- select * from V_$UNIFIED_AUDIT_TRAIL u
- where u.UNIFIED_AUDIT_POLICIES='AUDIT_TABLESPACE' ;
- select * from UNIFIED_AUDIT_TRAIL where action_name like '%TABLESPACE%';
- -------------------------------------------实验的步骤:
- CREATE AUDIT POLICY audit_tablespace
- ACTIONS create tablespace;
- noaudit policy audit_tablespace ;
- audit policy audit_tablespace whenever successful;
- ---------------------------------------下面去创建表空间
复制代码
在根容器上查看所有人的统一审计轨迹:
- SELECT con_id, dbusername, action_name, object_name FROM
- cdb_unified_audit_trail
复制代码
优化器统计信息:
- select t.num_rows from cdb_tables t
- where t.owner='HR' and t.table_name='T04209_UNAME';
-
- select * from cdb_tab_col_statistics tc where tc.owner='HR'
- and tc.table_name='T04209_UNAME'
- ;
复制代码
|
|