單例項備份恢復成RAC
背景: 將單例項庫的rman備份同步到RAC上
大致步驟:(因為任務比較急,筆記記得有點亂 還望海涵)
1
將rman備份集copy到rac機上,並放到'/home/oracle/backup'下
2
關閉所有rac節點,
Export ORACLE_SID=+ASM1
Asmcmd
>--進入資料檔案路徑
Rm *
同時刪除controlfile
3
恢復控制檔案
注意事項:restore之前 需要檢查一下現有的rman備份,
Crosscheck backup;
Delete expired backup;
[oracle@racdg1 backup]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Nov 12 10:07:36 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 68719476736 bytes
Fixed Size 2225168 bytes
Variable Size 3640658928 bytes
Database Buffers 65062043648 bytes
Redo Buffers 14548992 bytes
RMAN> restore controlfile from '/home/oracle/backup/c-1185342296-20101112-00';
Starting restore at 12-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=2283 instance=racdg1 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
output filename=+DATA/std01/controlfile/current.267.734868701
Finished restore at 12-NOV-10
RMAN> shutdown immediate;
Oracle instance shut down
4 修改pfile中的控制檔案資訊
*.control_files='+DATA/std01/controlfile/current.267.734868701'
重新建立spfile
[oracle@racdg1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Nov 12 10:15:42 2010
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 6.8719E+10 bytes
Fixed Size 2225168 bytes
Variable Size 3640658928 bytes
Database Buffers 6.5062E+10 bytes
Redo Buffers 14548992 bytes
SQL> alter database mount;
Database altered.
5.
從備份集恢復資料檔案
RMAN> catalog start with '/home/oracle/backup';
run {
set newname for datafile 1 to '+DATA';
set newname for datafile 2 to '+DATA';
set newname for datafile 3 to '+DATA';
set newname for datafile 4 to '+DATA';
set newname for datafile 5 to '+DATA';
set newname for datafile 6 to '+DATA';
set newname for datafile 7 to '+DATA';
set newname for datafile 8 to '+DATA';
set newname for datafile 9 to '+DATA';
set newname for datafile 10 to '+DATA';
set newname for datafile 11 to '+DATA';
set newname for datafile 12 to '+DATA';
set newname for datafile 13 to '+DATA';
set newname for datafile 14 to '+DATA';
set newname for datafile 15 to '+DATA';
set newname for datafile 16 to '+DATA';
set newname for datafile 17 to '+DATA';
set newname for datafile 18 to '+DATA';
set newname for datafile 19 to '+DATA';
set newname for datafile 20 to '+DATA';
set newname for datafile 21 to '+DATA';
set newname for datafile 22 to '+DATA';
set newname for datafile 23 to '+DATA';
set newname for datafile 24 to '+DATA';
set newname for datafile 25 to '+DATA';
set newname for datafile 26 to '+DATA';
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
restore database;
switch database to copy;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
release channel d5;
}
執行完後檢查檔案
SQL> select to_number(file#), name from v$datafile;
TO_NUMBER(FILE#) NAME
---------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 +DATA/std01/datafile/system.317.734880503
2 +DATA/std01/datafile/undotbs1.300.734880293
3 +DATA/std01/datafile/sysaux.321.734888445
4 +DATA/std01/datafile/users.301.734880493
5 ***************
6 ***************
25 rows selected.
注意事項:recover時候需要用到此rman備份集備份過程中所產生的archive log,否則無法open resetlogs;
建立時候忘記了restore臨時檔案,open resetlogs後
SQL> alter tablespace temp02 add tempfile '+DATA';
Tablespace altered.
SQL> select name,bytes/1024/1024 from v$tempfile;
NAME BYTES/1024/1024
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------
+DATA/std01/tempfile/temp02.281.734898557 100
/data/oracle/oradata/orcl/temp02.dbf 1000
SQL> alter database tempfile '+DATA/std01/tempfile/temp02.281.734898557' resize 20G;
Database altered.
SQL> alter tablespace temp02 drop tempfile '/data/oracle/oradata/orcl/temp02.dbf';
Tablespace altered.
接下來檢視redo log,發現還是單例項模式的,需要將其全部清除並新建
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
4 1 1 524288000 1 YES INACTIVE 6267473039 12-NOV-10
5 1 2 524288000 1 YES INACTIVE 6267772522 12-NOV-10
6 1 3 524288000 1 NO CURRENT 6268945942 12-NOV-10
7 1 0 524288000 1 YES UNUSED 0
8 1 0 524288000 1 YES UNUSED 0
SQL> alter database clear logfile group 4;
Database altered.
SQL> alter database clear logfile group 5;
Database altered.
SQL> alter database drop logfile '/data/oracle/oradata/orcl/redo04.log';
Database altered.
SQL> alter database drop logfile '/data/oracle/oradata/orcl/redo08.log';
Database altered.
****************
****************
****************
重新建立後的redo log
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 5 524288000 1 YES ACTIVE 6269599597 12-NOV-10
2 1 6 524288000 1 NO CURRENT 6269601065 12-NOV-10
3 1 0 524288000 1 YES UNUSED 0
4 1 4 524288000 1 YES ACTIVE 6269576771 12-NOV-10
5 1 0 524288000 1 YES UNUSED 0
SQL> select to_number(group#),member from v$logfile;
TO_NUMBER(GROUP#) MEMBER
----------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4 +DATA/std01/onlinelog/group_4.284.734899351
1 +DATA/std01/onlinelog/group_1.272.734899525
2 +DATA/std01/onlinelog/group_2.277.734899543
5 +DATA/std01/onlinelog/group_5.280.734899375
3 +DATA/std01/onlinelog/group_3.279.734899561
由於是兩節點rac,還需要另外新建一個undo tablespace
SQL> CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA' size 20g;
Tablespace created.
SQL> ALTER DATABASE ENABLE THREAD 2;
Database altered.
SQL> startup
ORACLE instance started.
Total System Global Area 6.8719E+10 bytes
Fixed Size 2225168 bytes
Variable Size 3472886768 bytes
Database Buffers 6.5230E+10 bytes
Redo Buffers 14548992 bytes
ORA-01105: mount is incompatible with mounts by other instances
ORA-01677: standby file name convert parameters differ from other instance
最後遇到以上錯誤
解決辦法: 建立一個公共spfile,讓兩個節點的pfile都指向它
Create spfile=‘+DATA’ from pfile
大致步驟如上,接下來幾天還會有類似任務,到時有機會再完整整理一遍發出來供大家瀏覽
大致步驟:(因為任務比較急,筆記記得有點亂 還望海涵)
1
將rman備份集copy到rac機上,並放到'/home/oracle/backup'下
2
關閉所有rac節點,
Export ORACLE_SID=+ASM1
Asmcmd
>--進入資料檔案路徑
Rm *
同時刪除controlfile
3
恢復控制檔案
注意事項:restore之前 需要檢查一下現有的rman備份,
Crosscheck backup;
Delete expired backup;
[oracle@racdg1 backup]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Nov 12 10:07:36 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 68719476736 bytes
Fixed Size 2225168 bytes
Variable Size 3640658928 bytes
Database Buffers 65062043648 bytes
Redo Buffers 14548992 bytes
RMAN> restore controlfile from '/home/oracle/backup/c-1185342296-20101112-00';
Starting restore at 12-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=2283 instance=racdg1 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
output filename=+DATA/std01/controlfile/current.267.734868701
Finished restore at 12-NOV-10
RMAN> shutdown immediate;
Oracle instance shut down
4 修改pfile中的控制檔案資訊
*.control_files='+DATA/std01/controlfile/current.267.734868701'
重新建立spfile
[oracle@racdg1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Nov 12 10:15:42 2010
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 6.8719E+10 bytes
Fixed Size 2225168 bytes
Variable Size 3640658928 bytes
Database Buffers 6.5062E+10 bytes
Redo Buffers 14548992 bytes
SQL> alter database mount;
Database altered.
5.
從備份集恢復資料檔案
RMAN> catalog start with '/home/oracle/backup';
run {
set newname for datafile 1 to '+DATA';
set newname for datafile 2 to '+DATA';
set newname for datafile 3 to '+DATA';
set newname for datafile 4 to '+DATA';
set newname for datafile 5 to '+DATA';
set newname for datafile 6 to '+DATA';
set newname for datafile 7 to '+DATA';
set newname for datafile 8 to '+DATA';
set newname for datafile 9 to '+DATA';
set newname for datafile 10 to '+DATA';
set newname for datafile 11 to '+DATA';
set newname for datafile 12 to '+DATA';
set newname for datafile 13 to '+DATA';
set newname for datafile 14 to '+DATA';
set newname for datafile 15 to '+DATA';
set newname for datafile 16 to '+DATA';
set newname for datafile 17 to '+DATA';
set newname for datafile 18 to '+DATA';
set newname for datafile 19 to '+DATA';
set newname for datafile 20 to '+DATA';
set newname for datafile 21 to '+DATA';
set newname for datafile 22 to '+DATA';
set newname for datafile 23 to '+DATA';
set newname for datafile 24 to '+DATA';
set newname for datafile 25 to '+DATA';
set newname for datafile 26 to '+DATA';
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
restore database;
switch database to copy;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
release channel d5;
}
執行完後檢查檔案
SQL> select to_number(file#), name from v$datafile;
TO_NUMBER(FILE#) NAME
---------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 +DATA/std01/datafile/system.317.734880503
2 +DATA/std01/datafile/undotbs1.300.734880293
3 +DATA/std01/datafile/sysaux.321.734888445
4 +DATA/std01/datafile/users.301.734880493
5 ***************
6 ***************
25 rows selected.
注意事項:recover時候需要用到此rman備份集備份過程中所產生的archive log,否則無法open resetlogs;
建立時候忘記了restore臨時檔案,open resetlogs後
SQL> alter tablespace temp02 add tempfile '+DATA';
Tablespace altered.
SQL> select name,bytes/1024/1024 from v$tempfile;
NAME BYTES/1024/1024
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------
+DATA/std01/tempfile/temp02.281.734898557 100
/data/oracle/oradata/orcl/temp02.dbf 1000
SQL> alter database tempfile '+DATA/std01/tempfile/temp02.281.734898557' resize 20G;
Database altered.
SQL> alter tablespace temp02 drop tempfile '/data/oracle/oradata/orcl/temp02.dbf';
Tablespace altered.
接下來檢視redo log,發現還是單例項模式的,需要將其全部清除並新建
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
4 1 1 524288000 1 YES INACTIVE 6267473039 12-NOV-10
5 1 2 524288000 1 YES INACTIVE 6267772522 12-NOV-10
6 1 3 524288000 1 NO CURRENT 6268945942 12-NOV-10
7 1 0 524288000 1 YES UNUSED 0
8 1 0 524288000 1 YES UNUSED 0
SQL> alter database clear logfile group 4;
Database altered.
SQL> alter database clear logfile group 5;
Database altered.
SQL> alter database drop logfile '/data/oracle/oradata/orcl/redo04.log';
Database altered.
SQL> alter database drop logfile '/data/oracle/oradata/orcl/redo08.log';
Database altered.
****************
****************
****************
重新建立後的redo log
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 5 524288000 1 YES ACTIVE 6269599597 12-NOV-10
2 1 6 524288000 1 NO CURRENT 6269601065 12-NOV-10
3 1 0 524288000 1 YES UNUSED 0
4 1 4 524288000 1 YES ACTIVE 6269576771 12-NOV-10
5 1 0 524288000 1 YES UNUSED 0
SQL> select to_number(group#),member from v$logfile;
TO_NUMBER(GROUP#) MEMBER
----------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4 +DATA/std01/onlinelog/group_4.284.734899351
1 +DATA/std01/onlinelog/group_1.272.734899525
2 +DATA/std01/onlinelog/group_2.277.734899543
5 +DATA/std01/onlinelog/group_5.280.734899375
3 +DATA/std01/onlinelog/group_3.279.734899561
由於是兩節點rac,還需要另外新建一個undo tablespace
SQL> CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA' size 20g;
Tablespace created.
SQL> ALTER DATABASE ENABLE THREAD 2;
Database altered.
SQL> startup
ORACLE instance started.
Total System Global Area 6.8719E+10 bytes
Fixed Size 2225168 bytes
Variable Size 3472886768 bytes
Database Buffers 6.5230E+10 bytes
Redo Buffers 14548992 bytes
ORA-01105: mount is incompatible with mounts by other instances
ORA-01677: standby file name convert parameters differ from other instance
最後遇到以上錯誤
解決辦法: 建立一個公共spfile,讓兩個節點的pfile都指向它
Create spfile=‘+DATA’ from pfile
大致步驟如上,接下來幾天還會有類似任務,到時有機會再完整整理一遍發出來供大家瀏覽
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15480802/viewspace-688355/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 從nub備份恢復(同平臺)恢復RAC至單例項單例
- 將RAC備份集恢復為單例項資料庫單例資料庫
- rac恢復到單例項單例
- RAC備份恢復之Voting備份與恢復
- 記錄一次Oracle 11.2.0.4 RAC異地恢復到單例項Oracle單例
- 恢復備份例項時出現ORA-01659的解決方法UA
- RAC恢復到單機
- 備份與恢復:polardb資料庫備份與恢復資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 備份和恢復
- mydumper備份恢復
- Mysql備份恢復MySql
- oracle資料庫跨平臺(AIX)從RAC恢復至(linux)下的單例項Oracle資料庫AILinux單例
- 使用Xtrabackup完整備份中恢復單表
- RAC+DG(asm單例項)ASM單例
- Oracle邏輯備份與恢復選項說明Oracle
- 詳解叢集級備份恢復:物理細粒度備份恢復
- MySQL備份與恢復——基於MyDumper/MyLoader 邏輯備份恢復MySql
- Mysql備份與恢復(1)---物理備份MySql
- MySQL 備份與恢復MySql
- redis 備份和恢復Redis
- RMAN備份恢復技巧
- Jenkins備份與恢復Jenkins
- KunlunDB備份和恢復
- Grafana 備份恢復教程Grafana
- rman 增量備份恢復
- Postgresql 備份與恢復SQL
- MySQL備份與恢復——基於OUTFILE /LOAD DATA 邏輯備份恢復MySql
- 【PG備份恢復】pg_basebackup 多表空間備份恢復測試
- MySQL 非常規恢復與物理備份恢復MySql
- Networker恢復oracle rac到單機Oracle
- Mysql備份與恢復(2)---邏輯備份MySql
- GitLab的備份與恢復Gitlab
- 資料庫備份恢復資料庫
- DB的備份與恢復
- ORACLE備份&恢復案例(轉)Oracle
- RMAN備份異機恢復
- tore 命令來恢復備份
- SqlServer備份和恢復(二)SQLServer