Performing RMAN Recovery

安装数据库软件(不需要安装实例)

创建对应路径(与原库路径一致)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mkdir -p /u01/app/oracle/oradata/TEST
mkdir -p /u01/app/oracle/fast_recovery_area
mkdir -p /u01/app/oracle/admin/TEST
mkdir /u01/app/oracle/admin/TEST/adump
mkdir /u01/app/oracle/admin/TEST/bdump
mkdir /u01/app/oracle/admin/TEST/cdump
mkdir /u01/app/oracle/admin/TEST/ddump
mkdir -p /u01/app/oracle/oradata/TEST/19A9B2E4ED836CFCE0537680A8C03E8F/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE
mkdir -p /u01/app/oracle/oradata/TEST/BCG/DATAFILE
mkdir /u01/app/oracle/oradata/TEST/CONTROLFILE
mkdir /u01/app/oracle/oradata/TEST/DATAFILE

开始恢复

rman target / nocatalog

设置DBID

可通过原库查询,也可通过控制文件的备份名称获得(备份名称c-DBID-date-num.bak)

1
SET DBID 999753383;

恢复spfile 和 pfile

1
2
3
STARTUP NOMOUNT;
RESTORE SPFILE FROM '/u01/rmanbak/c-999753383-20170925-00.bak';
RESTORE SPFILE TO PFILE '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initTEST.ora' FROM '/u01/rmanbak/c-999753383-20170925-00.bak';

结合当前服务器的配置信息修改pfile文件

1
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
TEST.__data_transfer_cache_size=0
TEST.__db_cache_size=1010827260
TEST.__java_pool_size=20971520
TEST.__large_pool_size=8388608
TEST.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
TEST.__pga_aggregate_target=289406976
TEST.__sga_target=1333788670
TEST.__shared_io_pool_size=46137344
TEST.__shared_pool_size=234881024
TEST.__streams_pool_size=8388608
*.audit_file_dest='/u01/app/oracle/admin/TEST/adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.control_files='/u01/app/oracle/oradata/TEST/CONTROLFILE/current.257.883692833','/u01/app/oracle/oradata/TEST/CONTROLFILE/current.258.883692835'
*.db_block_size=32768
*.db_domain=''
*.db_name='TEST'
*.db_recovery_file_dest_size=30g
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTXDB)'
*.enable_pluggable_database=true
*.open_cursors=300
*.pga_aggregate_target=1310m
*.processes=1500
*.remote_login_passwordfile='exclusive'
*.resource_manager_plan=''
*.sga_target=5242m

使用pfile文件启动数据库到NOMOUNT状态

1
STARTUP FORCE NOMOUNT PFILE='/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initTEST.ora';

恢复控制文件

1
RESTORE CONTROLFILE FROM '/u01/rmanbak/c-999753383-20170925-00.bak';

切换数据库为MOUNT状态

1
sql 'alter database mount';

执行恢复

以下之所以rename,因为新库的数据文件路径发生改变,所以需要rename,可通过再rman中执行report schema查看所有的数据文件名和文件编号

