veritas netbackup恢复步骤
veritas netbackup恢复步骤
前段时间,做了一次nbu的同机恢复测试。
环境是这样的:
备份和还原都是在一个机器上,hostname是sg2as059。即备份的client是这个机器。数据库的实例名是test.
无catalog数据库,备份信息保留在控制文件中。
备份的master server和media server是同一台机器,hostname是sg2ts001。
前一天晚上设置nbu的policy进行备份,备份脚本在client上:
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test> pwd
/usr/openv/netbackup/ext/db_ext/oracle/test
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test> cat hot_database_backup.sh
#!/bin/sh
# $Header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $
#
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2005 VERITAS Software Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#
# ---------------------------------------------------------------------------
# hot_database_backup.sh
# ---------------------------------------------------------------------------
# This script uses Recovery Manager to take a hot (inconsistent) database
# backup. A hot backup is inconsistent because portions of the database are
# being modified and written to the disk while the backup is progressing.
# You must run your database in ARCHIVELOG mode to make hot backups. It is
# assumed that this script will be executed by user root. In order for RMAN
# to work properly we switch user (su -) to the oracle dba account before
# execution. If this script runs under a user account that has Oracle dba
# privilege, it will be executed using this user's account.
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# Determine the user which is executing this script.
# ---------------------------------------------------------------------------
CUSER=`id |cut -d"(" -f2 | cut -d ")" -f1`
# ---------------------------------------------------------------------------
# Put output in <this file name>.out. Change as desired.
# Note: output directory requires write permission.
# ---------------------------------------------------------------------------
RMAN_LOG_FILE=${0}.out
# ---------------------------------------------------------------------------
# You may want to delete the output file so that backup information does
# not accumulate. If not, delete the following lines.
# ---------------------------------------------------------------------------
if [ -f "$RMAN_LOG_FILE" ]
then
rm -f "$RMAN_LOG_FILE"
fi
# -----------------------------------------------------------------
# Initialize the log file.
# -----------------------------------------------------------------
echo >> $RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE
# ---------------------------------------------------------------------------
# Log the start of this script.
# ---------------------------------------------------------------------------
echo Script $0 >> $RMAN_LOG_FILE
echo ==== started on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
# ---------------------------------------------------------------------------
# Replace /db/oracle/product/ora81, below, with the Oracle home path.
# ---------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/OraHome1
export ORACLE_HOME
# ---------------------------------------------------------------------------
# Replace ora81, below, with the Oracle SID of the target database.
# ---------------------------------------------------------------------------
ORACLE_SID=test
export ORACLE_SID
# ---------------------------------------------------------------------------
# Replace ora81, below, with the Oracle DBA user id (account).
# ---------------------------------------------------------------------------
ORACLE_USER=oracle
# ---------------------------------------------------------------------------
# Set the target connect string.
# Replace "sys/manager", below, with the target connect string.
# ---------------------------------------------------------------------------
TARGET_CONNECT_STR=/
# ---------------------------------------------------------------------------
# Set the Oracle Recovery Manager name.
# ---------------------------------------------------------------------------
RMAN=$ORACLE_HOME/bin/rman
# ---------------------------------------------------------------------------
# Print out the value of the variables set by this script.
# ---------------------------------------------------------------------------
echo >> $RMAN_LOG_FILE
echo "RMAN: $RMAN" >> $RMAN_LOG_FILE
echo "ORACLE_SID: $ORACLE_SID" >> $RMAN_LOG_FILE
echo "ORACLE_USER: $ORACLE_USER" >> $RMAN_LOG_FILE
echo "ORACLE_HOME: $ORACLE_HOME" >> $RMAN_LOG_FILE
# ---------------------------------------------------------------------------
# Print out the value of the variables set by bphdb.
# ---------------------------------------------------------------------------
echo >> $RMAN_LOG_FILE
echo "NB_ORA_FULL: $NB_ORA_FULL" >> $RMAN_LOG_FILE
echo "NB_ORA_INCR: $NB_ORA_INCR" >> $RMAN_LOG_FILE
echo "NB_ORA_CINC: $NB_ORA_CINC" >> $RMAN_LOG_FILE
echo "NB_ORA_SERV: $NB_ORA_SERV" >> $RMAN_LOG_FILE
echo "NB_ORA_POLICY: $NB_ORA_POLICY" >> $RMAN_LOG_FILE
# ---------------------------------------------------------------------------
# NOTE: This script assumes that the database is properly opened. If desired,
# this would be the place to verify that.
# ---------------------------------------------------------------------------
echo >> $RMAN_LOG_FILE
# ---------------------------------------------------------------------------
# If this script is executed from a NetBackup schedule, NetBackup
# sets an NB_ORA environment variable based on the schedule type.
# The NB_ORA variable is then used to dynamically set BACKUP_TYPE
# For example, when:
# schedule type is BACKUP_TYPE is
# ---------------- --------------
# Automatic Full INCREMENTAL LEVEL=0
# Automatic Differential Incremental INCREMENTAL LEVEL=1
# Automatic Cumulative Incremental INCREMENTAL LEVEL=1 CUMULATIVE
#
# For user initiated backups, BACKUP_TYPE defaults to incremental
# level 0 (full). To change the default for a user initiated
# backup to incremental or incremental cumulative, uncomment
# one of the following two lines.
# BACKUP_TYPE="INCREMENTAL LEVEL=1"
# BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"
#
# Note that we use incremental level 0 to specify full backups.
# That is because, although they are identical in content, only
# the incremental level 0 backup can have incremental backups of
# level > 0 applied to it.
# ---------------------------------------------------------------------------
if [ "$NB_ORA_FULL" = "1" ]
then
echo "Full backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=0"
elif [ "$NB_ORA_INCR" = "1" ]
then
echo "Differential incremental backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=1"
elif [ "$NB_ORA_CINC" = "1" ]
then
echo "Cumulative incremental backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"
elif [ "$BACKUP_TYPE" = "" ]
then
echo "Default - Full backup requested" >> $RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTAL LEVEL=0"
fi
# ---------------------------------------------------------------------------
# Call Recovery Manager to initiate the backup. This example does not use a
# Recovery Catalog. If you choose to use one, replace the option 'nocatalog'
# from the rman command line below with the
# 'rcvcat <userid>/<passwd>@<tns alias>' statement.
#
# Note: Any environment variables needed at run time by RMAN
# must be set and exported within the switch user (su) command.
# ---------------------------------------------------------------------------
# Backs up the whole database. This backup is part of the incremental
# strategy (this means it can have incremental backups of levels > 0
# applied to it).
#
# We do not need to explicitly request the control file to be included
# in this backup, as it is automatically included each time file 1 of
# the system tablespace is backed up (the inference: as it is a whole
# database backup, file 1 of the system tablespace will be backed up,
# hence the controlfile will also be included automatically).
#
# Typically, a level 0 backup would be done at least once a week.
#
# The scenario assumes:
# o you are backing your database up to two tape drives
# o you want each backup set to include a maximum of 5 files
# o you wish to include offline datafiles, and read-only tablespaces,
# in the backup
# o you want the backup to continue if any files are inaccessible.
# o you are not using a Recovery Catalog
# o you are explicitly backing up the control file. Since you are
# specifying nocatalog, the controlfile backup that occurs
# automatically as the result of backing up the system file is
# not sufficient; it will not contain records for the backup that
# is currently in progress.
# o you want to archive the current log, back up all the
# archive logs using two channels, putting a maximum of 20 logs
# in a backup set, and deleting them once the backup is complete.
#
# Note that the format string is constructed to guarantee uniqueness and
# to enhance NetBackup for Oracle backup and restore performance.
#
#
# NOTE WHEN USING TNS ALIAS: When connecting to a database
# using a TNS alias, you must use a send command or a parms operand to
# specify environment variables. In other words, when accessing a database
# through a listener, the environment variables set at the system level are not
# visible when RMAN is running. For more information on the environment
# variables, please refer to the NetBackup for Oracle Admin. Guide.
#
# ---------------------------------------------------------------------------
CMD_STR="
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOF
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
$BACKUP_TYPE
SKIP INACCESSIBLE
TAG hot_db_bk_level0
FILESPERSET 5
# recommended format
FORMAT 'bk_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
filesperset 20
FORMAT 'al_%s_%p_%t'
ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
#
# Note: During the process of backing up the database, RMAN also backs up the
# control file. This version of the control file does not contain the
# information about the current backup because "nocatalog" has been specified.
# To include the information about the current backup, the control file should
# be backed up as the last step of the RMAN section. This step would not be
# necessary if we were using a recovery catalog.
#
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
BACKUP
# recommended format
FORMAT 'cntrl_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EOF
"
echo "$CMD_STR" >> $RMAN_LOG_FILE
# Initiate the command string
if [ "$CUSER" = "root" ]
then
su - $ORACLE_USER -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$?
else
/usr/bin/sh -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$?
fi
# ---------------------------------------------------------------------------
# Log the completion of this script.
# ---------------------------------------------------------------------------
if [ "$RSTAT" = "0" ]
then
LOGMSG="ended successfully"
else
LOGMSG="ended in error"
fi
echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE
exit $RSTAT
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test>
|
从备份脚本得知,备份的log是同目录下的,和备份脚本同名的.out文件。
因此我们可以检查一下备份的log,看看是否备份成功,以及获取其他还原时需要的信息:
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test> cat hot_database_backup.sh.out
Script /usr/openv/netbackup/ext/db_ext/oracle/test/hot_database_backup.sh
==== started on Mon Jun 13 16:11:33 WAUST 2011 ====
RMAN: /u01/app/oracle/OraHome1/bin/rman
ORACLE_SID: test
ORACLE_USER: oracle
ORACLE_HOME: /u01/app/oracle/OraHome1
NB_ORA_FULL: 1
NB_ORA_INCR: 0
NB_ORA_CINC: 0
NB_ORA_SERV: sg2ts001
NB_ORA_POLICY: sg2as059_oracle_nbutest_backup
Full backup requested
ORACLE_HOME=/u01/app/oracle/OraHome1
export ORACLE_HOME
ORACLE_SID=test
export ORACLE_SID
/u01/app/oracle/OraHome1/bin/rman target / nocatalog msglog /usr/openv/netbackup/ext/db_ext/oracle/test/hot_database_backup.sh.out append << EOF
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
INCREMENTAL LEVEL=0
SKIP INACCESSIBLE
TAG hot_db_bk_level0
FILESPERSET 5
# recommended format
FORMAT 'bk_%s_%p_%t'
DATABASE;
sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
BACKUP
filesperset 20
FORMAT 'al_%s_%p_%t'
ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
#
# Note: During the process of backing up the database, RMAN also backs up the
# control file. This version of the control file does not contain the
# information about the current backup because nocatalog has been specified.
# To include the information about the current backup, the control file should
# be backed up as the last step of the RMAN section. This step would not be
# necessary if we were using a recovery catalog.
#
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
BACKUP
# recommended format
FORMAT 'cntrl_%s_%p_%t'
CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
EOF
SID STATUS ORACLE_HOME LISTENER_NAME STATUS
=== ====== =========== ============= ======
sg2ora002 UP /u01/app/oracle/OraHome1 LISTENER UP
Use "dbsw" to select your environment from a list
or use ". dbset <ORACLE_SID> [<PERS_FILE>]" to set the environment manually
[YOU HAVE NEW MAIL]
Recovery Manager: Release 10.2.0.3.0 - Production on Mon Jun 13 16:11:35 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=2051517555)
using target database control file instead of recovery catalog
RMAN> 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> RMAN> 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>
allocated channel: ch00
channel ch00: sid=28 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
allocated channel: ch01
channel ch01: sid=32 devtype=SBT_TAPE
channel ch01: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
Starting backup at 13-JUN-11
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00003 name=/u07/test/oradata/sysaux01.dbf
input datafile fno=00002 name=/u07/test/oradata/undotbs01.dbf
channel ch00: starting piece 1 at 13-JUN-11
channel ch01: starting incremental level 0 datafile backupset
channel ch01: specifying datafile(s) in backupset
input datafile fno=00001 name=/u07/test/oradata/system01.dbf
input datafile fno=00004 name=/u07/test/oradata/tbs_1.dbf
channel ch01: starting piece 1 at 13-JUN-11
channel ch00: finished piece 1 at 13-JUN-11
piece handle=bk_9_1_753725520 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:02:56
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
channel ch00: starting piece 1 at 13-JUN-11
channel ch01: finished piece 1 at 13-JUN-11
piece handle=bk_10_1_753725520 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch01: backup set complete, elapsed time: 00:04:01
channel ch01: starting incremental level 0 datafile backupset
channel ch01: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ch01: starting piece 1 at 13-JUN-11
channel ch00: finished piece 1 at 13-JUN-11
piece handle=bk_11_1_753725696 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:41
channel ch01: finished piece 1 at 13-JUN-11
piece handle=bk_12_1_753725761 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch01: backup set complete, elapsed time: 00:01:21
Finished backup at 13-JUN-11
sql statement: alter system archive log current
released channel: ch00
released channel: ch01
allocated channel: ch00
channel ch00: sid=28 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
allocated channel: ch01
channel ch01: sid=32 devtype=SBT_TAPE
channel ch01: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
Starting backup at 13-JUN-11
current log archived
channel ch00: starting archive log backupset
channel ch00: specifying archive log(s) in backup set
input archive log thread=1 sequence=11 recid=6 stamp=753725855
channel ch00: starting piece 1 at 13-JUN-11
channel ch01: starting archive log backupset
channel ch01: specifying archive log(s) in backup set
input archive log thread=1 sequence=12 recid=7 stamp=753725856
channel ch01: starting piece 1 at 13-JUN-11
channel ch01: finished piece 1 at 13-JUN-11
piece handle=al_14_1_753725861 tag=TAG20110613T161737 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch01: backup set complete, elapsed time: 00:01:06
channel ch01: deleting archive log(s)
archive log filename=/u07/test/arch/1_12_753371123.dbf recid=7 stamp=753725856
channel ch00: finished piece 1 at 13-JUN-11
piece handle=al_13_1_753725861 tag=TAG20110613T161737 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:51
channel ch00: deleting archive log(s)
archive log filename=/u07/test/arch/1_11_753371123.dbf recid=6 stamp=753725855
Finished backup at 13-JUN-11
released channel: ch00
released channel: ch01
allocated channel: ch00
channel ch00: sid=28 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
Starting backup at 13-JUN-11
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
channel ch00: starting piece 1 at 13-JUN-11
channel ch00: finished piece 1 at 13-JUN-11
piece handle=cntrl_15_1_753725973 tag=TAG20110613T161932 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:05
Finished backup at 13-JUN-11
released channel: ch00
RMAN> RMAN>
Recovery Manager complete.
Script /usr/openv/netbackup/ext/db_ext/oracle/test/hot_database_backup.sh
==== ended successfully on Mon Jun 13 16:20:38 WAUST 2011 ====
oracle@sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test>
|
在这里面有大量一会我们还原数据库时所需要用到的信息,因此该log非常重要,建议也备份到磁带上。
另外,我们也可以通过bplist来看备份集:
sg2as059:/usr/openv/netbackup/ext/db_ext/oracle/test>/usr/openv/netbackup/bin/bplist -t 4 -l -R /
1
2
3
4
5
6
7
8
|
-rw------- oracle oracle 5505024 Jun 13 16:20 /cntrl_15_1_753725973
-rw------- oracle oracle 98041856 Jun 13 16:19 /al_13_1_753725861
-rw------- oracle oracle 262144 Jun 13 16:18 /al_14_1_753725861
-rw------- oracle oracle 262144 Jun 13 16:16 /bk_12_1_753725761
-rw------- oracle oracle 5505024 Jun 13 16:16 /bk_11_1_753725696
-rw------- oracle oracle 137101312 Jun 13 16:15 /bk_10_1_753725520
-rw------- oracle oracle 153878528 Jun 13 16:14 /bk_9_1_753725520
......
|
下面我们开始设计一些场景来进行数据库的还原:
场景一:丢失spfile:
如果我们丢失了spfile,我们可以以下方式还原:
1. 用rman连接数据库,注意由于没有spfile,数据库无法启动,需要现在rman下启动一个dummy数据库。另外,由于数据库还未启动都mount状态,因此无法用rman sys/change_on_install@tnsname的方式连接数据库。只能用os鉴权的方式登录。
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
|
oracle@sg2as059:/u01/app/oracle/OraHome1/dbs> rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jun 16 17:15:57 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN>
RMAN>
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/OraHome1/dbs/inittest.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 2071296 bytes
Variable Size 67110144 bytes
Database Buffers 83886080 bytes
Redo Buffers 6316032 bytes
RMAN>
|
2.因为要恢复spfile,我要set dbid,由于没有用catalog,我们无法list incarnation,我们只能从备份的log去找dbid,注意log中的以下信息:
1
2
|
connected to target database: TEST (DBID=2051517555)
using target database control file instead of recovery catalog
|
因此我们获得dbid是2051517555。
1
2
3
4
5
|
RMAN> set dbid 2051517555
executing command: SET DBID
RMAN>
|
3.restore spfile,注意我们由于是同机恢复,因此写与不写环境变量都没关系;如果是异机恢复,就必须在rman中写上环境变量。在这个例子中,我们写上环境变量来进行恢复。
另外这里注意需要指明是从那个backupset中恢复。我们需要去查备份的log,确定spfile的备份是在哪个备份集中:
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
|
--开始分配2个通道,ch00和ch01
allocated channel: ch00
channel ch00: sid=28 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
allocated channel: ch01
channel ch01: sid=32 devtype=SBT_TAPE
channel ch01: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
--ch00备份sysaux01.dbf和undotbs01.dbf
Starting backup at 13-JUN-11
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00003 name=/u07/test/oradata/sysaux01.dbf
input datafile fno=00002 name=/u07/test/oradata/undotbs01.dbf
----ch00备份开始备份
channel ch00: starting piece 1 at 13-JUN-11
--ch01备份system01.dbf和tbs_1.dbf
channel ch01: starting incremental level 0 datafile backupset
channel ch01: specifying datafile(s) in backupset
input datafile fno=00001 name=/u07/test/oradata/system01.dbf
input datafile fno=00004 name=/u07/test/oradata/tbs_1.dbf
----ch01备份开始备份
channel ch01: starting piece 1 at 13-JUN-11
--ch00关于sysaux01.dbf和undotbs01.dbf的备份结束。备份集是bk_9_1_753725520,耗时2分56秒。
channel ch00: finished piece 1 at 13-JUN-11
piece handle=bk_9_1_753725520 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:02:56
--ch00开始关于控制文件的备份
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
channel ch00: starting piece 1 at 13-JUN-11
--ch01关于system01.dbf和tbs_1.dbf的备份结束。备份集是bk_10_1_753725520 ,耗时4分01秒。
channel ch01: finished piece 1 at 13-JUN-11
piece handle=bk_10_1_753725520 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch01: backup set complete, elapsed time: 00:04:01
--ch01开始关于spfile的备份,注意这里,这里是我们需要的spfile所在备份集的信息。
channel ch01: starting incremental level 0 datafile backupset
channel ch01: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ch01: starting piece 1 at 13-JUN-11
--ch00关于控制文件备份结束。备份集是bk_11_1_753725696 ,耗时1分41秒。
channel ch00: finished piece 1 at 13-JUN-11
piece handle=bk_11_1_753725696 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:41
--ch00关于spfile备份结束。备份集是bk_12_1_753725761 ,耗时1分21秒。这里是我们spfile备份所处的备份集。
channel ch01: finished piece 1 at 13-JUN-11
piece handle=bk_12_1_753725761 tag=HOT_DB_BK_LEVEL0 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch01: backup set complete, elapsed time: 00:01:21
Finished backup at 13-JUN-11
|
因此,利用上述信息进行spfile的还原:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore spfile from 'bk_12_1_753725761';
release channel ch00;
}3> 4> 5> 6> 7>
allocated channel: ch00
channel ch00: sid=39 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 14-JUN-11
channel ch00: autobackup found: bk_12_1_753725761
channel ch00: SPFILE restore from autobackup complete
Finished restore at 14-JUN-11
released channel: ch00
RMAN>
|
注,关于上述的client和server的信息,可以根据bp.conf 文件来确定:
1
2
3
4
|
sg2as059:/usr/openv/netbackup>cat bp.conf
SERVER = sg2ts001
CLIENT_NAME = sg2as059
CLIENT_READ_TIMEOUT = 1800
|
在此过程中,可以在nbu的控制台看是否已经restore操作。
也可以另开窗口,看到该rman的等待事件是sbtrestore。
另外,也可以看nbu的log,如果没有新log产生,说明备份还停留在rman部分,没传递给NBU。
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
|
Restore started Sat Jun 18 21:51:36 2011
21:51:53 (342183.xxx) Restore job id 342183 will require 1 image.
--可以看到是条码为SG2097的磁带用于恢复。
21:51:53 (342183.xxx) Media id SG2097 is needed for the restore.
21:51:58 (342183.001) Restoring from image created 06/13/11 16:38:23
21:52:03 (342183.001) INF - Data socket = sg2as041.sg2.michelin.com.IPC:/tmp/vnet-51486308405120999841000000000-pYqfUa;447c375effa3496638d871ada708993a;4;300
21:52:03 (342183.001) INF - Name socket = sg2as041.sg2.michelin.com.IPC:/tmp/vnet-62398308405121400308000000000-q5uhUa;68faa96764e5b101e55fcebbe7e82816;4;300
21:52:03 (342183.001) INF - Job id = 342183
21:52:03 (342183.001) INF - Backup id = sg2as059_1307954303
21:52:04 (342183.001) INF - Backup time = 1307954303
--等待mount磁带
21:52:04 (342183.001) INF - Waiting for mount of media id SG2097 on server sg2ts001 for reading.
21:52:04 (342183.001) INF - Policy name = sg2as059_oracle_nbutest_backup
21:52:04 (342183.001) INF - Snapshot = 0
21:52:04 (342183.001) INF - Frozen image = 0
21:52:04 (342183.001) INF - Backup copy = 0
21:52:05 (342183.001) INF - Master server = sg2ts001
21:52:05 (342183.001) INF - Media server = sg2ts001
21:52:05 (342183.001) INF - New data socket = sg2as041.sg2.michelin.com.IPC:/tmp/vnet-18016308405119598273000000000-nUIgaa;17e13638af10f48600d99cc9777b3919;4;300
21:52:05 (342183.001) INF - Encrypt = 0
21:52:05 (342183.001) INF - Use shared memory = 0
21:52:06 (342183.001) INF - Restore id = 342183.001
21:52:06 (342183.001) INF - Encrypt = 0
21:52:06 (342183.001) INF - Client read timeout = 300
21:52:06 (342183.001) INF - Media mount timeout = 600
21:52:06 (342183.001) INF - client = sg2as059
21:52:07 (342183.001) INF - requesting_client = sg2as059
21:52:07 (342183.001) INF - browse_client = sg2as059
--在定位SG2097磁带上的备份集。
21:52:54 (342183.001) INF - Waiting for positioning of media id SG2097 on server sg2ts001 for reading.
--从磁带上还原。
21:53:33 (342183.001) INF - Beginning restore from server sg2ts001 to client sg2as059.
21:53:40 /bk_12_1_753725761
21:53:40 /bk_12_1_753725761
21:53:43 (342183.001) Status of restore from image created 06/13/11 16:38:23 = the requested operation was successfully completed
--注意上面这条log结束后,rman端才会返回本次restore成功或者失败的结果。
21:53:45 INF - Server status = 0
21:53:45 (342183.xxx) INF - Status = the requested operation was successfully completed.
|
还原spfile后,关闭原来的dummy数据库,正常启动数据库。
场景二:丢失控制文件。
丢失控制文件的场景和丢失spfile类似,而且步骤根据简单一些,不需要启动dummy数据库,根据log选择控制文件。
数据库需要启动到nomount状态:
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
|
oracle@sg2as059:/u01/app/oracle/OraHome1/dbs> rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Sat Jun 18 22:23:27 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: test (not mounted)
RMAN>
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore controlfile from 'cntrl_15_1_753725973' ;
release channel ch00;
}3> 4> 5> 6> 7>
using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
channel ch00: restoring control file
channel ch00: restore complete, elapsed time: 00:02:38
output filename=/u01/test/control01.ctl
Finished restore at 18-JUN-11
released channel: ch00
RMAN>
|
还原控制文件之后,resetlogs启动数据库。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
SQL> alter database mount;
Database altered.
SQL>
SQL> recover database using BACKUP CONTROLFILE until cancel;
ORA-00279: change 346227 generated at 06/13/2011 16:17:36 needed for thread 1
ORA-00289: suggestion : /u07/test/arch/1_13_753371123.dbf
ORA-00280: change 346227 for thread 1 is in sequence #13
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u07/test/oradata/redo01.log
Log applied.
Media recovery complete.
SQL>
SQL> alter database open resetlogs;
Database altered.
SQL>
|
场景三:丢失数据文件
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
|
SQL> startup mount;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 2072552 bytes
Variable Size 150994968 bytes
Database Buffers 155189248 bytes
Redo Buffers 6316032 bytes
Database mounted.
SQL>
SQL>
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/u07/test/oradata/tbs_1.dbf'
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
oracle@sg2as059:/u07/test/oradata>
oracle@sg2as059:/u07/test/oradata> rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Sat Jun 18 22:51:43 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=2051517555, not open)
RMAN>
RMAN>
RMAN>
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore datafile 4;
release channel ch00;
}3> 4> 5> 6> 7>
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
channel ch00: starting datafile backupset restore
channel ch00: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /u07/test/oradata/tbs_1.dbf
channel ch00: reading from backup piece bk_10_1_753725520
channel ch00: restored backup piece 1
piece handle=bk_10_1_753725520 tag=HOT_DB_BK_LEVEL0
channel ch00: restore complete, elapsed time: 00:02:15
Finished restore at 18-JUN-11
released channel: ch00
RMAN>
RMAN>
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
recover datafile 4;
release channel ch00;
}3> 4> 5> 6> 7>
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting recover at 18-JUN-11
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 18-JUN-11
released channel: ch00
RMAN> exit
Recovery Manager complete.
oracle@sg2as059:/u07/test/oradata>
oracle@sg2as059:/u07/test/oradata>
oracle@sg2as059:/u07/test/oradata> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Jun 18 22:57:07 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> alter database open;
Database altered.
SQL>
|
场景四:丢失redo log.
由于redolog不在rman备份范围之内,因此在做恢复的过程不需要nbu的参与,只是常规恢复。
如果丢失的redolog不含active或者current的redo,用recover database until cancel+resetlogs打开;
如果丢失的是active或者current的redo,就需要用_allow_resetlogs_corruption的隐含参数+resetlogs打开。
这里不展开叙述。
场景五:丢失全部文件(控制文件数据文件和日志文件)。
注意会自动restore arch,需要留心arch目录的大小。
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
oracle@sg2as059:/u01/app/oracle> export ORACLE_SID=test
oracle@sg2as059:/u01/app/oracle>
oracle@sg2as059:/u01/app/oracle>
oracle@sg2as059:/u01/app/oracle> rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Sat Jun 18 23:48:54 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/OraHome1/dbs/inittest.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 2071296 bytes
Variable Size 67110144 bytes
Database Buffers 83886080 bytes
Redo Buffers 6316032 bytes
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore spfile from 'bk_12_1_753725761';
release channel ch00;
}3> 4> 5> 6> 7>
using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: sid=36 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
channel ch00: autobackup found: bk_12_1_753725761
channel ch00: SPFILE restore from autobackup complete
Finished restore at 18-JUN-11
released channel: ch00
RMAN> exit
Recovery Manager complete.
oracle@sg2as059:/u01/app/oracle> export ORACLE_SID=test
oracle@sg2as059:/u01/app/oracle> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Sat Jun 18 23:52:07 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 2072552 bytes
Variable Size 130023448 bytes
Database Buffers 176160768 bytes
Redo Buffers 6316032 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
oracle@sg2as059:/u01/app/oracle>
oracle@sg2as059:/u01/app/oracle> rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Sat Jun 18 23:52:27 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: test (not mounted)
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore controlfile from 'cntrl_15_1_753725973' ;
release channel ch00;
}3> 4> 5> 6> 7>
using target database control file instead of recovery catalog
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
channel ch00: restoring control file
channel ch00: restore complete, elapsed time: 00:01:08
output filename=/u01/test/control01.ctl
Finished restore at 18-JUN-11
released channel: ch00
RMAN>
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore database;
recover database;
release channel ch00;
}3> 4> 5> 6> 7> 8>
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/18/2011 23:58:07
ORA-01507: database not mounted
RMAN> sql'alter database mount';
sql statement: alter database mount
RMAN> run
2> {
allocate channel ch00 type 'SBT_TAPE';
send 'NB_ORA_SERV=sg2ts001, NB_ORA_CLIENT=sg2as059';
restore database;
recover database;
release channel ch00;
}3> 4> 5> 6> 7> 8>
allocated channel: ch00
channel ch00: sid=46 devtype=SBT_TAPE
channel ch00: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
sent command to channel: ch00
Starting restore at 18-JUN-11
channel ch00: starting datafile backupset restore
channel ch00: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u07/test/oradata/undotbs01.dbf
restoring datafile 00003 to /u07/test/oradata/sysaux01.dbf
channel ch00: reading from backup piece bk_9_1_753725520
channel ch00: restored backup piece 1
piece handle=bk_9_1_753725520 tag=HOT_DB_BK_LEVEL0
channel ch00: restore complete, elapsed time: 00:02:35
channel ch00: starting datafile backupset restore
channel ch00: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u07/test/oradata/system01.dbf
restoring datafile 00004 to /u07/test/oradata/tbs_1.dbf
channel ch00: reading from backup piece bk_10_1_753725520
channel ch00: restored backup piece 1
piece handle=bk_10_1_753725520 tag=HOT_DB_BK_LEVEL0
channel ch00: restore complete, elapsed time: 00:01:05
Finished restore at 19-JUN-11
Starting recover at 19-JUN-11
starting media recovery
channel ch00: starting archive log restore to default destination
channel ch00: restoring archive log
archive log thread=1 sequence=12
channel ch00: reading from backup piece al_14_1_753725861
channel ch00: restored backup piece 1
piece handle=al_14_1_753725861 tag=TAG20110613T161737
channel ch00: restore complete, elapsed time: 00:01:06
channel ch00: starting archive log restore to default destination
channel ch00: restoring archive log
archive log thread=1 sequence=11
channel ch00: reading from backup piece al_13_1_753725861
channel ch00: restored backup piece 1
piece handle=al_13_1_753725861 tag=TAG20110613T161737
channel ch00: restore complete, elapsed time: 00:01:05
archive log filename=/u07/test/arch/1_11_753371123.dbf thread=1 sequence=11
archive log filename=/u07/test/arch/1_12_753371123.dbf thread=1 sequence=12
archive log filename=/u07/test/arch/1_13_753371123.dbf thread=1 sequence=13
media recovery complete, elapsed time: 00:00:05
Finished recover at 19-JUN-11
released channel: ch00
RMAN> exit
Recovery Manager complete.
oracle@sg2as059:/u01/app/oracle> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Sun Jun 19 00:07:11 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL>
SQL> exit
|
【Trouble shooting】
一、恢复时,如果用parms来传递环境变量时会报错sbtinfo2,解决方法是用send,而不是parms:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
RMAN> run
2> {
allocate channel t1 type 'SBT_TAPE'
parms="ENV=(NB_ORA_SERV= sg2ts001)";
restore spfile from 'bk_12_1_753725761';
release channel ch00;
}3> 4> 5> 6> 7>
allocated channel: t1
channel t1: sid=36 devtype=SBT_TAPE
channel t1: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
Starting restore at 16-JUN-11
released channel: t1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/16/2011 17:47:30
ORA-27191: sbtinfo2 returned error
Additional information: 2
RMAN>
|
二、恢复spfile时,如果用from autobackup,会挂死,NBU找磁带会非常慢。该rman的等待事件是sbtinfo2。解决方法是指明from某个备份集文件,这就要到备份的log中去找了。
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
|
RMAN> run
2> {
allocate channel t1 type 'SBT_TAPE';
restore spfile from autobackup;
release channel t1;
}3> 4> 5> 6>
allocated channel: t1
channel t1: sid=36 devtype=SBT_TAPE
channel t1: VERITAS NetBackup for Oracle - Release 6.0 (2006031019)
Starting restore at 14-JUN-11
channel t1: looking for autobackup on day: 20110614
^C
user interrupt received
released channel: t1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/14/2011 17:44:19
ORA-03111: break received on communication channel
RMAN>
|
此时去看等待事件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1* select event,status,program from v$session where program like '%rman%'
SQL> /
EVENT STATUS
---------------------------------------------------------------- --------
PROGRAM
------------------------------------------------
Backup: sbtinfo2 ACTIVE
rman@sg2as059 (TNS V1-V3)
SQL*Net message from client INACTIVE
rman@sg2as059 (TNS V1-V3)
SQL*Net message from client INACTIVE
rman@sg2as059 (TNS V1-V3)
SQL>
SQL>
|