1 Objectifs :
Avoir une
solution de restore plus rapide
qu’une restore via rman/tdpo.
C est
aussi lie au fait qu’on pas de DR.
Solution envisagée backup as copy de
RMAN.
Avantage :
C’est une copie conforme de la base source, la
restore est rapide en fait c est juste
un switch de datafiles et un recover.
Inconvénient :
c’est une seconde bd il faut donc prévoir un espace
disque égale a la production
a tout
moment.
En vue d une
restore il faut des disques de
performance équivalente.
Attention
le
TAG dans les script rman ont de l’importance.
A
chaque nouveau tag c
est un backup full.
2 La bd :
MGTST :
dbID
|
INSTANCE_NAME
|
HOST_NAME
|
VERSION
|
LOG_MODE
|
1864518327
|
MGTST
|
lab-mtlunt96
|
11.2.0.3.0
|
ARCHIVELOG
|
Les
tablespaces :
TABLESPACE
|
TOTAL_MB
|
USED_MB
|
FREE_MB
|
MAX_MB
|
PCT_USED
|
GRAPH
|
SYSAUX
|
520
|
507
|
13
|
32767.98
|
97.5
|
[XXXXXXXXXXXXXXXXXXX-]
|
SYSTEM
|
710
|
701.12
|
8.88
|
32767.98
|
98.75
|
[XXXXXXXXXXXXXXXXXXX-]
|
TEMP (TEMP)
|
28
|
0
|
28
|
32767.98
|
0
|
[--------------------]
|
UNDOTBS1
|
70
|
69.94
|
0.06
|
32767.98
|
99.91
|
[XXXXXXXXXXXXXXXXXXX-]
|
USERS
|
5
|
1.31
|
3.69
|
32767.98
|
26.2
|
[XXXXX---------------]
|
A noter qu on
a une FRA pour y mettre
les backup de controlfile et archivelogs.
Les images
copy ne vont jamais dans la
FRA car elles ne peuvent
etre backupee sur tape
via tdpo contrairement au
backupset.
ASM : 11.2.0.3
Diskgroup : RADIXQADATA
disk_group_name
|
total_mb
|
pct_used
|
Result
|
OCRDG
|
949
|
6.22
|
Disk Group OK
|
RADIXQADATA
|
61364
|
2.2
|
Disk Group OK
|
RADIXQADATA
|
61404
|
2.16
|
Disk Group OK
|
RADIXQADATA
|
61364
|
2.16
|
Disk Group OK
|
3 Pre requis :
Mettre la
bd en mode archivelog (c’est en
place)
Mettre a enable block change
tracking(version enterprise)
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING
FILE '/ora_dump/MG/rman_change_track.f' REUSE;
4 Image copy :
4.1 full level 0 :
4.1.1 Le script
#!/bin/ksh
#set -x
export ORACLE_SID=MGTST
export ORACLE_HOME=/apps/oracle/11203_ENT
export PATH=$ORACLE_HOME/bin:$PATH
rman
target="sys/manager" log=$ORACLE_BASE/LOG/fullcopy.log <<
EOF
RUN {
BACKUP
INCREMENTAL LEVEL 0 as copy DATABASE TAG 'fullcopy';
BACKUP as
copy ARCHIVELOG ALL;
BACKUP as
copy CURRENT CONTROLFILE;
}
EXIT;
EOF
On aurait pu
au lieu de ces
2 lignes faire
BACKUP as copy ARCHIVELOG ALL;
BACKUP as copy CURRENT CONTROLFILE;
BACKUP ARCHIVELOG ALL delete input;
BACKUP CURRENT CONTROLFILE;
4.1.2 La log :
A noter tous
les datafiles sont pris en
backup.
Les copy sont
dans la meme arborescence que les fichier sources.
oracle@lab-mtlunt96@MGTST
(/apps/oracle/LOG)$ cat
fullcopy.log
Recovery Manager: Release 11.2.0.3.0 -
Production on Wed Dec 5 16:18:26 2012
Copyright (c) 1982, 2011, Oracle and/or its
affiliates. All rights reserved.
connected to target database: MGTST
(DBID=1864518327)
RMAN> 2> 3> 4> 5>
Starting backup at 05-DEC-12
using target database control file instead
of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=87 device
type=DISK
channel ORA_DISK_1: starting datafile
copy
input datafile file number=00001
name=+RADIXQADATA/mgtst/datafile/system.283.801243795
output file
name=+RADIXQADATA/mgtst/datafile/system.449.801245913 tag=FULLCOPY RECID=1
STAMP=801245935
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:36
channel ORA_DISK_1: starting datafile
copy
input datafile file number=00002
name=+RADIXQADATA/mgtst/datafile/sysaux.288.801243795
output file
name=+RADIXQADATA/mgtst/datafile/sysaux.448.801245947 tag=FULLCOPY RECID=2
STAMP=801245965
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile
copy
input datafile file number=00003 name=+RADIXQADATA/mgtst/datafile/undotbs1.287.801243795
output file
name=+RADIXQADATA/mgtst/datafile/undotbs1.447.801245973 tag=FULLCOPY RECID=3
STAMP=801245973
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile
copy
copying current control file
output file
name=+RADIXQADATA/mgtst/controlfile/backup.446.801245975 tag=FULLCOPY RECID=4
STAMP=801245977
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile
copy
input datafile file number=00004
name=+RADIXQADATA/mgtst/datafile/users.286.801243797
output file
name=+RADIXQADATA/mgtst/datafile/users.445.801245979 tag=FULLCOPY RECID=5
STAMP=801245979
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental
level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s)
in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at
05-DEC-12
channel ORA_DISK_1: finished piece 1 at
05-DEC-12
piece
handle=+RADIXQADATA/mgtst/backupset/2012_12_05/nnsnn0_fullcopy_0.444.801245979
tag=FULLCOPY comment=NONE
channel ORA_DISK_1: backup set complete,
elapsed time: 00:00:01
Finished backup at 05-DEC-12
Starting backup at 05-DEC-12
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log
copy
input archived log thread=1 sequence=5
RECID=1 STAMP=801245984
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_05/thread_1_seq_5.442.801245985
RECID=2 STAMP=801245984
channel ORA_DISK_1: archived log copy
complete, elapsed time: 00:00:01
Finished backup at 05-DEC-12
Starting backup at 05-DEC-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile
copy
copying current control file
output file
name=+RADIXQADATA/mgtst/controlfile/backup.441.801245987 tag=TAG20121205T161946
RECID=6 STAMP=801245986
channel ORA_DISK_1: datafile copy complete,
elapsed time: 00:00:01
Finished backup at 05-DEC-12
RMAN>
Recovery Manager complete.
4.2 création d’un user et d’une table puis level 1
create
user mg identified
by mgmg;
create table
mg (id number);
Level 1
4.2.1 Rman script :
#!/bin/ksh
set -x
export ORACLE_SID=MGTST
export ORACLE_HOME=/apps/oracle/11203_ENT
export PATH=$ORACLE_HOME/bin:$PATH
mda=`date
+%Y%m%d%H%M%S`
rman
target="sys/manager" log=$ORACLE_BASE/LOG/${mda}_icopy.log <<
EOF
RUN {
BACKUP
INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'Inccopy'
database;
BACKUP ARCHIVELOG ALL delete input;
BACKUP CURRENT CONTROLFILE;
}
EXIT;
EOF
4.2.2 La log :
Starting backup at 07-DEC-12
using
target database control file instead of recovery catalog
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=82 device type=DISK
no parent
backup or copy of datafile 1 found
no parent
backup or copy of datafile 2 found
no parent
backup or copy of datafile 5 found
no parent
backup or copy of datafile 3 found
no parent
backup or copy of datafile 4 found
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00001
name=+RADIXQADATA/mgtst/datafile/system.283.801243795
output file
name=+RADIXQADATA/mgtst/datafile/system.361.801398587 tag=INCCOPY RECID=13
STAMP=801398599
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00002
name=+RADIXQADATA/mgtst/datafile/sysaux.288.801243795
output file
name=+RADIXQADATA/mgtst/datafile/sysaux.360.801398601 tag=INCCOPY RECID=14
STAMP=801398613
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00005
name=+RADIXQADATA/mgtst/datafile/mg.391.801397905
output file
name=+RADIXQADATA/mgtst/datafile/mg.359.801398617 tag=INCCOPY RECID=15
STAMP=801398618
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00003 name=+RADIXQADATA/mgtst/datafile/undotbs1.287.801243795
output file
name=+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621 tag=INCCOPY RECID=16
STAMP=801398621
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel
ORA_DISK_1: starting incremental level 1 datafile backup set
channel
ORA_DISK_1: specifying datafile(s) in backup set
including
current control file in backup set
including
current SPFILE in backup set
channel
ORA_DISK_1: starting piece 1 at 07-DEC-12
channel
ORA_DISK_1: finished piece 1 at 07-DEC-12
piece
handle=+RADIXQADATA/mgtst/backupset/2012_12_07/ncsnn1_inccopy_0.356.801398625
tag=INCCOPY comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting datafile copy
input
datafile file number=00004
name=+RADIXQADATA/mgtst/datafile/users.286.801243797
output file
name=+RADIXQADATA/mgtst/datafile/users.282.801398625 tag=INCCOPY RECID=17
STAMP=801398625
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished
backup at 07-DEC-12
Starting
backup at 07-DEC-12
current log
archived
using
channel ORA_DISK_1
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=5 RECID=62 STAMP=801398258
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_5.280.801398629
RECID=76 STAMP=801398629
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=6 RECID=63 STAMP=801398259
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_6.279.801398631
RECID=77 STAMP=801398630
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=7 RECID=64 STAMP=801398260
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_7.256.801398633
RECID=78 STAMP=801398632
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=8 RECID=65 STAMP=801398261
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_8.277.801398633
RECID=79 STAMP=801398633
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=9 RECID=66 STAMP=801398262
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_9.276.801398635
RECID=80 STAMP=801398634
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=10 RECID=67 STAMP=801398265
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_10.275.801398635
RECID=81 STAMP=801398636
channel ORA_DISK_1: archived log copy
complete, elapsed time: 00:00:01
channel ORA_DISK_1:
starting archived log copy
input
archived log thread=1 sequence=11 RECID=68 STAMP=801398266
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_11.274.801398637
RECID=82 STAMP=801398637
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=12 RECID=69 STAMP=801398267
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_12.273.801398637
RECID=83 STAMP=801398638
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=13 RECID=70 STAMP=801398268
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_13.272.801398639
RECID=84 STAMP=801398639
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=14 RECID=71 STAMP=801398268
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_14.271.801398641
RECID=85 STAMP=801398640
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=15 RECID=72 STAMP=801398269
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_15.270.801398641
RECID=86 STAMP=801398641
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=16 RECID=73 STAMP=801398271
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_16.278.801398643
RECID=87 STAMP=801398642
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=17 RECID=74 STAMP=801398272
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_17.263.801398643
RECID=88 STAMP=801398643
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel
ORA_DISK_1: starting archived log copy
input
archived log thread=1 sequence=18 RECID=75 STAMP=801398627
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_18.258.801398645
RECID=89 STAMP=801398644
channel
ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished
backup at 07-DEC-12
Starting
backup at 07-DEC-12
using
channel ORA_DISK_1
channel
ORA_DISK_1: starting datafile copy
copying
current control file
output file
name=+RADIXQADATA/mgtst/controlfile/backup.268.801398647 tag=TAG20121207T104406
RECID=18 STAMP=801398647
channel
ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 07-DEC-12
En fait j
aurai du
conserver le TAG fullcopy
comme pour le premier script
RMAN .
4.3 creation d’un tablespace et move de la table puis level 1
Create tablespace
MG;
Alter table
MG move tablespace MG;
4.4 Restore par switch d’un datafile /bd
En fait on
part du principe qu on a le
controlfile. Sinon il faut prévoir
aussi une restore
du controlfile.
RMAN> startup
mount
Oracle instance started
database mounted
Total System Global Area 5227814912 bytes
Fixed Size 2237488 bytes
Variable Size 2768243664 bytes
Database Buffers 2449473536 bytes
Redo Buffers 7860224 bytes
RMAN> switch database to copy;
using target database control file instead of
recovery catalog
datafile 1 switched to datafile copy
"+RADIXQADATA/mgtst/datafile/system.361.801398587"
datafile 2 switched to datafile copy
"+RADIXQADATA/mgtst/datafile/sysaux.360.801398601"
datafile 3 switched to datafile copy
"+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621"
datafile 4 switched to datafile copy
"+RADIXQADATA/mgtst/datafile/users.282.801398625"
datafile 5 switched to datafile copy
"+RADIXQADATA/mgtst/datafile/mg.359.801398617"
RMAN> recover
database;
Starting recover at 07-12-2012:15:25:39
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK
channel ORA_DISK_1: starting incremental datafile
backup set restore
channel ORA_DISK_1: specifying datafile(s) to
restore from backup set
destination for restore of datafile 00001:
+RADIXQADATA/mgtst/datafile/system.361.801398587
destination for restore of datafile 00002:
+RADIXQADATA/mgtst/datafile/sysaux.360.801398601
destination for restore of datafile 00003:
+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621
destination for restore of datafile 00004:
+RADIXQADATA/mgtst/datafile/users.282.801398625
destination for restore of datafile 00005:
+RADIXQADATA/mgtst/datafile/mg.359.801398617
channel ORA_DISK_1: reading from backup piece
+RADIXQADATA/mgtst/backupset/2012_12_07/nnndn1_inccopy_0.266.801400725
channel ORA_DISK_1: piece
handle=+RADIXQADATA/mgtst/backupset/2012_12_07/nnndn1_inccopy_0.266.801400725
tag=INCCOPY
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time:
00:00:01
channel ORA_DISK_1: starting incremental datafile
backup set restore
channel ORA_DISK_1: specifying datafile(s) to
restore from backup set
destination for restore of datafile 00001:
+RADIXQADATA/mgtst/datafile/system.361.801398587
destination for restore of datafile 00002:
+RADIXQADATA/mgtst/datafile/sysaux.360.801398601
destination for restore of datafile 00003:
+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621
destination for restore of datafile 00004:
+RADIXQADATA/mgtst/datafile/users.282.801398625
destination for restore of datafile 00005:
+RADIXQADATA/mgtst/datafile/mg.359.801398617
channel ORA_DISK_1: reading from backup piece
+RADIXQADATA/mgtst/backupset/2012_12_07/nnndn1_inccopy_0.258.801400929
channel ORA_DISK_1: piece
handle=+RADIXQADATA/mgtst/backupset/2012_12_07/nnndn1_inccopy_0.258.801400929
tag=INCCOPY
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time:
00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 07-12-2012:15:25:45
RMAN> alter
database open;
database opened
RMAN>
Les datafiles
Avant le
switch :
FILE_NAME
--------------------------------------------------
+RADIXQADATA/mgtst/datafile/sysaux.288.801243795
+RADIXQADATA/mgtst/datafile/system.283.801243795
+RADIXQADATA/mgtst/datafile/undotbs1.287.801243795
+RADIXQADATA/mgtst/datafile/users.286.801243797
+RADIXQADATA/mgtst/datafile/mg.391.801397905
Post switch
NAME
STATUS
-------------------------------------------------------
-------
+RADIXQADATA/mgtst/datafile/system.361.801398587 SYSTEM
+RADIXQADATA/mgtst/datafile/sysaux.360.801398601 ONLINE
+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621 ONLINE
+RADIXQADATA/mgtst/datafile/users.282.801398625 ONLINE
+RADIXQADATA/mgtst/datafile/mg.359.801398617 ONLINE
On retrouve
nos 2 lignes:
SQL> select
* from MG;
ID
----------
1
2
4.5 level 0 :
Tous les
datafiles sont pris de nouveau :
oracle@lab-mtlunt96@MGTST (/ora_dump)$ cat /apps/oracle/LOG/fullcopy.log
Recovery Manager: Release 11.2.0.3.0 - Production on
Fri Dec 7 15:32:58 2012
Copyright (c) 1982, 2011, Oracle and/or its
affiliates. All rights reserved.
connected to target database: MGTST
(DBID=1864518327)
RMAN> 2> 3> 4> 5>
Starting backup at 07-12-2012:15:32:59
using target database control file instead of
recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=72 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001
name=+RADIXQADATA/mgtst/datafile/system.361.801398587
output file
name=+RADIXQADATA/mgtst/datafile/system.364.801415981 tag=FULLCOPY RECID=34
STAMP=801415992
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+RADIXQADATA/mgtst/datafile/sysaux.360.801398601
output file
name=+RADIXQADATA/mgtst/datafile/sysaux.365.801415997 tag=FULLCOPY RECID=35
STAMP=801416008
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005
name=+RADIXQADATA/mgtst/datafile/mg.359.801398617
output file
name=+RADIXQADATA/mgtst/datafile/mg.366.801416011 tag=FULLCOPY RECID=36
STAMP=801416013
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003
name=+RADIXQADATA/mgtst/datafile/undotbs1.358.801398621
output file
name=+RADIXQADATA/mgtst/datafile/undotbs1.367.801416015 tag=FULLCOPY RECID=37
STAMP=801416015
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output file
name=+RADIXQADATA/mgtst/controlfile/backup.368.801416017 tag=FULLCOPY RECID=38
STAMP=801416019
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004
name=+RADIXQADATA/mgtst/datafile/users.282.801398625
output file
name=+RADIXQADATA/mgtst/datafile/users.369.801416021 tag=FULLCOPY RECID=39 STAMP=801416021
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:01
channel ORA_DISK_1: starting incremental level 0
datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup
set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at
07-12-2012:15:33:42
channel ORA_DISK_1: finished piece 1 at
07-12-2012:15:33:43
piece
handle=+RADIXQADATA/mgtst/backupset/2012_12_07/nnsnn0_fullcopy_0.370.801416023
tag=FULLCOPY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed
time: 00:00:01
Finished backup at 07-12-2012:15:33:43
Starting backup at 07-12-2012:15:33:44
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=5 RECID=49
STAMP=801398034
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_5.372.801416027
RECID=97 STAMP=801416026
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=6 RECID=50
STAMP=801398034
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_6.373.801416027
RECID=98 STAMP=801416027
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=7 RECID=51
STAMP=801398035
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_7.374.801416029
RECID=99 STAMP=801416029
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=8 RECID=52
STAMP=801398036
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_8.375.801416031
RECID=100 STAMP=801416030
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=9 RECID=53
STAMP=801398038
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_9.271.801416031
RECID=101 STAMP=801416031
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=10 RECID=54
STAMP=801398040
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_10.272.801416033
RECID=102 STAMP=801416032
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=11 RECID=55
STAMP=801398040
output file name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_11.273.801416033
RECID=103 STAMP=801416034
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=12 RECID=56
STAMP=801398042
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_12.274.801416035
RECID=104 STAMP=801416035
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=13 RECID=57
STAMP=801398043
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_13.275.801416035
RECID=105 STAMP=801416036
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=14 RECID=58
STAMP=801398043
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_14.276.801416037
RECID=106 STAMP=801416037
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=15 RECID=59
STAMP=801398044
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_15.277.801416039
RECID=107 STAMP=801416038
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=16 RECID=60
STAMP=801398046
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_16.256.801416039
RECID=108 STAMP=801416039
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=17 RECID=61
STAMP=801398254
output file name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_17.279.801416041
RECID=109 STAMP=801416040
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=18 RECID=93
STAMP=801408191
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_18.280.801416041
RECID=110 STAMP=801416041
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=19 RECID=92
STAMP=801408188
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_19.260.801416043
RECID=111 STAMP=801416042
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=20 RECID=94
STAMP=801408191
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_20.264.801416043
RECID=112 STAMP=801416043
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=21 RECID=95
STAMP=801415361
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_21.259.801416045
RECID=113 STAMP=801416045
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=22 RECID=96
STAMP=801416024
output file
name=+RADIXQADATA/mgtst/archivelog/2012_12_07/thread_1_seq_22.267.801416047
RECID=114 STAMP=801416046
channel ORA_DISK_1: archived log copy complete,
elapsed time: 00:00:01
Finished backup at 07-12-2012:15:34:07
Starting backup at 07-12-2012:15:34:07
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file
name=+RADIXQADATA/mgtst/controlfile/backup.265.801416047 tag=TAG20121207T153407
RECID=40 STAMP=801416048
channel ORA_DISK_1: datafile copy complete, elapsed
time: 00:00:01
Finished backup at 07-12-2012:15:34:08
RMAN>
Recovery Manager complete.
Ajout de lignes dans
la table ci-dessus + image copy
level 1
insert into
mg values (3);
insert into
mg values (4);
commit;
Level 1 toujours le même script.
5 Utilisation du backup de l’image copy pour un clone
La bd qu’on va créer se nommera DUPLI
et sera dans le directory
/ora_dump.
Le pfile :
DUPLI.__db_cache_size=2449473536
DUPLI.__java_pool_size=16777216
DUPLI.__large_pool_size=16777216
DUPLI.__pga_aggregate_target=2113929216
DUPLI.__sga_target=3137339392
DUPLI.__shared_io_pool_size=0
DUPLI.__shared_pool_size=620756992
DUPLI.__streams_pool_size=0
*.audit_file_dest='/apps/oracle/admin/DUPLI/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/ora_dump/ctldupli.ora'
*.db_block_size=8192
*.db_domain=''
#*.db_name='MGTST'
*.db_name='DUPLI'
db_unique_name=DUPLI
*.diagnostic_dest='/apps/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DUPLIXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=5242880000
*.open_cursors=300
*.processes=60
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=71
*.undo_tablespace='UNDOTBS1'
Pour
restorer le controlfile
on joue avec le paramètre db_name.
Il faut sortir
les datafile copy et le backuset du controlfile
de l ASM
vers le FS (dans ASM commande copy)
Restore des archivelogs de la base source dans une
autre arborescence :
db_name :
Au depart
le db_name=MGTST.
Restore du
controlfile :
SQL>startup nomount
pfile=/ora_dump/pfile.ora
RMAN> restore controlfile
from '/ora_dump/ncnnf0_tag20121207t112228_0.278.801400949';
SQL>alter database mount;
SQL>
alter database backup
controlfile to trace
as '/ora_dump/ctrlfiletrc.txt';
En parallèle
on doit aussi restaurer les archivelogs
de la base source ou copier
le backupset et
le cataloguer.
Dans notre
cas j ai restaurer les
archives log dans une autre arborescence :
donc sur
la base source MGTST
RUN{
SET
ARCHIVELOG DESTINATION TO '/ora_dump/arch';
RESTORE ARCHIVELOG ALL;
}
En partant
du controlfile qui
est celui de la base source on
va le modifier pour
passer a celui-ci:
STARTUP NOMOUNT
CREATE
CONTROLFILE REUSE set DATABASE
"DUPLI" RESETLOGS
ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/ora_dump/group_1.357.801243963'
) SIZE
50M BLOCKSIZE 512,
GROUP 2
(
'/ora_dump/group_2.456.801243969'
) SIZE
50M BLOCKSIZE 512,
GROUP 3
(
'/ora_dump/group_3.454.801243971'
) SIZE
50M BLOCKSIZE 512
-- STANDBY
LOGFILE
DATAFILE
'/ora_dump/mg.359.801398617'
,'/ora_dump/sysaux.360.801398601'
,'/ora_dump/system.361.801398587'
,'/ora_dump/undotbs1.358.801398621'
,'/ora_dump/users.282.801398625'
CHARACTER
SET AL32UTF8
;
On doit remettre le
db_name a la valeur de DUPLI.
SQL>
startup nomount pfile =pfile.ora
ORACLE
instance started.
Total
System Global Area 5227814912 bytes
Fixed
Size 2237488 bytes
Variable
Size 2768243664 bytes
Database
Buffers 2449473536 bytes
Redo
Buffers 7860224 bytes
SQL>
@ctrlfiletrc.txt
Control
file created.
SQL>
alter database mount;
SQL>
recover database using
backup controlfile until
cancel;
On
applique les archivelog puis
CANCEL et open resetlogs.
Il faut soit recréer le
temp soit le renommer.
A noter que le
dbid de DUPLI est
egal a celui de MGTST a changer
si les 2 bd sont
dans un catalog Rman
commun.
1 – creer
le password file :
oracle@lab-mtlunt96@DUPLI
(/apps/oracle/11203_ENT/dbs)$ orapwd
file='/apps/oracle/11203_ENT/dbs/orapwDUPLI' password=dupli
passer la
bd en
mode mount
nid target=sys/dupli@lab-mtlunt96:1521/DUPLI DBNAME=DUPLI
6 Annexe
Astuces pour
garder le même
nom de datafile :
When
creating image copies, you can also name the output copies with the DB_FILE_NAME_CONVERT parameter
of the BACKUP command. This parameter works identically to the DB_FILE_NAME_CONVERT initialization parameter. Pairs
of file name prefixes are provided to change the names of the output files. If
a file is not converted by any of the pairs, then RMAN uses the FORMAT specification: if no FORMAT is specified, then RMAN uses the default format %U.
Example 8-1 copies the datafiles whose file
name is prefixed with /maindisk/oradata/users so
that they are prefixed with /backups/users_ts.
BACKUP AS COPY
DB_FILE_NAME_CONVERT
('/maindisk/oradata/users',
'/backups/users_ts') TABLESPACE users;