1
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
CATALOG START WITH '/u01/rmanbak';
RUN
{
ALLOCATE CHANNEL c1 TYPE DISK;
SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/TEST/DATAFILE/system.263.883692841';
SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/TEST/19A9B2E4ED836CFCE0537680A8C03E8F/DATAFILE/system.264.883692851';
SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/TEST/DATAFILE/sysaux.265.883692857';
SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/TEST/19A9B2E4ED836CFCE0537680A8C03E8F/DATAFILE/sysaux.266.883692865';
SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/TEST/DATAFILE/undotbs1.267.883692869';
SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/TEST/DATAFILE/undotbs2.270.883692925';
SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/TEST/DATAFILE/users.271.883692927';
SET NEWNAME FOR DATAFILE 15 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE/system.282.884366019';
SET NEWNAME FOR DATAFILE 16 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE/sysaux.281.884366019';
SET NEWNAME FOR DATAFILE 20 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE/fcprod_01.dbf';
SET NEWNAME FOR DATAFILE 21 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE/fcprod_02.dbf';
SET NEWNAME FOR DATAFILE 22 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/system.288.885650835';
SET NEWNAME FOR DATAFILE 23 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sysaux.289.885650835';
SET NEWNAME FOR DATAFILE 24 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sugontra_01.dbf';
SET NEWNAME FOR DATAFILE 25 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sugontra_02.dbf';
SET NEWNAME FOR DATAFILE 33 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sgtread.dbf';
SET NEWNAME FOR DATAFILE 38 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/system.365.897157457';
SET NEWNAME FOR DATAFILE 39 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sysaux.376.897157457';
SET NEWNAME FOR DATAFILE 42 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/system.886.898112773';
SET NEWNAME FOR DATAFILE 43 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/sysaux.896.898112773';
SET NEWNAME FOR DATAFILE 44 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_01.dbf';
SET NEWNAME FOR DATAFILE 45 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_02.dbf';
SET NEWNAME FOR DATAFILE 50 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_01.dbf';
SET NEWNAME FOR DATAFILE 51 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_02.dbf';
SET NEWNAME FOR DATAFILE 63 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_data.2127.902684869';
SET NEWNAME FOR DATAFILE 64 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/system.4371.904906001';
SET NEWNAME FOR DATAFILE 65 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/sysaux.4372.904906011';
SET NEWNAME FOR DATAFILE 66 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4376.904906531';
SET NEWNAME FOR DATAFILE 67 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4377.904906561';
SET NEWNAME FOR DATAFILE 68 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4378.904906591';
SET NEWNAME FOR DATAFILE 69 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4379.904906621';
SET NEWNAME FOR DATAFILE 70 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4380.904906651';
SET NEWNAME FOR DATAFILE 71 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4381.904906683';
SET NEWNAME FOR DATAFILE 72 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4382.904906713';
SET NEWNAME FOR DATAFILE 73 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4383.904906741';
SET NEWNAME FOR DATAFILE 74 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data.4384.904906771';
SET NEWNAME FOR DATAFILE 75 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/system.9415.906672919';
SET NEWNAME FOR DATAFILE 76 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/sysaux.11560.906672919';
SET NEWNAME FOR DATAFILE 77 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_01.dbf';
SET NEWNAME FOR DATAFILE 78 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_02.dbf';
SET NEWNAME FOR DATAFILE 79 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_03.dbf';
SET NEWNAME FOR DATAFILE 80 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_03.dbf';
SET NEWNAME FOR DATAFILE 81 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_04.dbf';
SET NEWNAME FOR DATAFILE 82 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_05.dbf';
SET NEWNAME FOR DATAFILE 83 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_06.dbf';
SET NEWNAME FOR DATAFILE 84 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_04.dbf';
SET NEWNAME FOR DATAFILE 85 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_03.dbf';
SET NEWNAME FOR DATAFILE 86 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_10.dbf';
SET NEWNAME FOR DATAFILE 87 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_data_6.dbf';
SET NEWNAME FOR DATAFILE 88 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_7.dbf';
SET NEWNAME FOR DATAFILE 89 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_11.dbf';
SET NEWNAME FOR DATAFILE 90 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_8.dbf';
SET NEWNAME FOR DATAFILE 91 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_9.dbf';
SET NEWNAME FOR DATAFILE 92 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_12.dbf';
SET NEWNAME FOR DATAFILE 93 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_10.dbf';
SET NEWNAME FOR DATAFILE 94 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_11.dbf';
SET NEWNAME FOR DATAFILE 95 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_12.dbf';
SET NEWNAME FOR DATAFILE 96 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_13.dbf';
SET NEWNAME FOR DATAFILE 116 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_13.dbf';
SET NEWNAME FOR DATAFILE 117 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_14.dbf';
SET NEWNAME FOR DATAFILE 118 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_15.dbf';
SET NEWNAME FOR DATAFILE 119 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_16.dbf';
SET NEWNAME FOR DATAFILE 120 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_14.dbf';
SET NEWNAME FOR DATAFILE 121 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/system.6863.913669707';
SET NEWNAME FOR DATAFILE 122 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/sysaux.6861.913669707';
SET NEWNAME FOR DATAFILE 123 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_01.dbf';
SET NEWNAME FOR DATAFILE 124 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_02.dbf';
SET NEWNAME FOR DATAFILE 125 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_03.dbf';
SET NEWNAME FOR DATAFILE 126 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_04.dbf';
SET NEWNAME FOR DATAFILE 127 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_05.dbf';
SET NEWNAME FOR DATAFILE 128 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_15.dbf';
SET NEWNAME FOR DATAFILE 129 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_17.dbf';
SET NEWNAME FOR DATAFILE 130 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_data_7.dbf';
SET NEWNAME FOR DATAFILE 131 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_18.dbf';
SET NEWNAME FOR DATAFILE 132 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_19.dbf';
SET NEWNAME FOR DATAFILE 133 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_16.dbf';
SET NEWNAME FOR DATAFILE 134 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_20.dbf';
SET NEWNAME FOR DATAFILE 135 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_21.dbf';
SET NEWNAME FOR DATAFILE 136 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_17.dbf';
SET NEWNAME FOR DATAFILE 137 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_data_4.dbf';
SET NEWNAME FOR DATAFILE 142 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_data_5.dbf';
SET NEWNAME FOR DATAFILE 147 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_data_8.dbf';
SET NEWNAME FOR DATAFILE 149 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_18.dbf';
SET NEWNAME FOR DATAFILE 150 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_data_19.dbf';
SET NEWNAME FOR DATAFILE 151 TO'/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_22.dbf';
SET NEWNAME FOR DATAFILE 152 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_data_9.dbf';
SET NEWNAME FOR DATAFILE 153 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_23.dbf';
SET NEWNAME FOR DATAFILE 154 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_data_6.dbf';
SET NEWNAME FOR DATAFILE 155 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_24.dbf';
SET NEWNAME FOR DATAFILE 156 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_06.dbf';
SET NEWNAME FOR DATAFILE 157 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_25.dbf';
SET NEWNAME FOR DATAFILE 169 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/system01.dbf';
SET NEWNAME FOR DATAFILE 170 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 171 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_01.dbf';
SET NEWNAME FOR DATAFILE 172 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_02.dbf';
SET NEWNAME FOR DATAFILE 173 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_03.dbf';
SET NEWNAME FOR DATAFILE 174 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_04.dbf';
SET NEWNAME FOR DATAFILE 175 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_05.dbf';
SET NEWNAME FOR DATAFILE 176 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_06.dbf';
SET NEWNAME FOR DATAFILE 177 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_07.dbf';
SET NEWNAME FOR DATAFILE 178 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_08.dbf';
SET NEWNAME FOR DATAFILE 179 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/clouddemo_09.dbf';
SET NEWNAME FOR DATAFILE 180 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_data_26.dbf';
SET NEWNAME FOR DATAFILE 181 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_07.dbf';
SET NEWNAME FOR TEMPFILE 1 TO '/u01/app/oracle/oradata/TEST/TEMPFILE/temp.268.883692873';
SET NEWNAME FOR TEMPFILE 2 TO '/u01/app/oracle/oradata/TEST/19A9B2E4ED836CFCE0537680A8C03E8F/TEMPFILE/temp.269.883692873';
SET NEWNAME FOR TEMPFILE 3 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_temp.dbf';
SET NEWNAME FOR TEMPFILE 4 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/TEMPFILE/temp.283.884366053';
SET NEWNAME FOR TEMPFILE 5 TO '/u01/app/oracle/oradata/TEST/1A325228C22837A9E0537680A8C0AB5A/DATAFILE/fcprod_temp.dbf';
SET NEWNAME FOR TEMPFILE 6 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/TEMPFILE/temp.290.885650869';
SET NEWNAME FOR TEMPFILE 7 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sugontra_temp.dbf';
SET NEWNAME FOR TEMPFILE 8 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/TEMPFILE/temp.9418.906672955';
SET NEWNAME FOR TEMPFILE 9 TO '/u01/app/oracle/oradata/TEST/2E2B9591B4C13CC9E0537680A8C09CCF/DATAFILE/zzmetro_temp.dbf';
SET NEWNAME FOR TEMPFILE 10 TO '/u01/app/oracle/oradata/TEST/1B5D770684A12982E0537680A8C00768/DATAFILE/sgtread_temp.dbf';
SET NEWNAME FOR TEMPFILE 11 TO '/u01/app/oracle/oradata/TEST/BCG/DATAFILE/temp01.dbf';
SET NEWNAME FOR TEMPFILE 13 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/TEMPFILE/temp.462.897157491';
SET NEWNAME FOR TEMPFILE 14 TO '/u01/app/oracle/oradata/TEST/25C07163596B0AD0E0537680A8C0EAE1/DATAFILE/sugonpro_temp.dbf';
SET NEWNAME FOR TEMPFILE 15 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/TEMPFILE/temp.898.898112805';
SET NEWNAME FOR TEMPFILE 16 TO '/u01/app/oracle/oradata/TEST/268AC0DAD4617497E0537680A8C0152A/DATAFILE/absenpro_temp.dbf';
SET NEWNAME FOR TEMPFILE 19 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/ljbb_temp_01.dbf';
SET NEWNAME FOR TEMPFILE 20 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/TEMPFILE/temp.6857.913669745';
SET NEWNAME FOR TEMPFILE 21 TO '/u01/app/oracle/oradata/TEST/347488B0A2DA5C21E0537680A8C0E0CA/DATAFILE/shacpro_temp.dbf';
SET NEWNAME FOR TEMPFILE 25 TO '/u01/app/oracle/oradata/TEST/2CB869B96579626EE0530C30A8C0E46C/DATAFILE/temp001.dbf';
RESTORE DATABASE;
switch DATAFILE all;
switch tempfile all;
RECOVER DATABASE;
}

