Oracle 10g資料庫的恢復

2021-06-20 20:15:16 字數 2963 閱讀 7507

非歸檔模式下資料庫的恢復:

非歸檔模式下資料庫的恢復主要指利用非歸檔模式下的冷備份恢復資料庫。

步驟為:

關閉資料庫。

shutdown immediate

將備份的所有資料檔案、控制檔案、聯機重做日誌檔案還原到原來所在的位置。

重新啟動資料庫。

startup

注意非歸檔模式下的資料庫恢復是不完全恢復,只能將資料庫恢復到最近一次完全冷備份的狀態。

歸檔模式下資料庫的完全恢復:

歸檔模式下資料庫的完全恢復是指歸檔模式下乙個或多個資料檔案損壞,利用熱備份的資料檔案替換損壞的資料檔案,再結合歸檔日誌檔案和聯機重做日誌檔案,採用前滾技術重做自備份以來的所有改動,採用回滾技術回滾未提交的操作,以恢復到資料庫故障時刻的狀態。

恢復的級別:資料庫級完全恢復、表空間級完全恢復、資料檔案級完全恢復

注意:資料庫級的完全恢復只能在資料庫裝載但沒有開啟的狀態下進行,而表空間級完全恢復和資料檔案級完全恢復可以在資料庫處於裝載狀態或開啟的狀態下進行。

歸檔模式下資料庫完全恢復的基本語法:

recover [automatic] [from 'location']

[database|tablespace tspname

|datafile dfname]

引數說明

automatic:進行自動恢復,不需要

dba提供重做日誌檔名稱;

location:制定歸檔重做日誌檔案的位置,預設為資料庫預設的歸檔路徑。

資料庫級完全恢復的步驟:

如果資料庫沒有關閉,則強制關閉資料庫。shutdown abort

利用備份的資料檔案還原所有損壞的資料檔案。

將資料庫啟動到mount

狀態。startup mount

執行資料庫恢復命令。recover database

開啟資料庫。alter database open;

表空間級完全恢復的步驟:

以example

表空間的資料檔案

example01.dbf

損壞為例模擬表空級的完全恢復。

資料庫處於裝載狀態下的恢復

如果資料庫沒有關閉,則強制關閉資料庫。shutdown abort

利用備份的資料檔案example01.dbf

還原損壞的資料檔案

example01.dbf。

將資料庫啟動到mount

狀態。startup mount

執行表空間恢復命令。recover tablespace example

開啟資料庫。alter database open;

資料庫處於開啟狀態下的恢復

①如果資料庫已經關閉,則將資料庫啟動到mount

狀態。startup mount

②將損壞的資料檔案設定為離線狀態。

alter database datafile 'd:\oracle\product\10.2.0\oradata\orcl\example01.dbf' offline;

③開啟資料庫。alter database open;

④將損壞的資料檔案所在的表空間離線。alter tablespace example offline for 

recover; 

⑤ 利用備份的資料檔案example01.dbf

還原損壞的資料檔案

example01.dbf。

⑥ 執行表空間恢復命令。recover tablespace example;

⑦ 將表空間聯機。alter tablespace example online;

如果資料檔案損壞時資料庫正處於開啟狀態,則可以

直接執行步驟(4

)~(7)。

資料檔案級完全恢復的步驟:

以資料檔案d:\oracle\product\10.2.0\oradata\orcl\example01.dbf

損壞為例模擬資料檔案級的完全恢復。

資料庫處於裝載狀態下的恢復

如果資料庫沒有關閉,則強制關閉資料庫。shutdown abort

利用備份的資料檔案example01.dbf

還原損壞的資料檔案

example01.dbf。

將資料庫啟動到mount

狀態。startup mount

執行資料檔案恢復命令。recover datafile 

'd:\oracle\product\10.2.0\oradata\orcl\example01.dbf';

將資料檔案聯機。alter database datafile 

'd:\oracle\product\10.2.0\oradata\orcl\example01.dbf' online

開啟資料庫。

alter database open;

資料庫處於開啟狀態下的恢復

如果資料庫已經關閉,則將資料庫啟動到mount

狀態。startup mount

將損壞的資料檔案設定為離線狀態。alter database datafile 

'd:\oracle\product\10.2.0\oradata\orcl\

example01.dbf' offline;

開啟資料庫。alter database open;

利用備份的資料檔案example01.dbf

還原損壞的資料檔案

example01.dbf。

執行資料檔案恢復命令。recover datafile 

'd:\oracle\product\10.2.0\oradata\orcl\example01.dbf';

將資料檔案聯機。alter database datafile 

'd:\oracle\product\10.2.0\oradata\orcl\example01.dbf' online;

如果資料檔案損壞時資料庫正處於開啟狀態,則可以直接

執行步驟(2

)、(4

)~(6)。

Oracle 10g資料庫管理

oracle 10g資料庫管理 課程介紹 本課程面向企業 oracle 10g 資料庫管理的學員。通過 oracle 10g 資料庫管理課程的系統培訓,使學員能夠在較短的時間內掌握 oralcle10g 資料庫管理和維護的各種技術,從而掌握最新版 oracle 的新特性和 oracle 資料通用技術...

oracle 10g 資料庫遷移

它是最常用最簡單的方法,一般是基於應用的owner級做匯出匯入。操作方法為 在新庫建立好owner和表空間,停老庫的應用,在老庫執行 exp user pwd owner file exp dmp log exp log buffer 6000000,匯入dmp檔案到新庫,在新庫執行如下命令 imp...

Oracle 10g資料庫概述

一 oracle 10g簡介 1 oracle 10g資料庫是首個為網咯計算而設計的資料庫 甲骨文公司的一款關聯式資料庫管理系統 2 分為以下幾個版本 a oracle 10g資料庫標準版 1 b oracle 10g資料庫標準版 c oracle 10g資料庫企業版 d oracle 10g資料庫...