Bo's Oracle Station

查看: 2298|回复: 0

课程第50/51/52次(2018-05-27星期日上下午,2018-05-28星期一)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-5-27 09:59:02 | 显示全部楼层 |阅读模式
获取SCN号的两个办法:
  1. SQL> select  dbms_flashback.GET_SYSTEM_CHANGE_NUMBER  from dual;

  2. GET_SYSTEM_CHANGE_NUMBER
  3. ------------------------
  4.                  4658866

  5. SQL>  select timestamp_to_scn(sysdate) from v$database;

  6. TIMESTAMP_TO_SCN(SYSDATE)
  7. -------------------------
  8.                   4658868
复制代码

TSPITR的结论:
1. 与11g和12c普通的数据库除了语法上:表空间/插件数据库:表空间 以外,其他的没有任何区别。
2. 在克隆数据上做的不完全恢复,然后EXPDB再IMPDP进原数据库,IMPDP之后克隆数据库被删除。
Screenshot.png


PDB PITR与TSPITR还是有很大的区别:没有明确EXPDP 和IMPDP,没有换位置修,只是换实例修。首先要你自己去restore。
alter pluggable database pdb2 open要修文件,
正确的做法:alter pluggable database pdb2 open resetlogs;


在根容器上创建cdb资源计划:
  1. DECLARE
  2. spfileValue VARCHAR2(1000);
  3. execText VARCHAR2(1000);
  4. scopeValue VARCHAR2(30) := 'MEMORY';
  5. planName VARCHAR2(100) :='FAIRPLAN';
  6. BEGIN
  7. dbms_resource_manager.clear_pending_area();
  8. dbms_resource_manager.create_pending_area();
  9. dbms_resource_manager.create_cdb_plan( plan => 'FAIRPLAN', comment => 'FAIRPLAN');
  10. dbms_resource_manager.create_cdb_plan_directive(
  11.     plan => 'FAIRPLAN',
  12.     pluggable_database => 'PDB2',
  13.     comment => '',
  14.     shares => 1,
  15.     utilization_limit => NULL,
  16.    parallel_server_limit => NULL );
  17. dbms_resource_manager.create_cdb_plan_directive(
  18.     plan => 'FAIRPLAN',
  19.     pluggable_database => 'PDB2_2',
  20.     comment => '',
  21.     shares => 1,
  22.     utilization_limit => NULL,
  23.    parallel_server_limit => NULL );
  24. dbms_resource_manager.submit_pending_area();
  25. END;
  26.                         
复制代码
  1. SELECT con_id, Plan from CDB_CDB_Rsrc_Plans
  2. WHERE Con_ID = 1 AND Plan IN ('FAIRPLAN', 'UNFAIRPLAN')
  3. ORDER BY 1;


  4. ----
  5. select Plan, Pluggable_Database, Shares
  6. from CDB_CDB_Rsrc_Plan_Directives
  7. where Con_ID = 1
  8. and Plan in ('FAIRPLAN', 'UNFAIRPLAN')
  9. and Pluggable_Database in ('PDB2', 'PDB2_2')
  10. order by 1, 2;
复制代码

做多租户书后练习P248要:

a.png

AWR的构成:
  1. select  table_name ,   substr( table_name , 3,1 )
  2. from cdb_tables t   
  3. where t.CON_ID=1 and
  4.   table_name like 'WR_$\_%'  escape '\';
  5.   
  6.   select  substr( table_name , 3,1 ), count(*)
  7. from cdb_tables t
  8. where t.CON_ID=1 and
  9.   table_name like 'WR_$\_%'  escape '\'
  10.   group by substr( table_name , 3,1 );
复制代码

CDB上的统一审计:

有没开这个功能:
  1. [oracle@station90 admin]$ sqlplus  / as sysdba

  2. SQL*Plus: Release 12.1.0.2.0 Production on Mon May 28 20:18:05 2018

  3. Copyright (c) 1982, 2014, Oracle.  All rights reserved.


  4. Connected to:
  5. Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  6. With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
  7. and Unified Auditing options

复制代码

应该在每一个插件数据库里执行
  1. 包括细粒度审计等的所有审计的视图:
  2. select  * from dict where table_name like '%AUDIT%';

  3. 查看已经创建的统一审计策略:
  4. select  * from  audit_unified_policies;

  5. 能够执行的统一审计品种:
  6. select  * from AUDIT_ACTIONS;

  7. 生效的统一审计策略:
  8. select  * from AUDIT_UNIFIED_ENABLED_POLICIES;

  9. 统一审计的轨迹:
  10. select  * from  V_$UNIFIED_AUDIT_TRAIL    u
  11. where u.UNIFIED_AUDIT_POLICIES='AUDIT_TABLESPACE' ;

  12. select  * from UNIFIED_AUDIT_TRAIL  where action_name like '%TABLESPACE%';


  13. -------------------------------------------实验的步骤:


  14. CREATE AUDIT POLICY audit_tablespace
  15. ACTIONS create tablespace;


  16. noaudit policy audit_tablespace ;

  17. audit policy audit_tablespace  whenever successful;
  18. ---------------------------------------下面去创建表空间



复制代码

在根容器上查看所有人的统一审计轨迹:
  1. SELECT con_id, dbusername, action_name, object_name  FROM
  2. cdb_unified_audit_trail
复制代码

优化器统计信息:
  1. select   t.num_rows   from cdb_tables t
  2. where t.owner='HR' and t.table_name='T04209_UNAME';

  3. select  * from cdb_tab_col_statistics   tc where tc.owner='HR'
  4. and tc.table_name='T04209_UNAME'
  5. ;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-3-29 14:20 , Processed in 0.039690 second(s), 27 queries .

快速回复 返回顶部 返回列表