zoukankan      html  css  js  c++  java
  • 20170811上课笔记

    撤销管理

    什么是撤销数据:

             1.交易的回退:没有提交的交易可以rollback

             2.交易的恢复:数据库崩溃时,将磁盘的不正确数据恢复到交易前

             3.读一致性  :被查询的记录有事务占用,转向回滚段找改前镜像

             4.闪回数据  :从回滚段中构造历史数据

    事务与撤销数据:

    redo和undo:

    AUM:

    3个参数,两个表空间属性

    undo_management=AUTO 回滚表空间段的段管理模式,管理员只需要备足够的表空间容量,oracle会自动管理扩展回滚段的数量。只能使用一个UNDO表空间。

    undo_tablespace:只有在自动管理模式下才可以使用。指明使用哪个UNDO表空间

    undo_retention=900 :

             提交之后旧的镜像保持在回滚段中的时间。

             非强制的回退保持时间.(回滚空间不足老的镜像就会被覆盖)

    autoextend:表空间自动扩展

    强制保持:但是对空间要求较大,要慎用。(10g开始支持)

    alter tablespace UNDOTABS1 RETENTION GUARANTEE;

    select  tablespace_name,RETENTION from dba_tablespaces;

    UNDO_RETENTION specifies (in seconds) how long already committed undo information is to be retained. The only time you must set this parameter is when:

    •The undo tablespace has the AUTOEXTEND option enabled

    •You want to set undo retention for LOBs

    •You want to guarantee retention

    undo advisor:

    调度作业

    $ ps -ef | grep cjq

    SQL> show parameter job_queue_processes

    后台预先设置的自动化管理作业:

    自定义作业:

    SQL> create table session_history(snap_time timestamp with local time zone, num_session number);

    em中创建作业:

    使用plsql块:

    declare

      session_count  number;

    begin

      select count(*) into session_count from v$session;

      insert into session_history values (systimestamp, session_count);

      commit;

    end;

    全球化支持

    1database

    show paramenter nls

    2client

    $ vi .bash_profile

    #export NLS_LANG=american_america.AL32UTF8

    #export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

    $ unset NLS_LANG

    $ unset NLS_DATE_FORMAT

    SQL> select sysdate from dual;

    3alter session set nls_date_format='dd-mon yyyy';//只影响1次回话中设置

    4select to_char(sysdate,'yyyy,month,dd');//单次sql影响

    1-4影响范围越来越小,但是优先级别越来越高

  • 相关阅读:
    centos7搭建nexus
    centos7搭建ftp
    tomcat笔记
    mysql跨服务器触发器
    IntelliJ IDEA笔记
    node.js笔记
    myeclipse笔记
    术语
    centos7安装mysql
    js跨域访问资源
  • 原文地址:https://www.cnblogs.com/guoxf/p/7352577.html
Copyright © 2011-2022 走看看