学习笔记 二

######################
###从回收站还原表
FLASHBACK TABLE <table_name>
TO BEFORE DROP<wbr> [ RENAME TO &lt;new_name&gt; ] ;<br> :闪回删除的表时,恢复的索引、触发器和约束条件将保留各自的回收站名称。因此,建议在闪回删除的表前查询回收站和DBA_CONSTRAINTS。使用这种方法,可以将恢复的索引、触发器和约束条件重命名为更实用的名称。<br><br> ####回收站:手动回收空间<br> PURGE {TABLE &lt;table_name&gt; |INDEX &lt;index_name&gt; }<br> PURGE TABLESPACE &lt;ts_name&gt;<wbr> [USER &lt;user_name&gt;]<br> PURGE [USER_ | DBA_] RECYCLEBIN<br><br> ##不使用回收站<br> DROP TABLESPACE &lt;ts_name&gt;<br> [INCLUDING CO NTENTS] ;<br> DROP USER &lt;user_name&gt; [CASCADE] ;<br> DROP TABLE &lt;t able_name&gt; [ PURGE ] ;<br><br> ###查询回收站<br> SELECT owner, original_name, object_name,<br> type, ts_name, droptime, re lated, space<br> FROM<wbr> dba_recyclebin<br> WHERE can_undrop = 'YES';<br><br> SELECT original_name, object_name,<br> type, ts_name, droptime, re lated, space<br> FROM<wbr> user_recyclebin<br> WHERE can_undrop = 'YES';<br><br> SQL&gt; SHOW<wbr> RECYCLEBIN<br><br> ######查询已删除的表中的数据<br><br> SELECT ...<br> FROM "BIN$zbjrBdpw==$0" [ AS OF ...]<br> WHERE<wbr> ...<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><br><br><br> ####闪回数据库:示例<br> RMAN&gt; FLASHBACK DA TABASE TO TIME =<br> 2&gt; "TO_DATE('27.05.04 16:00:00',<br> 3&gt; 'YYYY-MM-DD<wbr> HH24:MI:SS')";<br><br> RMAN&gt; FLASHBACK DATA BASE TO SCN=23565;<br><br> RMAN&gt; FLASHBACK DATABASE<br> 2&gt; TO SEQUENCE=223 THREAD=1;<br> ##<br> SQL&gt; FLASHBACK DATABASE<br> 2<wbr> TO TIMESTAMP (SYSDATE-1/24);<br><br> SQL&gt; FLASHBACK DATABASE TO SCN 53943;<br><br> SQL&gt; FLASHBACK DATABASE TO RESTORE POINT b4_load;<br><br> ##监视闪回数据库<br> 查看快速恢复区磁盘限额:<br> SQL&gt; SELECT estimated_flashback_size,<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr> flashback_size<br><wbr>FROM<wbr><wbr> V$FLASHBACK_DATABASE_LOG;<br><br> 确定当前闪回窗口:<br> SQL&gt; SELECT oldest_flashback_scn,<br><wbr><wbr><wbr><wbr> oldest_flashback_time<br><wbr><wbr><wbr><wbr><wbr> FROM<wbr><wbr> V$FLASHBACK_DATABASE_LOG;<br><br> 监视闪回数据库日志中的事件记录:<br> SQL&gt; SELECT *<br> 2<wbr> FROM<wbr><wbr> V$FLASHBACK_DATABASE_STAT;<br><br> ###可靠还原点<br> SQL&gt; CREATE RESTORE<wbr> POINT before_load<br> 2<wbr> GUARANTEE FL ASHBACK DATABASE;<br><br><br><br><br> #####################3<br> DBVERIFY 实用程序<br> $ dbv file=/u01/oradata/users01.dbf \<br><wbr><br> 对于裸设备,应使用END 参数,以免扫描的块范围超出数据文件空间末尾。<br> dbv FILE=/dev/rdsk/r1.dbf END=last_data_block#<br><br> ##ANALYZE命令<br> SQL&gt; ANALYZE TABLE table_name VALIDATE<br> 2 STRUCTURE CASCADE;<br> SQL&gt; ANALYZE INDEX index_name VALIDATE<br> 2<wbr> STRUCTURE;<br><br> ##BLOCKRECOVER命令<br> RMAN&gt; BLOCKRECOVER DATAFILE 6 BLOCK 3;<br><br> 使用BLOCKRECOVER的示例<br> 恢复一组损坏的块<br> BLOCKRECOVER DATAFILE 2 BLOCK 12, 13<br> DATAFILE 7 BLOCK 5, 98, 99 DATAFILE 9 BLOCK 19;<br> 此示例恢复一系列块,并且只从数据文件副本进行还原:<br> {<br> BLOCKRECOVER DATAFILE 3 BLOCK 1,2,3,4,5<br> TABLESPACE sales DBA 4194405, 4194409, 4194412<br> FROM DATAFILE COPY;<br> }<br> 注:DBA 是数据块地址。<br> 按备份标记限制BMR:<br> BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404, 4194405<br> FROM TAG "weekly_backup";<br> 下面的示例恢复SYSTEM 表空间中的两个块,并强制从创建时间至少在两天以前的<br> 备份中进行还原:<br> BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404, 4194405 RESTORE<br> UNTIL TIME 'SYSDATE-2';<br><br> 下面的示例恢复两个块,并强制使用在SCN 100<wbr> 之前执行的备份进行还原:<br> BLOCKRECOVER DATAFILE 9 BLOCK 13 DATAFILE 2 BLOCK 19 RESTORE<br> UNTIL SCN 100;<br> 下面的示例恢复两个块,并强制使用在日志序列7024 之前执行的备份进行还原:<br> BLOCKRECOVER DATAFILE 9 BLOCK 13 DATAFILE 2 BLOCK 19 RESTORE<br> UNTIL SEQUENCE 7024;<br><br> ###RMAN BMR<wbr> 接口<br> RMAN&gt; BLOCKRECOVER CORRUPTION LIST<br> 2&gt; RESTORE UNTIL T IME 'sysdate – 10';<br><br> 小结<br> 确定数据库损坏的原因:<br> – 硬件<br> – 软件<br> 使用下列功能检测数据库损坏:<br> – ANALYZE<br> – dbverify<br> – DB_BLOCK_CHECKING<br> – DBMS_REPAIR<br> 使用RMAN 修复数据库损坏<br><br> ###监视和管理内存<br> 使用多个缓冲区池<br> CREATE INDEX<wbr> cust_idx …<br> STORAGE (BUFFER_POOL KEEP …);<br><br> ALTER TABLE oe.customers<br> STORAGE (BUFFER_POOL RECYCLE);<br><br> ALTER INDEX oe.cust_lname_ix<br> STORAGE (BUFFER_POOL KEEP);<br><br><br><br><br><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>

你可能感兴趣的:(学习笔记)