將RAC備份集恢復為單例項資料庫
實驗環境介紹
源庫:1 1.2.0.1 rac庫 2個節點
目標庫:11.2.0. 1 RHEL6.5
1.2.4 本文簡介
本文也可以理解成rac 環境下的如何資料庫遷移到單例項的資料庫環境下,預設目標庫已經安裝好了同源庫一樣的資料庫版本。
另外注意,BLOG 中程式碼部分需要特別關注的地方我都用黃色背景和紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日誌號為33,thread 2的最大歸檔日誌號為43 是需要特別關注的地方。
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48
1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58
2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49
2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53
1.3 實驗部分
1.3.1 實驗目標
將11.2.0.1 下的rac庫備份並恢復到11.2.0.1 下的單例項環境下。
1.3.2 源 rac 庫執行
rac 庫需要執行備份並傳遞到目標庫。
1.3.2.1 檢視 rac 環境及建立測試表
[root@node2 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#public
192.168.1.31 node1
192.168.1.32 node2
#vip
192.168.1.131 node1-vip
192.168.1.132 node2-vip
#priv
9.9.9.31 node1-priv
9.9.9.32 node2-priv
#scan
192.168.1.35 cluster-scan
[root@node2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:79:BA:86
inet addr: 192.168.1.32 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:150190 errors:0 dropped:0 overruns:0 frame:0
TX packets:109804 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:205303912 (195.7 MiB) TX bytes:20182601 (19.2 MiB)
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:79:BA:86
inet addr:192.168.1.132 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:0C:29:79:BA:90
inet addr:9.9.9.32 Bcast:9.9.9.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49075 errors:0 dropped:0 overruns:0 frame:0
TX packets:49811 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23642469 (22.5 MiB) TX bytes:31528595 (30.0 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16496 errors:0 dropped:0 overruns:0 frame:0
TX packets:16496 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15118447 (14.4 MiB) TX bytes:15118447 (14.4 MiB)
[root@node2 ~]#
[root@node2 ~]# crsstat
Name Type Target State Host
------------------------------ -------------------------- ---------- --------- -------
ora.ARCH.dg ora.diskgroup.type ONLINE ONLINE node1
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE node1
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE node1
ora.LISTENER_SCAN1.lsnr ora.scan_listener.type ONLINE ONLINE node1
ora.OVDISK.dg ora.diskgroup.type ONLINE ONLINE node1
ora.TEST.dg ora.diskgroup.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.db.db ora.database.type OFFLINE OFFLINE
ora.eons ora.eons.type ONLINE ONLINE node1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora.jmrac.db ora.database.type ONLINE ONLINE node1
ora.jmrac.haha.svc ora.service.type ONLINE ONLINE node1
ora.net1.network ora.network.type ONLINE ONLINE node1
ora.node1.ASM1.asm application ONLINE ONLINE node1
ora.node1.LISTENER_NODE1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip ora.cluster_vip_net1.type ONLINE ONLINE node1
ora.node2.ASM2.asm application ONLINE ONLINE node2
ora.node2.LISTENER_NODE2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip ora.cluster_vip_net1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.type OFFLINE OFFLINE
ora.ons ora.ons.type ONLINE ONLINE node1
ora.ora11g.db ora.database.type OFFLINE OFFLINE
ora.registry.acfs ora.registry.acfs.type ONLINE ONLINE node1
ora.scan1.vip ora.scan_vip.type ONLINE ONLINE node1
[root@node2 ~]#
[oracle@node2 ~]$ ORACLE_SID= jmrac2
[oracle@node2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 10:58:42 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string jmrac
db_unique_name string jmrac
global_names boolean FALSE
instance_name string jmrac2
lock_name_space string
log_file_name_convert string
service_names string HAHA
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 41
Next log sequence to archive 42
Current log sequence 42
SQL>
SQL> create table lhr.rac_to_single_test as select * from dba_objects;
Table created.
SQL> select count(1) from lhr.rac_to_single_test ;
COUNT(1)
----------
72510
SQL>
SQL> set line 9999 pagesize 9999
SQL> col FILE_NAME format a60
SQL> select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile
2 union all
3 select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
4 union all
5 select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
6 union all
7 select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile
8 ;
FILE_TYPE FILE# FILE_NAME STATUS ENABLED
----------- ---------- ------------------------------------------------------------ ------- ----------
datafile 1 +DATA/jmrac/datafile/system.268.877470209 SYSTEM READ WRITE
datafile 2 +DATA/jmrac/datafile/sysaux.269.877470211 ONLINE READ WRITE
datafile 3 +DATA/jmrac/datafile/undotbs1.270.877470213 ONLINE READ WRITE
datafile 4 +DATA/jmrac/datafile/users.271.877470213 ONLINE READ WRITE
datafile 5 +DATA/jmrac/datafile/example.279.877470401 ONLINE READ WRITE
datafile 6 +DATA/jmrac/datafile/undotbs2.280.877470779 ONLINE READ WRITE
tempfile 1 +DATA/jmrac/tempfile/temp.278.877470381 ONLINE READ WRITE
logfile 2 +DATA/jmrac/onlinelog/group_2.276.877470349
logfile 2 +DATA/jmrac/onlinelog/group_2.277.877470349
logfile 1 +DATA/jmrac/onlinelog/group_1.274.877470345
logfile 1 +DATA/jmrac/onlinelog/group_1.275.877470345
logfile 3 +DATA/jmrac/onlinelog/group_3.281.877470929
logfile 3 +DATA/jmrac/onlinelog/group_3.282.877470931
logfile 4 +DATA/jmrac/onlinelog/group_4.283.877470937
logfile 4 +DATA/jmrac/onlinelog/group_4.284.877470943
controlfile +DATA/jmrac/controlfile/current.273.877470341
controlfile +DATA/jmrac/controlfile/current.272.877470343
17 rows selected.
SQL>
我後續將在192.168.1.32 即rac的第二個節點上執行操作,db_name為jmrac,資料庫為歸檔模式,建立測試表lhr.rac_to_single_test,資料量為72510 行,其中有個crsstat命令,可以參考:【RAC】如何讓Oracle RAC crs_stat 命令顯示完整 <a http:="" blog.itpub.net="" 26736162="" viewspace-1610957="" "="" ?="" style=";padding: 0px"> http://blog.itpub.net/26736162/viewspace-1610957/
1.3.2.2 生成 pfile 檔案
SQL> show parameter instance_n
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string jmrac2
instance_number integer 2
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/jmrac/spfilejmrac.ora
SQL> create pfile='/home/oracle/rman_back/initjmrac.ora' from spfile;
File created.
SQL>
1.3.2.3 執行備份操作
備份指令碼如下:
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database format '/home/oracle/rman_back/full_%n_%T_%t_%s_%p.bak';
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/rman_back/arch_%d_%T_%s_%p.bak' delete input;
backup current controlfile format '/home/oracle/rman_back/ctl_%d_%T_%s_%p.bak';
release channel c1;
release channel c2;
}
執行過程如下:
[oracle@node2 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri May 29 11:12:51 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: JMRAC (DBID=1916705604)
{
run
2> {
3> allocate channel c1 type disk;
4> allocate channel c2 type disk;
5> backup database format '/home/oracle/rman_back/full_%n_%T_%t_%s_%p.bak';
6> sql 'alter system archive log current';
7> backup archivelog all format '/home/oracle/rman_back/arch_%d_%T_%s_%p.bak' delete input;
8> backup current controlfile format '/home/oracle/rman_back/ctl_%d_%T_%s_%p.bak';
9> release channel c1;
10> release channel c2;
11> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=55 instance=jmrac2 device type=DISK
allocated channel: c2
channel c2: SID=57 instance=jmrac2 device type=DISK
Starting backup at 29-MAY-2015 11:12:59
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/jmrac/datafile/system.268.877470209
input datafile file number=00004 name=+DATA/jmrac/datafile/users.271.877470213
input datafile file number=00006 name=+DATA/jmrac/datafile/undotbs2.280.877470779
channel c1: starting piece 1 at 29-MAY-2015 11:13:00
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/jmrac/datafile/sysaux.269.877470211
input datafile file number=00005 name=+DATA/jmrac/datafile/example.279.877470401
input datafile file number=00003 name=+DATA/jmrac/datafile/undotbs1.270.877470213
channel c2: starting piece 1 at 29-MAY-2015 11:13:00
channel c1: finished piece 1 at 29-MAY-2015 11:15:35
piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_5_1.bak tag=TAG20150529T111259 comment=NONE
channel c1: backup set complete, elapsed time: 00:02:35
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
channel c2: finished piece 1 at 29-MAY-2015 11:15:35
piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_6_1.bak tag=TAG20150529T111259 comment=NONE
channel c2: backup set complete, elapsed time: 00:02:35
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c2: starting piece 1 at 29-MAY-2015 11:15:35
including current control file in backup set
channel c1: starting piece 1 at 29-MAY-2015 11:15:38
channel c2: finished piece 1 at 29-MAY-2015 11:15:38
piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974935_8_1.bak tag=TAG20150529T111259 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
channel c1: finished piece 1 at 29-MAY-2015 11:15:40
piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974935_7_1.bak tag=TAG20150529T111259 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
Finished backup at 29-MAY-2015 11:15:40
sql statement: alter system archive log current
Starting backup at 29-MAY-2015 11:15:53
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=2 sequence=31 RECID=50 STAMP=879502099
input archived log thread=1 sequence=24 RECID=52 STAMP=879511365
input archived log thread=2 sequence=32 RECID=51 STAMP=879502100
input archived log thread=1 sequence=25 RECID=55 STAMP=879527440
input archived log thread=2 sequence=33 RECID=53 STAMP=879522769
input archived log thread=2 sequence=34 RECID=54 STAMP=879527240
input archived log thread=2 sequence=35 RECID=57 STAMP=879586992
input archived log thread=1 sequence=26 RECID=56 STAMP=879527447
input archived log thread=1 sequence=27 RECID=60 STAMP=879590456
input archived log thread=2 sequence=36 RECID=58 STAMP=879586995
input archived log thread=2 sequence=37 RECID=59 STAMP=879590456
input archived log thread=1 sequence=28 RECID=61 STAMP=879590457
channel c1: starting piece 1 at 29-MAY-2015 11:16:05
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=2 sequence=38 RECID=63 STAMP=880971338
input archived log thread=1 sequence=29 RECID=62 STAMP=880971333
input archived log thread=2 sequence=39 RECID=64 STAMP=880971341
input archived log thread=1 sequence=30 RECID=65 STAMP=880972786
input archived log thread=2 sequence=40 RECID=66 STAMP=880972787
input archived log thread=2 sequence=41 RECID=67 STAMP=880972787
input archived log thread=1 sequence=31 RECID=68 STAMP=880974598
channel c2: starting piece 1 at 29-MAY-2015 11:16:05
channel c1: finished piece 1 at 29-MAY-2015 11:16:20
piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_9_1.bak tag=TAG20150529T111603 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c1: deleting archived log(s)
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_31.359.879502097 RECID=50 STAMP=879502099
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_24.356.879511361 RECID=52 STAMP=879511365
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_32.357.879502099 RECID=51 STAMP=879502100
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_25.352.879527441 RECID=55 STAMP=879527440
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_33.353.879522767 RECID=53 STAMP=879522769
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_34.351.879527239 RECID=54 STAMP=879527240
archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_35.333.879586991 RECID=57 STAMP=879586992
archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_26.335.879527445 RECID=56 STAMP=879527447
archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_1_seq_27.331.879590457 RECID=60 STAMP=879590456
archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_36.334.879586995 RECID=58 STAMP=879586995
archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_37.332.879590455 RECID=59 STAMP=879590456
archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_1_seq_28.329.879590457 RECID=61 STAMP=879590457
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=2 sequence=42 RECID=70 STAMP=880974952
input archived log thread=1 sequence=32 RECID=69 STAMP=880974952
input archived log thread=1 sequence=33 RECID=72 STAMP=880974959
input archived log thread=2 sequence=43 RECID=71 STAMP=880974953
channel c1: starting piece 1 at 29-MAY-2015 11:16:23
channel c2: finished piece 1 at 29-MAY-2015 11:16:23
piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_10_1.bak tag=TAG20150529T111603 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:18
channel c2: deleting archived log(s)
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_38.330.880971315 RECID=63 STAMP=880971338
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_29.327.880971317 RECID=62 STAMP=880971333
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_39.326.880971341 RECID=64 STAMP=880971341
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_30.328.880972785 RECID=65 STAMP=880972786
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_40.325.880972785 RECID=66 STAMP=880972787
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_41.324.880972787 RECID=67 STAMP=880972787
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_31.322.880974595 RECID=68 STAMP=880974598
channel c1: finished piece 1 at 29-MAY-2015 11:16:23
piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_11_1.bak tag=TAG20150529T111603 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:00
channel c1: deleting archived log(s)
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_42.321.880974951 RECID=70 STAMP=880974952
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_32.323.880974951 RECID=69 STAMP=880974952
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_33.318.880974959 RECID=72 STAMP=880974959
archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_43.320.880974953 RECID=71 STAMP=880974953
Finished backup at 29-MAY-2015 11:16:23
Starting backup at 29-MAY-2015 11:16:24
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 29-MAY-2015 11:16:25
channel c1: finished piece 1 at 29-MAY-2015 11:16:26
piece handle=/home/oracle/rman_back/ctl_JMRAC_20150529_12_1.bak tag=TAG20150529T111624 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-MAY-2015 11:16:26
released channel: c1
released channel: c2
RMAN>
RMAN> exit
Recovery Manager complete.
[oracle@node2 ~]$ cd rman_back/
[oracle@node2 rman_back]$ ll
total 1313928
-rw-r----- 1 oracle asmadmin 85005824 May 29 11:16 arch_JMRAC_20150529_10_1.bak
-rw-r----- 1 oracle asmadmin 14320128 May 29 11:16 arch_JMRAC_20150529_11_1.bak
-rw-r----- 1 oracle asmadmin 34693632 May 29 11:16 arch_JMRAC_20150529_9_1.bak
-rw-r----- 1 oracle asmadmin 18579456 May 29 11:16 ctl_JMRAC_20150529_12_1.bak
-rw-r----- 1 oracle asmadmin 648372224 May 29 11:15 full_JMRACxxx_20150529_880974780_5_1.bak
-rw-r----- 1 oracle asmadmin 524435456 May 29 11:15 full_JMRACxxx_20150529_880974780_6_1.bak
-rw-r----- 1 oracle asmadmin 18579456 May 29 11:15 full_JMRACxxx_20150529_880974935_7_1.bak
-rw-r----- 1 oracle asmadmin 98304 May 29 11:15 full_JMRACxxx_20150529_880974935_8_1.bak
-rw-r--r-- 1 oracle asmadmin 1371 May 29 11:08 initjmrac.ora
[oracle@node2 rman_back]$
[oracle@node2 rman_back]$ ll -h
total 1.3G
-rw-r----- 1 oracle asmadmin 82M May 29 11:16 arch_JMRAC_20150529_10_1.bak
-rw-r----- 1 oracle asmadmin 14M May 29 11:16 arch_JMRAC_20150529_11_1.bak
-rw-r----- 1 oracle asmadmin 34M May 29 11:16 arch_JMRAC_20150529_9_1.bak
-rw-r----- 1 oracle asmadmin 18M May 29 11:16 ctl_JMRAC_20150529_12_1.bak
-rw-r----- 1 oracle asmadmin 619M May 29 11:15 full_JMRACxxx_20150529_880974780_5_1.bak
-rw-r----- 1 oracle asmadmin 501M May 29 11:15 full_JMRACxxx_20150529_880974780_6_1.bak
-rw-r----- 1 oracle asmadmin 18M May 29 11:15 full_JMRACxxx_20150529_880974935_7_1.bak
-rw-r----- 1 oracle asmadmin 96K May 29 11:15 full_JMRACxxx_20150529_880974935_8_1.bak
-rw-r--r-- 1 oracle asmadmin 1.4K May 29 11:08 initjmrac.ora
[oracle@node2 rman_back]$
1.3.2.4
將備份傳遞到
target
庫
這個方法就多了,可以採用ftp 上傳下載,也可以採用NFS網路檔案系統,或者scp命令都可以,這裡我們採用scp 直接傳遞。
源庫:
[oracle@node2 rman_back]$ scp -r /home/oracle/rman_back oracle@192.168.59.129:/home/oracle
ssh: connect to host 192.168.59.129 port 22: Network is unreachable
lost connection
由於source db 的IP為192.168.1.32,而目標庫的IP為192.168.59.129,不在同一個網段,所以我對目標庫再新增一塊網路卡,所以目標庫的IP 配置如下:
目標庫再新增一塊網路卡後:
[oracle@orcltest ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:E7:E6:B0
inet addr:192.168.59.129 Bcast:192.168.59.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee7:e6b0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:165 errors:0 dropped:0 overruns:0 frame:0
TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:17969 (17.5 KiB) TX bytes:17510 (17.0 KiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:E7:E6:A6
inet addr: 192.168.1.128 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee7:e6a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:746 (746.0 b) TX bytes:1152 (1.1 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5558 errors:0 dropped:0 overruns:0 frame:0
TX packets:5558 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:354142 (345.8 KiB) TX bytes:354142 (345.8 KiB)
源庫scp 操作:
[oracle@node2 rman_back]$ scp -r /home/oracle/rman_back oracle@192.168.1.128:/home/oracle
The authenticity of host '192.168.1.128 (192.168.1.128)' can't be established.
RSA key fingerprint is 77:e6:11:1a:7c:c7:81:7c:88:c9:21:18:51:2a:84:d1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.128' (RSA) to the list of known hosts.
oracle@192.168.1.128's password:
ctl_JMRAC_20150529_12_1.bak 100% 18MB 17.7MB/s 00:01
arch_JMRAC_20150529_10_1.bak 100% 81MB 27.0MB/s 00:03
arch_JMRAC_20150529_9_1.bak 100% 33MB 16.5MB/s 00:02
full_JMRACxxx_20150529_880974935_7_1.bak 100% 18MB 17.7MB/s 00:01
full_JMRACxxx_20150529_880974780_5_1.bak 100% 618MB 12.4MB/s 00:50
initjmrac.ora 100% 1371 1.3KB/s 00:00
full_JMRACxxx_20150529_880974780_6_1.bak 100% 500MB 15.2MB/s 00:33
arch_JMRAC_20150529_11_1.bak 100% 14MB 3.4MB/s 00:04
full_JMRACxxx_20150529_880974935_8_1.bak 100% 96KB 96.0KB/s 00:00
[oracle@node2 rman_back]$
目標庫檢視結果:
[oracle@orcltest rman_back]$ ll -h
total 1.3G
-rw-r----- 1 oracle oinstall 82M May 29 12:26 arch_JMRAC_20150529_10_1.bak
-rw-r----- 1 oracle oinstall 14M May 29 12:28 arch_JMRAC_20150529_11_1.bak
-rw-r----- 1 oracle oinstall 34M May 29 12:26 arch_JMRAC_20150529_9_1.bak
-rw-r----- 1 oracle oinstall 18M May 29 12:26 ctl_JMRAC_20150529_12_1.bak
-rw-r----- 1 oracle oinstall 619M May 29 12:27 full_JMRACxxx_20150529_880974780_5_1.bak
-rw-r----- 1 oracle oinstall 501M May 29 12:28 full_JMRACxxx_20150529_880974780_6_1.bak
-rw-r----- 1 oracle oinstall 18M May 29 12:26 full_JMRACxxx_20150529_880974935_7_1.bak
-rw-r----- 1 oracle oinstall 96K May 29 12:28 full_JMRACxxx_20150529_880974935_8_1.bak
-rw-r--r-- 1 oracle oinstall 1.4K May 29 12:27 initjmrac.ora
[oracle@orcltest rman_back]$
至此,源庫rac 上需要操作的內容已完成。
1.3.3 target 庫上執行
1.3.3.1 修改 pfile 檔案生成 spfile 檔案、生成 pfile 中的檔案路徑
主要有兩方面的修改:
? 修改含檔案路徑的引數,達到符合當前伺服器環境的實際情況 ,如audit_file_dest,control_files,db_recovery_file_dest
? 修改多例項相關的引數 ,如 cluster_database,帶有例項名的字首
源pfile 檔案內容:
[oracle@orcltest rman_back]$ cp initjmrac.ora initjmrac.ora_bk
[oracle@orcltest rman_back]$ more initjmrac.ora _bk
jmrac1.__db_cache_size=16777216
jmrac2.__db_cache_size=16777216
jmrac1.__java_pool_size=4194304
jmrac2.__java_pool_size=4194304
jmrac1.__large_pool_size=4194304
jmrac2.__large_pool_size=4194304
jmrac1.__pga_aggregate_target=209715200
jmrac2.__pga_aggregate_target=209715200
jmrac1.__sga_target=314572800
jmrac2.__sga_target=314572800
jmrac1.__shared_io_pool_size=0
jmrac2.__shared_io_pool_size=0
jmrac1.__shared_pool_size=281018368
jmrac2.__shared_pool_size=281018368
jmrac1.__streams_pool_size=0
jmrac2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/jmrac/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/jmrac/controlfile/current.273.877470341','+DATA/jmrac/controlfile/current.272.877470343'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='jmrac'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jmracXDB)'
jmrac2.instance_number=2
jmrac1.instance_number=1
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=524288000
*.nls_date_format='YYYY-MM-DD HH24:mi:ss'
*.open_cursors=300
*.processes=1500
*.remote_listener='remote_lsnr_jmrac'
*.remote_login_passwordfile='exclusive'
jmrac2.thread=2
jmrac1.thread=1
jmrac2.undo_tablespace='UNDOTBS2'
jmrac1.undo_tablespace='UNDOTBS1'
[oracle@orcltest rman_back]$
最終修改完之後,這裡的初始化引數如下,比如原來的檔案精簡不少:
[oracle@orcltest rman_back]$ more initjmrac .ora
*.audit_file_dest='/u01/app/oracle/admin/jmrac/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/jmrac/control01.ctl','/u01/app/oracle/oradata/jmrac/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='jmrac'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jmracXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=524288000
*.nls_date_format='YYYY-MM-DD HH24:mi:ss'
*.open_cursors=300
*.processes=1500
*.remote_login_passwordfile='exclusive'
建立相關路徑:
[oracle@orcltest onlinelog]$ mkdir -p /u01/app/oracle/admin/jmrac/adump
[oracle@orcltest onlinelog]$ mkdir -p /u01/app/oracle/oradata/jmrac/
[oracle@orcltest onlinelog]$ sqlplus -v
SQL*Plus: Release 11.2.0.1.0 Production
[oracle@orcltest onlinelog]$
[oracle@orcltest ~]$ env | grep ORA
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@orcltest ~]$ cd /u01/app/oracle/
生成spfile 檔案:
[oracle@orcltest dbs]$ ORACLE_SID=jmrac
[oracle@orcltest dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 13:58:37 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile='/home/oracle/rman_back/initjmrac.ora';
File created.
SQL> exit
Disconnected
[oracle@orcltest dbs]$ cd $ORACLE_HOME/dbs
[oracle@orcltest dbs]$ ll spfilejmrac.ora
-rw-r----- 1 oracle asmadmin 2560 May 29 13:59 spfilejmrac.ora
[oracle@orcltest dbs]$
1.3.3.2 啟動到 nomount 狀態並還原控制檔案
[oracle@orcltest dbs]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Fri May 29 14:45:56 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 482345960 bytes
Database Buffers 29360128 bytes
Redo Buffers 8015872 bytes
RMAN> restore controlfile from '/home/oracle/rman_back/ctl_JMRAC_20150529_12_1.bak';
Starting restore at 2015-05-29 14:47:09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1146 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/jmrac/control01.ctl
output file name=/u01/app/oracle/oradata/jmrac/control02.ctl
Finished restore at 2015-05-29 14:47:13
RMAN>
控制檔案已經還原,注意 此處控制檔案的還原路徑是spfile 中指定的路徑 ,接下來還原資料檔案及恢復資料庫。
1.3.3.3 啟動到 mount 狀態並還原和恢復整個資料庫
一、 restore 資料庫
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> list backupset summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
5 B F A DISK 2015-05-29 11:15:26 1 1 NO TAG20150529T111259
6 B F A DISK 2015-05-29 11:15:31 1 1 NO TAG20150529T111259
7 B F A DISK 2015-05-29 11:15:38 1 1 NO TAG20150529T111259
8 B F A DISK 2015-05-29 11:15:39 1 1 NO TAG20150529T111259
9 B A A DISK 2015-05-29 11:16:13 1 1 NO TAG20150529T111603
10 B A A DISK 2015-05-29 11:16:17 1 1 NO TAG20150529T111603
11 B A A DISK 2015-05-29 11:16:23 1 1 NO TAG20150529T111603
RMAN>
RMAN> list backupset of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
9 33.09M DISK 00:00:08 2015-05-29 11:16:13
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20150529T111603
Piece Name: /home/oracle/rman_back/arch_JMRAC_20150529_9_1.bak
List of Archived Logs in backup set 9
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 24 1389153 2015-05-10 17:55:23 1442215 2015-05-12 12:42:40
1 25 1442215 2015-05-12 12:42:40 1466390 2015-05-12 17:10:39
1 26 1466390 2015-05-12 17:10:39 1466392 2015-05-12 17:10:40
1 27 1466392 2015-05-12 17:10:40 1512521 2015-05-13 10:40:54
1 28 1512521 2015-05-13 10:40:54 1512530 2015-05-13 10:40:56
2 31 1389149 2015-05-10 17:55:22 1419988 2015-05-12 10:06:07
2 32 1419988 2015-05-12 10:06:07 1419992 2015-05-12 10:06:07
2 33 1444571 2015-05-12 13:34:16 1453906 2015-05-12 15:52:46
2 34 1454056 2015-05-12 15:57:38 1466360 2015-05-12 17:07:19
2 35 1466388 2015-05-12 17:10:39 1489679 2015-05-13 09:43:06
2 36 1489679 2015-05-13 09:43:06 1489698 2015-05-13 09:43:08
2 37 1490870 2015-05-13 10:00:32 1512524 2015-05-13 10:40:55
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
10 81.07M DISK 00:00:12 2015-05-29 11:16:17
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20150529T111603
Piece Name: /home/oracle/rman_back/arch_JMRAC_20150529_10_1.bak
List of Archived Logs in backup set 10
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 29 1513517 2015-05-13 10:42:36 1591218 2015-05-29 10:15:08
1 30 1591218 2015-05-29 10:15:08 1613556 2015-05-29 10:39:43
1 31 1613556 2015-05-29 10:39:43 1621589 2015-05-29 11:09:52
2 38 1512524 2015-05-13 10:40:55 1570420 2015-05-29 10:11:10
2 39 1570420 2015-05-29 10:11:10 1570422 2015-05-29 10:11:11
2 40 1592133 2015-05-29 10:20:48 1613554 2015-05-29 10:39:43
2 41 1613554 2015-05-29 10:39:43 1613562 2015-05-29 10:39:44
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
11 13.66M DISK 00:00:01 2015-05-29 11:16:23
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20150529T111603
Piece Name: /home/oracle/rman_back/arch_JMRAC_20150529_11_1.bak
List of Archived Logs in backup set 11
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48
1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58
2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49
2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53
RMAN>
這裡需要注意的是,資料檔案的轉換,由於原rac 庫是asm儲存的,所以到新環境需要採用set newname來轉換一下,相關的可以參考哥的blog:【oracle官網】 Restoring a Database on a New Host http://blog.itpub.net/26736162/viewspace-1548104/ ,這裡就直接操作了。
先得到轉換的指令碼:
SQL> set pagesize 200 linesize 200
SQL> select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'
2 from v$datafile a
3 union all
4 select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'
5 from v$tempfile a
6 union all
7 SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || ''''' to ''''' ||
8 a.MEMBER || ''''' ";'
9 FROM v$logfile a;
'SETNEWNAMEFORDATAFILE'||A.FILE#||'TO"'||A.NAME||'";'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set newname for datafile 1 to "+DATA/jmrac/datafile/system.268.877470209";
set newname for datafile 2 to "+DATA/jmrac/datafile/sysaux.269.877470211";
set newname for datafile 3 to "+DATA/jmrac/datafile/undotbs1.270.877470213";
set newname for datafile 4 to "+DATA/jmrac/datafile/users.271.877470213";
set newname for datafile 5 to "+DATA/jmrac/datafile/example.279.877470401";
set newname for datafile 6 to "+DATA/jmrac/datafile/undotbs2.280.877470779";
set newname for tempfile 1 to "+DATA/jmrac/tempfile/temp.278.877470381";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.276.877470349'' to ''+DATA/jmrac/onlinelog/group_2.276.877470349'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.277.877470349'' to ''+DATA/jmrac/onlinelog/group_2.277.877470349'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.274.877470345'' to ''+DATA/jmrac/onlinelog/group_1.274.877470345'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.275.877470345'' to ''+DATA/jmrac/onlinelog/group_1.275.877470345'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.281.877470929'' to ''+DATA/jmrac/onlinelog/group_3.281.877470929'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.282.877470931'' to ''+DATA/jmrac/onlinelog/group_3.282.877470931'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.283.877470937'' to ''+DATA/jmrac/onlinelog/group_4.283.877470937'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.284.877470943'' to ''+DATA/jmrac/onlinelog/group_4.284.877470943'' ";
15 rows selected.
SQL>
修改後如下:
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
set newname for datafile 1 to "/u01/app/oracle/oradata/jmrac/system01.dbf";
set newname for datafile 2 to "/u01/app/oracle/oradata/jmrac/sysaux01.dbf";
set newname for datafile 3 to "/u01/app/oracle/oradata/jmrac/undotbs01.dbf";
set newname for datafile 4 to "/u01/app/oracle/oradata/jmrac/users01.dbf";
set newname for datafile 5 to "/u01/app/oracle/oradata/jmrac/example01.dbf";
set newname for datafile 6 to "/u01/app/oracle/oradata/jmrac/undotbs02.dbf";
set newname for tempfile 1 to "/u01/app/oracle/oradata/jmrac/temp01.dbf";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.276.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.277.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.274.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.275.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.281.877470929'' to ''/u01/app/oracle/oradata/jmrac/redo03_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.282.877470931'' to ''/u01/app/oracle/oradata/jmrac/redo03_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.283.877470937'' to ''/u01/app/oracle/oradata/jmrac/redo04_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.284.877470943'' to ''/u01/app/oracle/oradata/jmrac/redo04_2.log'' ";
RESTORE DATABASE;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
rman 中還原資料檔案:
RMAN> RUN
2> {
3> ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
4> set newname for datafile 1 to "/u01/app/oracle/oradata/jmrac/system01.dbf";
5> set newname for datafile 2 to "/u01/app/oracle/oradata/jmrac/sysaux01.dbf";
6> set newname for datafile 3 to "/u01/app/oracle/oradata/jmrac/undotbs01.dbf";
7> set newname for datafile 4 to "/u01/app/oracle/oradata/jmrac/users01.dbf";
8> set newname for datafile 5 to "/u01/app/oracle/oradata/jmrac/example01.dbf";
9> set newname for datafile 6 to "/u01/app/oracle/oradata/jmrac/undotbs02.dbf";
10> set newname for tempfile 1 to "/u01/app/oracle/oradata/jmrac/temp01.dbf";
11> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.276.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_1.log'' ";
12> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.277.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_2.log'' ";
13> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.274.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_1.log'' ";
14> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.275.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_2.log'' ";
15> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.281.877470929'' to ''/u01/app/oracle/oradata/jmrac/redo03_1.log'' ";
16> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.282.877470931'' to ''/u01/app/oracle/oradata/jmrac/redo03_2.log'' ";
17> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.283.877470937'' to ''/u01/app/oracle/oradata/jmrac/redo04_1.log'' ";
18> SQL "ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.284.877470943'' to ''/u01/app/oracle/oradata/jmrac/redo04_2.log'' ";
19>
20> RESTORE DATABASE;
21> SWITCH DATAFILE ALL;
22> SWITCH TEMPFILE ALL;
23> }
allocated channel: c1
channel c1: SID=1137 device type=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.276.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_1.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_2.277.877470349'' to ''/u01/app/oracle/oradata/jmrac/redo02_2.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.274.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_1.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_1.275.877470345'' to ''/u01/app/oracle/oradata/jmrac/redo01_2.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.281.877470929'' to ''/u01/app/oracle/oradata/jmrac/redo03_1.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_3.282.877470931'' to ''/u01/app/oracle/oradata/jmrac/redo03_2.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.283.877470937'' to ''/u01/app/oracle/oradata/jmrac/redo04_1.log''
sql statement: ALTER DATABASE RENAME FILE ''+DATA/jmrac/onlinelog/group_4.284.877470943'' to ''/u01/app/oracle/oradata/jmrac/redo04_2.log''
Starting restore at 2015-05-29 15:16:46
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00002 to /u01/app/oracle/oradata/jmrac/sysaux01.dbf
channel c1: restoring datafile 00003 to /u01/app/oracle/oradata/jmrac/undotbs01.dbf
channel c1: restoring datafile 00005 to /u01/app/oracle/oradata/jmrac/example01.dbf
channel c1: reading from backup piece /home/oracle/rman_back/full_JMRACxxx_20150529_880974780_6_1.bak
channel c1: piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_6_1.bak tag=TAG20150529T111259
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:35
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /u01/app/oracle/oradata/jmrac/system01.dbf
channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/jmrac/users01.dbf
channel c1: restoring datafile 00006 to /u01/app/oracle/oradata/jmrac/undotbs02.dbf
channel c1: reading from backup piece /home/oracle/rman_back/full_JMRACxxx_20150529_880974780_5_1.bak
channel c1: piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_5_1.bak tag=TAG20150529T111259
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:35
Finished restore at 2015-05-29 15:17:57
datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=880989478 file name=/u01/app/oracle/oradata/jmrac/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=9 STAMP=880989478 file name=/u01/app/oracle/oradata/jmrac/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=880989478 file name=/u01/app/oracle/oradata/jmrac/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=11 STAMP=880989478 file name=/u01/app/oracle/oradata/jmrac/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=880989478 file name=/u01/app/oracle/oradata/jmrac/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=13 STAMP=880989479 file name=/u01/app/oracle/oradata/jmrac/undotbs02.dbf
renamed tempfile 1 to /u01/app/oracle/oradata/jmrac/temp01.dbf in control file
released channel: c1
RMAN>
告警日誌:
Fri May 29 15:16:45 2015
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_2.276.877470349' to '/u01/app/oracle/oradata/jmrac/redo02_1.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_2.276.877470349
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_2.276.877470349' to '/u01/app/oracle/oradata/jmrac/redo02_1.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_2.277.877470349' to '/u01/app/oracle/oradata/jmrac/redo02_2.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_2.277.877470349
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_2.277.877470349' to '/u01/app/oracle/oradata/jmrac/redo02_2.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_1.274.877470345' to '/u01/app/oracle/oradata/jmrac/redo01_1.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_1.274.877470345
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_1.274.877470345' to '/u01/app/oracle/oradata/jmrac/redo01_1.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_1.275.877470345' to '/u01/app/oracle/oradata/jmrac/redo01_2.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_1.275.877470345
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_1.275.877470345' to '/u01/app/oracle/oradata/jmrac/redo01_2.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_3.281.877470929' to '/u01/app/oracle/oradata/jmrac/redo03_1.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_3.281.877470929
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_3.281.877470929' to '/u01/app/oracle/oradata/jmrac/redo03_1.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_3.282.877470931' to '/u01/app/oracle/oradata/jmrac/redo03_2.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_3.282.877470931
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_3.282.877470931' to '/u01/app/oracle/oradata/jmrac/redo03_2.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_4.283.877470937' to '/u01/app/oracle/oradata/jmrac/redo04_1.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_4.283.877470937
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_4.283.877470937' to '/u01/app/oracle/oradata/jmrac/redo04_1.log'
ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_4.284.877470943' to '/u01/app/oracle/oradata/jmrac/redo04_2.log'
Deleted Oracle managed file +DATA/jmrac/onlinelog/group_4.284.877470943
Completed: ALTER DATABASE RENAME FILE '+DATA/jmrac/onlinelog/group_4.284.877470943' to '/u01/app/oracle/oradata/jmrac/redo04_2.log'
Fri May 29 15:16:51 2015
Full restore complete of datafile 3 to datafile copy /u01/app/oracle/oradata/jmrac/undotbs01.dbf. Elapsed time: 0:00:02
checkpoint is 1624119
last deallocation scn is 1529290
Undo Optimization current scn is 1542977
Full restore complete of datafile 5 to datafile copy /u01/app/oracle/oradata/jmrac/example01.dbf. Elapsed time: 0:00:09
checkpoint is 1624119
last deallocation scn is 1379034
Fri May 29 15:17:18 2015
Full restore complete of datafile 2 to datafile copy /u01/app/oracle/oradata/jmrac/sysaux01.dbf. Elapsed time: 0:00:30
checkpoint is 1624119
last deallocation scn is 1348692
Full restore complete of datafile 6 to datafile copy /u01/app/oracle/oradata/jmrac/undotbs02.dbf. Elapsed time: 0:00:00
checkpoint is 1624083
last deallocation scn is 1549684
Undo Optimization current scn is 1542977
Full restore complete of datafile 4 to datafile copy /u01/app/oracle/oradata/jmrac/users01.dbf. Elapsed time: 0:00:01
checkpoint is 1624083
Fri May 29 15:17:52 2015
Full restore complete of datafile 1 to datafile copy /u01/app/oracle/oradata/jmrac/system01.dbf. Elapsed time: 0:00:29
checkpoint is 1624083
last deallocation scn is 1547365
Undo Optimization current scn is 1542977
Fri May 29 15:18:00 2015
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/system.268.877470209
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/system.268.877470209
ORA-15012: ASM file '+DATA/jmrac/datafile/system.268.877470209' does not exist
Switch of datafile 1 complete to datafile copy
checkpoint is 1624083
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/sysaux.269.877470211
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/sysaux.269.877470211
ORA-15012: ASM file '+DATA/jmrac/datafile/sysaux.269.877470211' does not exist
Switch of datafile 2 complete to datafile copy
checkpoint is 1624119
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/undotbs1.270.877470213
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/undotbs1.270.877470213
ORA-15012: ASM file '+DATA/jmrac/datafile/undotbs1.270.877470213' does not exist
Switch of datafile 3 complete to datafile copy
checkpoint is 1624119
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/users.271.877470213
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/users.271.877470213
ORA-15012: ASM file '+DATA/jmrac/datafile/users.271.877470213' does not exist
Switch of datafile 4 complete to datafile copy
checkpoint is 1624083
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/example.279.877470401
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/example.279.877470401
ORA-15012: ASM file '+DATA/jmrac/datafile/example.279.877470401' does not exist
Switch of datafile 5 complete to datafile copy
checkpoint is 1624119
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14335.trc:
ORA-19625: error identifying file +DATA/jmrac/datafile/undotbs2.280.877470779
ORA-17503: ksfdopn:2 Failed to open file +DATA/jmrac/datafile/undotbs2.280.877470779
ORA-15012: ASM file '+DATA/jmrac/datafile/undotbs2.280.877470779' does not exist
Fri May 29 15:18:01 2015
Signalling error 1152 for datafile 5!
Switch of datafile 6 complete to datafile copy
checkpoint is 1624083
Signalling error 1152 for datafile 6!
Checker run found 2 new persistent data failures
檢視資料檔案是否已經還原:
[oracle@orcltest jmrac]$ ll -h
total 1.5G
-rw-r----- 1 oracle asmadmin 18M May 29 15:18 control01.ctl
-rw-r----- 1 oracle asmadmin 18M May 29 15:18 control02.ctl
-rw-r----- 1 oracle asmadmin 101M May 29 15:16 example01.dbf
-rw-r----- 1 oracle asmadmin 541M May 29 15:17 sysaux01.dbf
-rw-r----- 1 oracle asmadmin 691M May 29 15:17 system01.dbf
-rw-r----- 1 oracle asmadmin 91M May 29 15:16 undotbs01.dbf
-rw-r----- 1 oracle asmadmin 26M May 29 15:17 undotbs02.dbf
-rw-r----- 1 oracle asmadmin 27M May 29 15:17 users01.dbf
[oracle@orcltest jmrac]$
二、 recover 資料庫
由前邊的備份集中可以看出,備份集中的thread 1 的最大日誌號為33,thread 2的最大日誌號為43 ,所以不完全恢復如下:
RMAN> RUN
2> {
3> set until sequence 33 thread 1;
set until sequence 43 thread 2;
recover database;
}
4> 5> 6>
executing command: SET until clause
executing command: SET until clause
Starting recover at 2015-05-29 15:28:05
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1146 device type=DISK
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=42
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=32
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=33
channel ORA_DISK_1: reading from backup piece /home/oracle/rman_back/arch_JMRAC_20150529_11_1.bak
channel ORA_DISK_1: piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_11_1.bak tag=TAG20150529T111603
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_2_42_bpj5896k_.arc thread=2 sequence=42
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_32_bpj5897f_.arc thread=1 sequence=32
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_32_bpj5897f_.arc RECID=74 STAMP=880990089
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_33_bpj5897n_.arc thread=1 sequence=33
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_2_42_bpj5896k_.arc RECID=75 STAMP=880990089
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_33_bpj5897n_.arc RECID=73 STAMP=880990089
media recovery complete, elapsed time: 00:00:02
Finished recover at 2015-05-29 15:28:12
RMAN>
告警日誌:
Fri May 29 15:28:06 2015
alter database recover datafile list clear
Completed: alter database recover datafile list clear
alter database recover datafile list
1 , 2 , 3 , 4 , 5 , 6
Completed: alter database recover datafile list
1 , 2 , 3 , 4 , 5 , 6
alter database recover if needed
start until cancel using backup controlfile
Media Recovery Start
started logmerger process
Parallel Media Recovery started with 2 slaves
ORA-279 signalled during: alter database recover if needed
start until cancel using backup controlfile
...
alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_2_42_bpj5896k_.arc'
Media Recovery Log /u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_2_42_bpj5896k_.arc
ORA-279 signalled during: alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_2_42_bpj5896k_.arc'...
alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_32_bpj5897f_.arc'
Media Recovery Log /u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_32_bpj5897f_.arc
ORA-279 signalled during: alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_32_bpj5897f_.arc'...
alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_33_bpj5897n_.arc'
Media Recovery Log /u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_33_bpj5897n_.arc
ORA-279 signalled during: alter database recover logfile '/u01/app/oracle/flash_recovery_area/JMRAC/archivelog/2015_05_29/o1_mf_1_33_bpj5897n_.arc'...
alter database recover cancel
Media Recovery Canceled
Completed: alter database recover cancel
1.3.3.4 RESETLOGS 開啟資料庫並驗證資料
RMAN> alter database open resetlogs;
database opened
RMAN>
告警日誌:
Fri May 29 15:30:56 2015
alter database open
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
ORA-1589 signalled during: alter database open...
alter database open resetlogs
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 3 of thread 2
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 3 of thread 2
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
RESETLOGS after incomplete recovery UNTIL CHANGE 1625245
Resetting resetlogs activation ID 1916751680 (0x723f4f40)
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/jmrac/redo01_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/jmrac/redo02_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 3 of thread 2
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 3 of thread 2
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/jmrac/redo03_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_ora_14414.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_2.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 4 thread 2: '/u01/app/oracle/oradata/jmrac/redo04_1.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Fri May 29 15:31:08 2015
Setting recovery target incarnation to 3
Fri May 29 15:31:08 2015
Assigning activation ID 1920208641 (0x72740f01)
LGWR: STARTING ARCH PROCESSES
Fri May 29 15:31:09 2015
ARC0 started with pid=22, OS id=14444
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Fri May 29 15:31:10 2015
ARC1 started with pid=26, OS id=14446
Fri May 29 15:31:10 2015
ARC2 started with pid=27, OS id=14448
ARC1: Archival started
Fri May 29 15:31:10 2015
ARC3 started with pid=28, OS id=14450
ARC2: Archival started
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
ARC2: Becoming the heartbeat ARCH
Thread 1 opened at log sequence 1
Current log# 1 seq# 1 mem# 0: /u01/app/oracle/oradata/jmrac/redo01_1.log
Current log# 1 seq# 1 mem# 1: /u01/app/oracle/oradata/jmrac/redo01_2.log
Successful open of redo thread 1
Fri May 29 15:31:10 2015
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Fri May 29 15:31:10 2015
SMON: enabling cache recovery
Redo thread 2 internally disabled at seq 1 (CKPT)
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
ARC1: Archiving disabled thread 2 sequence 1
Archived Log entry 76 added for thread 2 sequence 1 ID 0x0 dest 1:
Successfully onlined Undo Tablespace 2.
Dictionary check beginning
Fri May 29 15:31:14 2015
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_dbw0_14084.trc:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/u01/app/oracle/oradata/jmrac/temp01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/jmrac/jmrac/trace/jmrac_dbw0_14084.trc:
ORA-01186: file 201 failed verification tests
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/u01/app/oracle/oradata/jmrac/temp01.dbf'
File 201 not verified due to error ORA-01157
Dictionary check complete
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Re-creating tempfile /u01/app/oracle/oradata/jmrac/temp01.dbf
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Fri May 29 15:31:22 2015
Starting background process QMNC
Fri May 29 15:31:22 2015
QMNC started with pid=29, OS id=14454
LOGSTDBY: Validating controlfile with logical metadata
LOGSTDBY: Validation complete
Completed: alter database open resetlogs
Fri May 29 15:31:33 2015
Starting background process CJQ0
Fri May 29 15:31:33 2015
CJQ0 started with pid=35, OS id=14472
驗證資料:
[oracle@orcltest dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 15:33:02 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string jmrac
db_unique_name string jmrac
global_names boolean FALSE
instance_name string jmrac
lock_name_space string
log_file_name_convert string
service_names string jmrac
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> set line 9999 pagesize 9999
SQL> col FILE_NAME format a60
SQL> select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile
2 union all
3 select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
4 union all
5 select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
6 union all
7 select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile
8 ;
FILE_TYPE FILE# FILE_NAME STATUS ENABLED
----------- ---------- ------------------------------------------------------------ ------- ----------
datafile 1 /u01/app/oracle/oradata/jmrac/system01.dbf SYSTEM READ WRITE
datafile 2 /u01/app/oracle/oradata/jmrac/sysaux01.dbf ONLINE READ WRITE
datafile 3 /u01/app/oracle/oradata/jmrac/undotbs01.dbf ONLINE READ WRITE
datafile 4 /u01/app/oracle/oradata/jmrac/users01.dbf ONLINE READ WRITE
datafile 5 /u01/app/oracle/oradata/jmrac/example01.dbf ONLINE READ WRITE
datafile 6 /u01/app/oracle/oradata/jmrac/undotbs02.dbf ONLINE READ WRITE
tempfile 1 /u01/app/oracle/oradata/jmrac/temp01.dbf ONLINE READ WRITE
logfile 2 /u01/app/oracle/oradata/jmrac/redo02_1.log
logfile 2 /u01/app/oracle/oradata/jmrac/redo02_2.log
logfile 1 /u01/app/oracle/oradata/jmrac/redo01_1.log
logfile 1 /u01/app/oracle/oradata/jmrac/redo01_2.log
logfile 3 /u01/app/oracle/oradata/jmrac/redo03_1.log
logfile 3 /u01/app/oracle/oradata/jmrac/redo03_2.log
logfile 4 /u01/app/oracle/oradata/jmrac/redo04_1.log
logfile 4 /u01/app/oracle/oradata/jmrac/redo04_2.log
controlfile /u01/app/oracle/oradata/jmrac/control01.ctl
controlfile /u01/app/oracle/oradata/jmrac/control02.ctl
17 rows selected.
SQL> select count(1) from lhr.rac_to_single_test ;
COUNT(1)
----------
72510
SQL>
可以看到資料已經恢復。
1.3.3.5 後續收尾操作
做到這步,都還沒有完啊,只是說目的基本達成,最後還需要收尾的工作。清除未使用執行緒的 redo 日誌組,操作如下:
一、 清除未使用的 redo
SQL> col instance format a8
SQL> select thread#,instance,status,enabled from v$thread;
THREAD# INSTANCE STATUS ENABLED
---------- -------- ------ --------
1 jmrac OPEN PUBLIC
2 jmrac2 CLOSED PUBLIC
SQL> select group#,thread#,archived,status from v$log;
GROUP# THREAD# ARC STATUS
---------- ---------- --- ----------------
1 1 NO CURRENT
2 1 YES UNUSED
3 2 YES ACTIVE
4 2 YES UNUSED
SQL> alter database disable thread 2 ;
Database altered.
SQL> alter database drop logfile group 3 ;
Database altered.
SQL> alter database drop logfile group 4 ;
Database altered.
SQL>
SQL> select thread#,instance,status,enabled from v$thread;
THREAD# INSTANCE STATUS ENABLED
---------- -------- ------ --------
1 jmrac OPEN PUBLIC
SQL>
SQL> select group#,thread#,archived,status from v$log;
GROUP# THREAD# ARC STATUS
---------- ---------- --- ----------------
1 1 NO CURRENT
2 1 YES UNUSED
SQL>
生產環境可以再增加一些日誌組。
二、 清除多餘的 undo 檔案
我們知道rac 中每個節點使用的都是自己的undo,所以有2個undo檔案,這裡可以清除,也可以不用清除,因為有的時候undo壞了可以很迅速的切換到另外的undo 空間,清理過程如下:
SQL> select name from v$tablespace where name like 'UNDO%';
NAME
------------------------------
UNDOTBS1
UNDOTBS2
SQL> show parameter undo_tablespace;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS1
SQL> drop tablespace undotbs2 including contents and datafiles;
Tablespace dropped.
SQL>
1.3.4 實驗總結
rac資料庫遷移到單例項環境下的步驟和單例項的資料庫遷移到單例項環境基本是一樣的,只是在最後還原的時候需要設定2 個thread 即可。
1.4 總結
至此,rac 資料庫遷移到單例項環境下的操作步驟基本完畢,至於配置監聽和tns 等工作都是基本的,大家自己完成即可,這裡就不再演示了,另外實驗中需要關注的幾個地方,我都特別做了說明。
以上的文章是轉載別人的,其中有一點需要說一下:就是我們在源端的rac環境中備份完成傳輸的目標端的單例項資料庫中以後使用rman會完成控制檔案,在恢復資料檔案的時候會報
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/08/2018 05:03:36
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
報錯出現的原因:由於在生產上備份的目錄和測試庫上的存放備份檔案的目錄不一致導致的。
RMAN將執行一個隱式交叉檢查,將備份標記為過期。
RMAN在備份期間放置備份的位置查詢備份。備份已被放置在新主機上的新目錄中。備份被儲存到磁碟上,並在新主機的另一個不同位置恢復。可以使用以下命令檢視:
RMAN> crosscheck backup;
RMAN> crosscheck copy;
發出RMAN crosscheck命令將驗證備份是否存在於備份期間所放置的磁碟位置上。
當客戶將備份放在不同的位置時,會發生過期狀態。
可用狀態表明RMAN知道備份,並將在還原期間使用備份。
為了告訴RMAN磁碟上備份的位置已經更改,請使用RMAN catalog命令。
的例子,編目多個備份在一個目錄:
下面的示例編目了複製到/tmp director中的備份片段的目錄:
執行
RMAN> CATALOG START WITH '/tmp/';
有的時候我們執行完成以後還會報錯這個時候需要調整一下incaraction.
使用list incarnation;
reset database to incarnation 2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-2285831/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RAC】將單例項備份集恢復為rac資料庫單例資料庫
- 【RAC】將RAC備份集恢復為單例項資料庫單例資料庫
- 單例項備份集恢復到RAC單例
- 單例項環境利用備份恢復RAC資料庫(四)單例資料庫
- 單例項環境利用備份恢復RAC資料庫(三)單例資料庫
- 單例項環境利用備份恢復RAC資料庫(二)單例資料庫
- 單例項環境利用備份恢復RAC資料庫(一)單例資料庫
- 單例項備份恢復成RAC單例
- RAC資料庫恢復到單例項資料庫資料庫單例
- 恢復RAC資料庫到單例項(ASM)資料庫單例ASM
- 從nub備份恢復(同平臺)恢復RAC至單例項單例
- 單例項恢復RAC資料庫步驟(三)單例資料庫
- 單例項恢復RAC資料庫步驟(二)單例資料庫
- 單例項恢復RAC資料庫步驟(一)單例資料庫
- 【kingsql分享】將RAC資料庫異機恢復到單例項(Ⅰ)SQL資料庫單例
- 資料庫的備份與恢復分析及例項資料庫
- 【備份恢復】從備份恢復資料庫資料庫
- RAC環境利用備份恢復RAC資料庫(五)資料庫
- RAC環境利用備份恢復RAC資料庫(四)資料庫
- RAC環境利用備份恢復RAC資料庫(三)資料庫
- RAC環境利用備份恢復RAC資料庫(二)資料庫
- RAC環境利用備份恢復RAC資料庫(一)資料庫
- RMAN備份恢復——RAC環境資料庫的備份(zt)資料庫
- RMAN備份恢復--RAC環境資料庫的備份(十)資料庫
- RMAN備份恢復——RAC環境資料庫的備份(一)資料庫
- rac恢復到單例項單例
- 單例項恢復至RAC單例
- RAC資料庫的RMAN備份異機恢復到單節點資料庫資料庫
- 成功恢復無備份RAC環境資料庫資料庫
- ORACLE RAC資料庫的備份與恢復(6)Oracle資料庫
- ORACLE RAC資料庫的備份與恢復(5)Oracle資料庫
- ORACLE RAC資料庫的備份與恢復(4)Oracle資料庫
- ORACLE RAC資料庫的備份與恢復(3)Oracle資料庫
- ORACLE RAC資料庫的備份與恢復(2)Oracle資料庫
- ORACLE RAC資料庫的備份與恢復(1)Oracle資料庫
- RAC 資料庫恢復到單例項下並且基於時間點恢復資料庫單例
- RAC從帶庫到單例項的恢復單例
- RAC asm恢復到單例項ASM單例