国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Oracle RMAN快速入門指南--(2)

3. 恢復目錄

  3.1.恢復目錄的概念

  恢復目錄是由RMAN使用、維護的用來放置備份信息的倉庫。RMAN利用恢復目錄記載的信息去判斷如何執(zhí)行需要的備份恢復操作。

  恢復目錄可以存在于ORACLE數(shù)據(jù)庫的計劃中。

  雖然恢復目錄可以用來備份多個數(shù)據(jù)庫,建議為恢復目錄數(shù)據(jù)庫創(chuàng)建一個單獨的數(shù)據(jù)庫。

  恢復目錄數(shù)據(jù)庫不能使用恢復目錄備份自身。 
  3.2.建立恢復目錄

  第一步,在目錄數(shù)據(jù)庫中創(chuàng)建恢復目錄所用表空間:

SQL> create tablespace rman_ts datafile ’d:\oracle\oradata\rman\rman_ts.dbf’ size 20M;

  表空間已創(chuàng)建。
  第二步,在目錄數(shù)據(jù)庫中創(chuàng)建RMAN 用戶并授權:

SQL> create user rman identified by rman default tablespace rman_ts temporary tablespace temp quota unlimited on rman_ts;

  用戶已創(chuàng)建。

SQL> grant recovery_catalog_owner to rman ;

  授權成功。
SQL> grant connect, resource to rman ;

  授權成功。
  第三步,在目錄數(shù)據(jù)庫中創(chuàng)建恢復目錄

C:\>rman catalog rman/rman

  恢復管理器:版本8.1.6.0.0 - Production

RMAN-06008:連接到恢復目錄數(shù)據(jù)庫
RMAN-06428:未安裝恢復目錄
RMAN>create catalog tablespace rman_ts;
RMAN-06431:恢復目錄已創(chuàng)建
  注意:雖然使用RMAN不一定必需恢復目錄,但是推薦使用。因為恢復目錄記載的信息大部分可以通過控制文件來記載,RMAN在恢復數(shù)據(jù)庫時使用這些信息。不使用恢復目錄將會對備份恢復操作有限制。
  3.3.使用恢復目錄的優(yōu)勢

   可以存儲腳本;

   記載較長時間的備份恢復操作;

  4. 啟動RMAN

  RMAN為交互式命令行處理界面,也可以從企業(yè)管理器中運行。

  為了使用下面的實例,先檢查環(huán)境符合:

   the target database is called "his" and has the same TNS alias

   user rman has been granted "recovery_catalog_owner "privileges

   目標數(shù)據(jù)庫的連接用戶為internal賬號,或者以其他SYSDBA類型賬號連接  

   the recovery catalog database is called "rman" and has the same TNS alias

   the schema containing the recovery catalog is "rman" (same password)

  在使用RMAN前,設置NLS_DATE_FORMAT 和NLS_LANG環(huán)境變量,很多RMAN LIST命令的輸出結果是與日期時間相關的,這點在用戶希望執(zhí)行以時間為基準的恢復工作也很重要。

  下例是環(huán)境變量的示范:

NLS_LANG= SI

 

MPLIFIED CHINESE_CHINA.ZHS16GBK
NLS_DATE_FORMAT=DD-MON-YYYY HH24:MI:SS

  為了保證RMAN使用時能連接恢復目錄,恢復目錄數(shù)據(jù)庫必須打開,目標數(shù)據(jù)庫至少要STARTED(unmount),否則RMAN會返回一個錯誤,目標數(shù)據(jù)庫必須置于歸檔模式下。

  4.1.使用不帶恢復目錄的RMAN

  設置目標數(shù)據(jù)庫的 ORACLE_SID ,執(zhí)行: 

% rman nocatalog
RMAN> connect target 
RMAN> connect target internal/<password>@his

  4.2.使用帶恢復目錄的RMAN

% rman rman_ts rman/rman@rman
RMAN> connect target
% rman rman_ts rman/rman@rman target internal/<password>@his

  4.3.使用RMAN

  一旦連接到目標數(shù)據(jù)庫,可以通過交互界面或者事先存儲的腳本執(zhí)行指定RMAN命令, 下面是一個使用RMAN交互界面的實例:

RMAN> resync catalog;
RMAN-03022:正在編譯命令:resync
RMAN-03023:正在執(zhí)行命令:resync
RMAN-08002:正在啟動全部恢復目錄的 resync
RMAN-08004:完成全部 resync
  使用腳本的實例:

RMAN> execute script alloc_1_disk;

  創(chuàng)建或者替代存儲的腳本:

RMAN> replace script alloc_1_disk { 
2> allocate channel d1 type disk;
3> }

  5.注冊或者注銷目標數(shù)據(jù)庫

  5.1.注冊目標數(shù)據(jù)庫

  數(shù)據(jù)庫狀態(tài):

    恢復目錄狀態(tài):打開

    目標數(shù)據(jù)庫:加載或者打開
  目標數(shù)據(jù)庫在第一次使用RMAN之前必須在恢復目錄中注冊:
  第一步,啟動恢復管理器,并且連接目標數(shù)據(jù)庫:

C:\>rman target internal/oracle@his catalog rman/rman@rman

  恢復管理器:版本8.1.6.0.0 - Production

RMAN-06005:連接到目標數(shù)據(jù)庫:HIS (DBID=3021445076)
RMAN-06008:連接到恢復目錄數(shù)據(jù)庫
  第二步,注冊數(shù)據(jù)庫:

RMAN> register database;
RMAN-03022:正在編譯命令:register
RMAN-03023:正在執(zhí)行命令:register
RMAN-08006:注冊在恢復目錄中的數(shù)據(jù)庫
RMAN-03023:正在執(zhí)行命令:full resync
RMAN-08002:正在啟動全部恢復目錄的resync
RMAN-08004:完成全部resync
 
  5.2.注銷目標數(shù)據(jù)庫

  RMAN提供了一個注銷工具,叫DBMS_RCVCAT工具包,請注意一旦注銷了該目標數(shù)據(jù)庫,就不可以使用恢復目錄中含有的備份集來恢復數(shù)據(jù)庫了。

  為了能注銷數(shù)據(jù)庫,需要獲得數(shù)據(jù)庫的標識碼(DB_ID)和數(shù)據(jù)庫鍵值(DB_KEY)。其中連接目標數(shù)據(jù)庫時將會獲得DB_ID。

C:\>rman target internal/oracle@his catalog rman/rman@rman
  恢復管理器:版本8.1.6.0.0 - Production
RMAN-06005:連接到目標數(shù)據(jù)庫:HIS (DBID=3021445076)
RMAN-06008:連接到恢復目錄數(shù)據(jù)庫
  其中DBID=3021445076,

 

利用DBID=3021445076查詢數(shù)據(jù)庫鍵值碼:

   連接到目標數(shù)據(jù)庫,查詢db表:

SQL> select * from db;
DB_KEY DB_ID CURR_DBINC_KEY
---------- ---------- --------------
1 3021445076 2

  獲得DB_KEY=1,這樣,該目標數(shù)據(jù)庫DB_KEY=1,DBID=3021445076,利用兩個值使用DBMS_RCVCAT工具包就可以注銷數(shù)據(jù)庫:
SQL> execute dbms_rcvcat.unregisterdatabase(1,3021445076);
PL/SQL 過程已成功完成。
  至此,注銷數(shù)據(jù)庫操作完成。
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
注冊或者注銷目標數(shù)據(jù)庫
Oracle RMAN快速入門指南
Oracle備份與恢復案例(二)
RMAN 初學者指南
為rman建立catalog數(shù)據(jù)庫
RMAN 設置和配置 3
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服