restore:恢復檔案
recover: 恢復日誌
丟失active日誌組:
恢復資料塊
故障:sql> create tablespace tbs01 datafile '/home/oracle/tbs01.dbf' size 5m;
sql> create table t1 tablespace tbs01 as select * from dba_objects where rownum<=30000;
rman> backup tablespace tbs01;
sql> alter system flush buffer_cache;
$ dd of=/home/oracle/tbs01.dbf bs=8k conv=notrunc seek=300< select count(*) from t1; 報錯
$ dbv file='/home/oracle/tbs01.dbf'
恢復:sql> select file#, block# from v$database_block_corruption;
rman> recover datafile 6 block 300;
rman> recover corruption list;
dbms_repair包隔離資料塊
rman恢復目錄
sql> show parameter control_file_record_keep_time
用dbca建立資料庫rc(不配置em、fra,200m記憶體,字符集unicode)
或者:用netca建立主機連線字串rc指向自身。
rc:$ sqlplus sys/password@rc as sysdba
sql> create tablespace rc_tbs datafile '/home/oracle/rc_tbs.dbf' size 50m;
sql> create user rcowner identified by password default tablespace rc_tbs quota unlimited on rc_tbs;
sql> grant recovery_catalog_owner to rcowner;
$ rman catalog rcowner/password@rc
rman> create catalog;
$ rman target sys/password@orcl catalog rcowner/password@rc
或$ rman target / catalog rcowner/password@rc
rman> register database;
dbca刪除rc
flashback
功能 依賴元件 相關引數 典型錯誤
query undo tbs undo_retention dml
version query undo tbs undo_retention dml
flashback table undo tbs undo_retention dml
flashback drop recyclebin recyclebin, freespace drop table
transaction query supplemental log dml
fda flashback archive dml
database flashback log db_flashback_retention_target ddl
sys不允許閃回,建立新使用者
sql> create user user01 identified by password;
sql> grant dba to user01;
sql> conn user01/password
flashback query 閃回查詢
user01:
sql> create table t1(x int);
sql> create index t1_x_idx on t1(x);
sql> insert into t1 values (1);
sql> commit;
sql> select sysdate from dual;
sql> select dbms_flashback.get_system_change_number from dual;
sql> delete t1;
sql> commit;
sql> select * from t1;
sql> select * from t1 as of scn 1446069;
sql> select * from t1 as of timestamp to_timestamp('2015-10-28 10:31:54', 'yyyy-mm-dd hh24:mi:ss');
sql> truncate table t1;或alter table t1 move;或收縮資料檔案
sql> select * from t1 as of scn 1446069; 物理結構變化,閃回失敗
logminer
flashback version query 閃回版本查詢
sql> create table t1(x int);
sql> insert into t1 values (1);
sql> commit;
sql> update t1 set x=2;
sql> commit;
sql> update t1 set x=3;
sql> commit;
sql> update t1 set x=4;
sql> commit;
sql> select versions_starttime, versions_endtime, versions_xid, versions_operation, x
from t1
versions between scn minvalue and maxvalue
order by versions_starttime;
versions between timestamp to_timestamp('2015-10-28 9:00:00', 'yyyy-mm-dd hh24:mi:ss') and to_timestamp('2015-10-28 10:00:00', 'yyyy-mm-dd hh24:mi:ss')
sql> truncate table t1; 物理結構改變,查詢失敗
flashback table 閃回表 dept:部門
sql> conn user01/password
sql> create table my_dept(deptno int primary key, dname varchar2(20));
sql> create table my_emp(empno int primary key, deptno int references my_dept);
sql> insert into my_dept values (10, 'sales');
sql> insert into my_emp values (100, 10);
sql> commit;
sql> select dbms_flashback.get_system_change_number from dual;
sql> delete my_emp;
sql> delete my_dept;
sql> commit;
sql> alter table my_dept enable row movement;
sql> alter table my_emp enable row movement; enable:啟用
sql> flashback table my_emp to scn 1451706; 失敗
sql> flashback table my_dept to scn 1451706;
sql> flashback table my_emp to scn 1451706;
sql> select index_name, status from user_indexes where table_name='my_emp';自動維護索引
sql> select index_name, status from user_indexes where table_name='my_dept';
sql> truncate table my_emp;
sql> flashback table my_emp to scn 1451706; 失敗
Python 第十六天
魔法方法總是被雙下劃線包圍 例如 init 注 魔法方法第乙個引數為cls 類方法 或者self 例項方法 其中 cls 代表乙個類名稱 self 代表乙個例項物件的名稱 基本方法 init self 構造器,當乙個例項被建立的時候呼叫的初始化方法 new cls 是在乙個物件例項化的時候所呼叫的第...
寒假第十六天
abs x 返回數字的絕對值,如abs 10 返回 10 ceil x 返回數字的上入整數,如math.ceil 4.1 返回 5 cmp x,y 如果 x y 返回 1,如果 x y 返回 0,如果 x y 返回 1 exp x 返回e的x次冪 ex 如math.exp 1 返回2.7182818...
python第十六天
一 包 1 什麼是包?一系列模組的集合 2 有什麼用?包通過資料夾來管理一系列功能相近的模組 3 包重點?包中一定有乙個專門用來管理包中所有模組的檔案 init 4 什麼是包名?包名是存放一系列模組的資料夾名字 5 包名有什麼用 包名 包物件 存放的是管理模組的那個檔案的位址,指向其全域性命名空間。...