1.先查看现在的datafile
RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name FDB
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1810SYSTEM
*** D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF
2600SYSAUX
*** D:\ORACLE\ORADATA\FDB\SYSAUX01.DBF
3500NEW_UNDO_01
*** D:\ORACLE\ORADATA\FDB\NEW_UNDO_01.DBF
45USERS
*** D:\ORACLE\ORADATA\FDB\USERS01.DBF
5100TPFDA
*** D:\ORACLE\ORADATA\FDB\TPFDA.DBF
6100NEW_UNDO
*** D:\ORACLE\ORADATA\FDB\NEW_UNDO.DBF
7100TBS
*** D:\ORACLE\ORADATA\FDB\TBS_01.DBF
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
10TEMP02
0 D:\ORACLE\ORADATA\FDB\TEMP02.DBF
21024 TEMP03
1024D:\ORACLE\ORADATA\FDB\TEMP03.DBF
2.进行DB备份
RMAN> backup as compressed backupset database;
Starting backup at 24-OCT-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF
input datafile file number=00002 name=D:\ORACLE\ORADATA\FDB\SYSAUX01.DBF
input datafile file number=00003 name=D:\ORACLE\ORADATA\FDB\NEW_UNDO_01.DBF
input datafile file number=00005 name=D:\ORACLE\ORADATA\FDB\TPFDA.DBF
input datafile file number=00006 name=D:\ORACLE\ORADATA\FDB\NEW_UNDO.DBF
input datafile file number=00007 name=D:\ORACLE\ORADATA\FDB\TBS_01.DBF
input datafile file number=00004 name=D:\ORACLE\ORADATA\FDB\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 24-OCT-14
channel ORA_DISK_1: finished piece 1 at 24-OCT-14
piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NNNDF_TAG20141024T145532_B4MXZ52X_.BKP tag=TAG20141024T145532
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting compressed full 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 24-OCT-14
channel ORA_DISK_1: finished piece 1 at 24-OCT-14
piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NCSNF_TAG20141024T145532_B4MY0X8T_.BKP tag=TAG20141024T145532
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-OCT-14
3.进行controfile的备份
RMAN> backup current controlfile ;
Starting backup at 24-OCT-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 24-OCT-14
channel ORA_DISK_1: finished piece 1 at 24-OCT-14
piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NCNNF_TAG20141024T145709_B4MY2711_.BKP tag=TAG20141024T145709
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-OCT-14
RMAN> exit
4.建立新的tablespace
SYS@FDB> create tablespace inc_tbs datafile 'd:\oracle\oradata\fdb\inc_tbs.dbf' size 100m;
Tablespace created.
SYS@FDB> exit
5.重新备份DB
RMAN> backup as compressed backupset database;
Starting backup at 24-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=125 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF
input datafile file number=00002 name=D:\ORACLE\ORADATA\FDB\SYSAUX01.DBF
input datafile file number=00003 name=D:\ORACLE\ORADATA\FDB\NEW_UNDO_01.DBF
input datafile file number=00005 name=D:\ORACLE\ORADATA\FDB\TPFDA.DBF
input datafile file number=00006 name=D:\ORACLE\ORADATA\FDB\NEW_UNDO.DBF
input datafile file number=00007 name=D:\ORACLE\ORADATA\FDB\TBS_01.DBF
input datafile file number=00008 name=D:\ORACLE\ORADATA\FDB\INC_TBS.DBF
input datafile file number=00004 name=D:\ORACLE\ORADATA\FDB\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 24-OCT-14
channel ORA_DISK_1: finished piece 1 at 24-OCT-14
piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NNNDF_TAG20141024T150029_B4MY8GP4_.BKP tag=TAG20141024T150029
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting compressed full 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 24-OCT-14
channel ORA_DISK_1: finished piece 1 at 24-OCT-14
piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NCSNF_TAG20141024T150029_B4MY9WBY_.BKP tag=TAG20141024T150029
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-OCT-14
RMAN> exit
6.停止db
SYS@FDB> shutdown abort;
ORACLE instance shut down.
SYS@FDB> exit
7.进行还原,并指定tag/controlfile
RMAN> startup nomount;
Oracle instance started
RMAN> restore controlfile from 'D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NCNNF_TAG20141024T145709_B4MY2711_.BKP';
Starting restore at 24-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=D:\ORACLE\ORADATA\FDB\CONTROL01.CTL
output file name=D:\ORACLE\ORADATA\FDB\CONTROL02.CTL
Finished restore at 24-OCT-14
RMAN> restore database from tag='TAG20141024T145532';
Starting restore at 24-OCT-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF
channel ORA_DISK_1: restoring datafile 00002 to D:\ORACLE\ORADATA\FDB\SYSAUX01.DBF
channel ORA_DISK_1: restoring datafile 00003 to D:\ORACLE\ORADATA\FDB\NEW_UNDO_01.DBF
channel ORA_DISK_1: restoring datafile 00004 to D:\ORACLE\ORADATA\FDB\USERS01.DBF
channel ORA_DISK_1: restoring datafile 00005 to D:\ORACLE\ORADATA\FDB\TPFDA.DBF
channel ORA_DISK_1: restoring datafile 00006 to D:\ORACLE\ORADATA\FDB\NEW_UNDO.DBF
channel ORA_DISK_1: restoring datafile 00007 to D:\ORACLE\ORADATA\FDB\TBS_01.DBF
channel ORA_DISK_1: reading from backup piece D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NNNDF_TAG20141024T145532_B4MX
Z52X_.BKP
channel ORA_DISK_1: piece handle=D:\ORACLE\FRA\FDB\BACKUPSET\2014_10_24\O1_MF_NNNDF_TAG20141024T145532_B4MXZ52X_.BKP tag
=TAG20141024T145532
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
Finished restore at 24-OCT-14
RMAN> recover database noredo;
Starting recover at 24-OCT-14
using channel ORA_DISK_1
Finished recover at 24-OCT-14
RMAN> exit
8.把db开起来,并且确认没有测试时增加inc_tab datafile
SYS@FDB> select error from v$recover_file;
no rows selected
SYS@FDB> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: 'D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF'
SYS@FDB> recover database using backup controlfile until cancel;
ORA-00279: change 1718328 generated at 10/24/2014 14:55:33 needed for thread 1
ORA-00289: suggestion :
D:\ORACLE\ORADATA\FDB\ARCH\ARC0000000030_0861557326.0001
ORA-00280: change 1718328 for thread 1 is in sequence #30
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SYS@FDB> alter database open resetlogs;
Database altered.
SYS@FDB> select status from v$instance;
STATUS
------------
OPEN
SYS@FDB> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
D:\ORACLE\ORADATA\FDB\SYSTEM01.DBF
D:\ORACLE\ORADATA\FDB\SYSAUX01.DBF
D:\ORACLE\ORADATA\FDB\NEW_UNDO_01.DBF
D:\ORACLE\ORADATA\FDB\USERS01.DBF
D:\ORACLE\ORADATA\FDB\TPFDA.DBF
D:\ORACLE\ORADATA\FDB\NEW_UNDO.DBF
D:\ORACLE\ORADATA\FDB\TBS_01.DBF
7 rows selected.
你看一下自已做的地方跟我差在那里? |