oracle課堂筆記--第二十一天

來源:互聯網
上載者:User

標籤:就會   支援   guarantee   ges   lob   images   cal   spec   覆蓋   

死結:

session1:

SQL> select * from t1;

 

         X

----------

         1

         2

SQL> update t1 set x=11 where x=1;

session2:

SQL> update t1 set x=22 where x=2;

session1:

SQL> update t1 set x=222 where x=2; 阻塞

session2:

SQL> update t1 set x=111 where x=1; 死結

ERROR at line 1:

ORA-00060: deadlock detected while waiting for resource

$ vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

 

鎖和外鍵

select … for update     select * from t1 for update;

撤銷管理

什麼是撤銷資料:

 

 

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;

select * from session_history; 全球化支援

$ 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;

oracle課堂筆記--第二十一天

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.