由于归档日志缺失,只能部分恢复数据库,也就是只能恢复到rman备份的那一刻,根据报错显示的SCN号,恢复到指定SCN

1
RECOVER DATABASE UNTIL SCN 10144773006017;

根据pfile创建spfile

1
Create spfile from pfile='/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initTEST.ora';

修改日志文件路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
select member from v$logfile;
mkdir -p /u01/app/oracle/oradata/TEST/ONLINELOG;
mkdir -p /u01/app/oracle/oradata/TEST/STANDBYLOG;
alter database rename file '+DATA/TEST/ONLINELOG/group1.259.883692835' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group1.259.883692835';
alter database rename file '+DATA/TEST/ONLINELOG/group1.260.883692837' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group1.260.883692837';
alter database rename file '+DATA/TEST/ONLINELOG/group2.261.883692837' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group2.261.883692837';
alter database rename file '+DATA/TEST/ONLINELOG/group2.262.883692839' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group2.262.883692839';
alter database rename file '+DATA/TEST/ONLINELOG/group3.272.883704715' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group3.272.883704715';
alter database rename file '+DATA/TEST/ONLINELOG/group3.273.883704717' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group3.273.883704717';
alter database rename file '+DATA/TEST/ONLINELOG/group4.274.883704719' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group4.274.883704719';
alter database rename file '+DATA/TEST/ONLINELOG/group4.275.883704721' to '/u01/app/oracle/oradata/TEST/ONLINELOG/group4.275.883704721';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group11.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group11.log';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group12.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group12.log';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group13.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group13.log';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group14.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group14.log';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group15.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group15.log';
alter database rename file '+DATA/TEST/STANDBYLOG/standby_group16.log' to '/u01/app/oracle/oradata/TEST/STANDBYLOG/standby_group16.log';

启动数据库

由于修改了数据库日志路径,第一次启动需要resetlogs

1
alter database open resetlogs;

创建lisenter

1
netca /silent /responsefile /u01/software/database/response/netca.rsp