異機rman數據不完全恢復

来源:http://www.cnblogs.com/jionjionyou/archive/2016/06/13/5582343.html
-Advertisement-
Play Games

源庫:Red Hat Enterprise Linux Server release 5.5 (Tikanga) 64bit + ORACLE V11.2.0.4.0 + DG + RAC 目標庫:Red Hat Enterprise Linux Server release 5.8 (Cattha ...


源庫:Red Hat Enterprise Linux Server release 5.5 (Tikanga) 64bit +  ORACLE  V11.2.0.4.0 + DG + RAC

目標庫:Red Hat Enterprise Linux Server release 5.8 (Catthage) 64bit + ORACLE  V11.2.0.4.0

1、在目標庫,安裝好相同版本的oracle資料庫,創建同名實例orcl;

資料庫實例預設安裝路徑為:

/u01/app/oracle/oradata/orcl/…

 

2、查詢源庫數據文件路徑;

Select * from dba_data_files;

如下圖所示:數據文件路徑為+DATA/standby/datafile/…

3、拷貝源庫rman備份文件:

查看源rman備份腳本,內容如下:

run {
allocate channel t1 type disk;
sql 'alter system archive log current';
backup as compressed backupset database format='/mnt/rmanbackup/backup/db_%U';
backup current controlfile format='/mnt/rmanbackup/backup/ctl_%U';
crosscheck backupset;
crosscheck archivelog all;
delete expired backup;
delete noprompt obsolete;
delete archivelog all completed before 'sysdate-60';
delete archivelog until time 'sysdate-60';
delete  backupset completed before 'sysdate-1';
release channel t1;
}

備份路徑/mnt/rmanbackup/backup/下,找到備份文教拷貝。

4、在目標庫中創建相同的目錄,並拷貝以上rman備份數據;

 

5、根據源資料庫,數據存儲路徑製作rman恢復腳本

如下:

Rman>run

{

set newname for datafile 1 to '/u01/app/oracle/oradata/orcl/system.275.867195235';

set newname for datafile 2 to '/u01/app/oracle/oradata/orcl/sysaux.281.867195261';

set newname for datafile 3 to '/u01/app/oracle/oradata/orcl/undotbs1.283.867195263';

set newname for datafile 4 to '/u01/app/oracle/oradata/orcl/users.280.867195255';

set newname for datafile 5 to '/u01/app/oracle/oradata/orcl/undotbs2.290.867195331';

restore database;

switch datafile all;

}

/2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 43> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 63> 64> 65>

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 12-JUN-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=134 device type=DISK

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 06/12/2016 17:26:18

RMAN-06026: some targets not found - aborting restore

RMAN-06023: no backup or copy of datafile 4 found to restore

RMAN-06023: no backup or copy of datafile 3 found to restore

RMAN-06023: no backup or copy of datafile 2 found to restore

RMAN-06023: no backup or copy of datafile 1 found to restore

6、在目標庫上恢復控制文件:

SQL>shutdown immediate

SQL>startup nomount

connected to target database (not started)

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes

Variable Size                671089544 bytes

Database Buffers             390070272 bytes

Redo Buffers                   5517312 bytes

------cmd

Rman target /

------Rman命令:

RMAN>restore controlfile from '/mnt/rmanbackup/backup/ctl_5er51tei_1_1';

Starting restore at 12-JUN-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

output file name=/u01/app/oracle/oradata/orcl/control01.ctl

output file name=/u01/app/oracle/fast_recovery_area/orcl/control02.ctl

Finished restore at 12-JUN-16

 

7、在目標庫上恢複數據文件,處理各種報錯問題:

註意:數據文件恢復完成後重啟資料庫過程中會遇到很多問題,以下是事後整理內容,多有不完善之處!!!

RMAN>alter database mount;

database mounted

released channel: ORA_DISK_1

RMAN> run

{set newname for datafile 1 to '/u01/app/oracle/oradata/orcl/system.275.867195235';

set newname for datafile 2 to '/u01/app/oracle/oradata/orcl/sysaux.281.867195261';

set newname for datafile 3 to '/u01/app/oracle/oradata/orcl/undotbs1.283.867195263';

set newname for datafile 4 to '/u01/app/oracle/oradata/orcl/users.280.867195255';

set newname for datafile 5 to '/u01/app/oracle/oradata/orcl/undotbs2.290.867195331';

restore database;

switch datafile all;

}

/2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 43> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 63>

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 12-JUN-16

Starting implicit crosscheck backup at 12-JUN-16

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 06/12/2016 17:48:42

RMAN-12010: automatic channel allocation initialization failed

RMAN-06189: current DBID 1442122161 does not match target mounted database (1318669939)

 

RMAN> shutdown immediate;

database dismounted

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes

Variable Size                671089544 bytes

Database Buffers             390070272 bytes

Redo Buffers                   5517312 bytes

 

RMAN> set dbid=1318669939

executing command: SET DBID

RMAN> alter database mount;

database mounted

RMAN> run

{set newname for datafile 1 to '/u01/app/oracle/oradata/orcl/system.275.867195235';

set newname for datafile 2 to '/u01/app/oracle/oradata/orcl/sysaux.281.867195261';

set newname for datafile 3 to '/u01/app/oracle/oradata/orcl/undotbs1.283.867195263';

set newname for datafile 4 to '/u01/app/oracle/oradata/orcl/users.280.867195255';

restore database;

switch datafile all;

}

/2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 43> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 63>

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 12-JUN-16

Starting implicit crosscheck backup at 12-JUN-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=134 device type=DISK

Crosschecked 5 objects

Finished implicit crosscheck backup at 12-JUN-16

 

Starting implicit crosscheck copy at 12-JUN-16

using channel ORA_DISK_1

Finished implicit crosscheck copy at 12-JUN-16

 

searching for all files in the recovery area

cataloging files...

no files cataloged

 

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system.275.867195235

channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux.281.867195261

channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs1.283.867195263

channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users.280.867195255

channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/undotbs2.290.867195331

channel ORA_DISK_1: reading from backup piece /mnt/rmanbackup/backup/db_5cr51m5e_1_1

 

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 06/12/2016 22:42:40

ORA-01194: file 1 needs more recovery to be consistent

ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system.275.867195235'

RMAN> exit

Recovery Manager complete.

[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Sun Jun 12 22:48:23 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> conn / as sysdba;

Connected.

SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

SQL> shutdown immediate;

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

Total System Global Area 1068937216 bytes

Fixed Size                  2260088 bytes

Variable Size             671089544 bytes

Database Buffers          390070272 bytes

Redo Buffers                5517312 bytes

Database mounted.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00349: failure obtaining block size for '+DATA/orcl/redo01.log'

SQL> SELECT GROUP#,SEQUENCE#,BYTES,MEMBERS,STATUS FROM V$LOG;

    GROUP#  SEQUENCE#      BYTES    MEMBERS STATUS

---------- ---------- ---------- ---------- ----------------

         1          0   52428800          1 CLEARING

         2          0   52428800          1 CLEARING

         3          0   52428800          1 CLEARING_CURRENT

         4          0   52428800          1 CLEARING

         5          0   52428800          1 CLEARING_CURRENT

         6          0   52428800          1 CLEARING

6 rows selected.

SQL> alter database drop logfile group 6;

Database altered.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00392: log 3 of thread 1 is being cleared, operation not allowed

ORA-00312: online log 3 thread 1: '+DATA/orcl/redo03.log'

SQL> alter database clear logfile group 1;

alter database clear logfile group 1

*

ERROR at line 1:

ORA-00349: failure obtaining block size for '+DATA/orcl/redo01.log'

SQL> alter database rename file '+DATA/orcl/redo01.log' to '/u01/app/oracle/oradata/orcl/redo01.log' ;

Database altered.

SQL> alter database rename file '+DATA/orcl/redo02.log' to '/u01/app/oracle/oradata/orcl/redo02.log' ;  

Database altered.

SQL> alter database rename file '+DATA/orcl/redo03.log' to '/u01/app/oracle/oradata/orcl/redo03.log' ;

Database altered.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00392: log 3 of thread 1 is being cleared, operation not allowed

ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/orcl/redo03.log'

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2;

Database altered.

SQL> ALTER DATABASE CLEAR LOGFILE GROUP 3;

Database altered.

SQL> alter database rename file '+DATA/orcl/redo05.log' to '/u01/app/oracle/oradata/orcl/redo05.log';

Database altered.

SQL> alter database clear logfile group 5;

Database altered.

SQL> alter database rename file '+DATA/orcl/redo04.log' to '/u01/app/oracle/oradata/orcl/redo04.log';

Database altered.

SQL> alter database clear logfile group 4;

Database altered.

SQL> select group#,bytes,status from v$log;

    GROUP#      BYTES STATUS

---------- ---------- ----------------

         1   52428800 UNUSED

         2   52428800 UNUSED

         3   52428800 CURRENT

         4   52428800 UNUSED

         5   52428800 CURRENT

 

以上是自己最近兩個星期做的一次資料庫rman恢復,自己實踐搭建linux環境,安裝oracle,測試恢複數據。實踐出真知啊!!!!


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 一般我們提示的時候都是直接提示文字的,其實Toast也可以顯示圖片 常用方法 例子 1.只顯示圖片的Toast 2.顯示圖片和文字 3.設計自己的Toast 有時候上面兩種還沒能滿足自己的要求,就可以自定義佈局(我在drawable中放了兩張圖片,詹姆斯和庫里的) 準備佈局文件 準備好你想要展示的T ...
  • 1.參數文件的定義、作用 oracle資料庫通過一系列參數來對資料庫進行配置。這些參數是以鍵-值對的形式來表 示的,如:MAXLOGFILES=50BACKGROUND_DUMP_DEST=C:DUMP其中,等號左邊是參數名,右邊是對應的參數的值,值的類型有多種,典型的如數字和 字元串. 參數文件就 ...
  • 傳統MySQL+ Memcached架構遇到的問題 實際MySQL是適合進行海量數據存儲的,通過Memcached將熱點數據載入到cache,加速訪問,很多公司都曾經使用過這樣的架構,但隨著業務數據量的不斷增加,和訪問量的持續增長,我們遇到了很多問題: 1.MySQL需要不斷進行拆庫拆表,Memca ...
  • 大家可能都聽說了,微軟在幾個星期前宣佈發佈可以在Linux上完整運行的SQL Server!如果你想看下在Linux上SQL Server如何運行,進行查詢是什麼樣的體驗,可以看下下麵的視頻。 ...
  • mysql cache功能分析: 1 mysql的cache功能的key的生成原理是:把select語句按照一定的hash規則生成唯一的key,select的結果生成value,即key=>value。所以對於cache而言,select語句是區分大小寫的,也區分空格的。兩個select語句必須完完 ...
  • 我們使用oracle的人都知道可以通過rownum偽列得到查詢結果序列前面的指定的行,為了下麵更好的進行說明問題,我們先來創建一個數據表table1: create table table1 (AAA integer primary key, BBB varchar(30)); 然後在table1中 ...
  • 先來看看什麼是書簽查找: 當優化器所選擇的非聚簇索引只包含查詢請求的一部分欄位時,就需要一個查找(lookup)來檢索其他欄位來滿足請求。對一個有聚簇索引的表來說是一個鍵查找(key lookup),對一個堆表來說是一個RID查找(RID lookup)。這種查找即是——書簽查找。 書簽查找根據索引 ...
  • 以Class降序查詢Student表的所有記錄。 以Cno升序、Degree降序查詢Score表的所有記錄。 查詢教師所有的單位即不重覆的Depart列。 查詢每門課的平均成績。 ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...