Sei sulla pagina 1di 13

Microsoft Windows [Version 5.2.

3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>cd \

C:\>set ORACLE_SID=reco1

C:\>sqlplus sys/sys as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 11 10:18:51 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> create tablespace "RMAN"


2 datafile 'D:\oracle\product\10.2.0\oradata\reco1\reco01.dbf' size 50m reuse
3 autoextend on next 2m maxsize 60m
4 extent management local
5 segment space management auto;

Tablespace created.

SQL> create user dev identified by dev


2 temporary tablespace temp
3 default tablespace rman
4 quota unlimited on rman;

User created.

SQL> grant resource,connect,recovery_catalog_owner to dev;

Grant succeeded.

SQL> exit;
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
C:\>rman catalog=dev/dev@reco1

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 11 10:37:28 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to recovery catalog database

RMAN> create catalog tablespace "RMAN";

recovery catalog created

RMAN> exit

Recovery Manager complete.

C:\>rman catalog=dev/dev@reco1 target=sys/sys@orcl

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 11 10:39:45 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ORCL (DBID=1197181969)


connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog


starting full resync of recovery catalog
full resync complete

RMAN> show all;

RMAN configuration parameters are:


CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFORCL.ORA'; # default

RMAN> backup tag'full_db_bkup' database plus archivelog;

Starting backup at 11-NOV-08


current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=22 stamp=670467596
input archive log thread=1 sequence=2 recid=23 stamp=670502939
channel ORA_DISK_1: starting piece 1 at 11-NOV-08
channel ORA_DISK_1: finished piece 1 at 11-NOV-08
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPS
ET\2008_11
_11\O1_MF_ANNNN_FULL_DB_BKUP_4KL5GB6C_.BKP tag=FULL_DB_BKUP
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:17
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=15 recid=20 stamp=670441241
input archive log thread=1 sequence=16 recid=21 stamp=670441242
input archive log thread=1 sequence=17 recid=19 stamp=670441240
channel ORA_DISK_1: starting piece 1 at 11-NOV-08
channel ORA_DISK_1: finished piece 1 at 11-NOV-08
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPS
ET\2008_11
_11\O1_MF_ANNNN_FULL_DB_BKUP_4KL5GTQX_.BKP tag=FULL_DB_BKUP
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 11-NOV-08

Starting backup at 11-NOV-08


using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
input datafile fno=00003
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
input datafile fno=00005
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA01.DBF
input datafile fno=00002
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
input datafile fno=00006
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA02.DBF
input datafile fno=00004
name=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 11-NOV-08
channel ORA_DISK_1: finished piece 1 at 11-NOV-08
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPS
ET\2008_11_11\O_MF_NNNDF_FULL_DB_BKUP_4KL5H2JM_.BKP
tag=FULL_DB_BKUP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:16
Finished backup at 11-NOV-08

Starting backup at 11-NOV-08


current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=3 recid=24 stamp=670503108
channel ORA_DISK_1: starting piece 1 at 11-NOV-08
channel ORA_DISK_1: finished piece 1 at 11-NOV-08
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPS
ET\2008_11
_11\O1_MF_ANNNN_FULL_DB_BKUP_4KL5MK1Y_.BKP tag=FULL_DB_BKUP
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 11-NOV-08

Starting Control File Autobackup at 11-NOV-08


piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBAC
KUP\2008_11_11\O1_MF_N_670503116_4KL5MPLK_.BKP comment=NONE
Finished Control File Autobackup at 11-NOV-08

RMAN> list backup;

List of Backup Sets


===================

BS Key Size Device Type Elapsed Time Completion Time


------- ---------- ----------- ------------ ---------------
111 73.89M DISK 00:00:14 11-NOV-08
BP Key: 114 Status: AVAILABLE Compressed: NO Tag: FULL_DB_BKUP
Piece Name:
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\
2008_11_11\O1_MF_ANNNN_FULL_DB_BKUP_4KL5GB6C_.BKP

List of Archived Logs in backup set 111


Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 1 795754 10-NOV-08 824178 11-NOV-08
1 2 824178 11-NOV-08 851693 11-NOV-08

BS Key Type LV Size Device Type Elapsed Time Completion Time


------- ---- -- ---------- ----------- ------------ ---------------
113 Full 544.89M DISK 00:02:08 11-NOV-08
BP Key: 116 Status: AVAILABLE Compressed: NO Tag: FULL_DB_BKUP
Piece Name:
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\
2008_11_11\O1_MF_NNNDF_FULL_DB_BKUP_4KL5H2JM_.BKP
List of Datafiles in backup set 113
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
2 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
3 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
4 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
5 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA01.DBF
6 Full 851714 11-NOV-08
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA02.DBF

BS Key Size Device Type Elapsed Time Completion Time


------- ---------- ----------- ------------ ---------------
137 111.00K DISK 00:00:01 11-NOV-08
BP Key: 144 Status: AVAILABLE Compressed: NO Tag: FULL_DB_BKUP
Piece Name:
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\
2008_11_11\O1_MF_ANNNN_FULL_DB_BKUP_4KL5MK1Y_.BKP
List of Archived Logs in backup set 137
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 3 851693 11-NOV-08 851830 11-NOV-08

BS Key Type LV Size Device Type Elapsed Time Completion Time


------- ---- -- ---------- ----------- ------------ ---------------
155 Full 6.77M DISK 00:00:04 11-NOV-08
BP Key: 157 Status: AVAILABLE Compressed: NO Tag: TAG20081111T105156

Piece Name:
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP
\2008_11_11\O1_MF_N_670503116_4KL5MPLK_.BKP
Control File Included: Ckp SCN: 851851 Ckp time: 11-NOV-08

RMAN> exit

Recovery Manager complete.

C:\>set ORACLE_SID=orcl

C:\>sqlplus sys/sys as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 11 10:57:06 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------

TABLESPACE_NAME
------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
USERS
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
SYSAUX

D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
UNDOTBS1

FILE_NAME
--------------------------------------------------------------------------------

TABLESPACE_NAME
------------------------------
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
SYSTEM

D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA01.DBF
USER_DATA

D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA02.DBF
USER_DATA

SQL> create user trial identified by trial


2 default tablespace users;

User created.

SQL> grant resource,connect to trial;

Grant succeeded.

SQL> conn trial/trial


Connected.
SQL> create table try01(a number) tablespace users;

Table created.

SQL> insert into try01 values(9);

1 row created.

SQL> /

1 row created.

SQL> /
1 row created.

SQL> /

1 row created.

SQL> conn sys/sys as sysdba;


Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Deleted the datafile users01.dbf from OS level.

Error received:-

C:\>set ORACLE_SID=orcl

C:\>sqlplus sys/sys as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 11 11:14:16 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 281018368 bytes


Fixed Size 1248552 bytes
Variable Size 100664024 bytes
Database Buffers 176160768 bytes
Redo Buffers 2945024 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4:
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF'

SQL> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> exit;
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options

C:\>rman catalog=dev/dev@reco1

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 11 11:16:26 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to recovery catalog database

RMAN> connect target

connected to target database (not started)

RMAN> startup mount

Oracle instance started


database mounted

Total System Global Area 281018368 bytes

Fixed Size 1248552 bytes


Variable Size 100664024 bytes
Database Buffers 176160768 bytes
Redo Buffers 2945024 bytes

RMAN> restore database;

Starting restore at 11-NOV-08


allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore


channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
restoring datafile 00002 to
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
restoring datafile 00003 to
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
restoring datafile 00004 to
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
restoring datafile 00005 to
D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA01.DBF

restoring datafile 00006 to


D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERDATA02.DBF

channel ORA_DISK_1: reading from backup piece


D:\ORACLE\PRODUCT\10.2.0\FLASH_REC
OVERY_AREA\ORCL\BACKUPSET\2008_11_11\O1_MF_NNNDF_FULL_DB_BKUP_4
KL5H2JM_.BKP
channel ORA_DISK_1: restored backup piece 1
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPS
ET\2008_11
_11\O1_MF_NNNDF_FULL_DB_BKUP_4KL5H2JM_.BKP tag=FULL_DB_BKUP
channel ORA_DISK_1: restore complete, elapsed time: 00:01:55
Finished restore at 11-NOV-08

RMAN> recover database;

Starting recover at 11-NOV-08


using channel ORA_DISK_1

starting media recovery


media recovery complete, elapsed time: 00:00:07

Finished recover at 11-NOV-08

RMAN> alter database open;

database opened

RMAN> exit;

Recovery Manager complete.

C:\>set oracle_sid=orcl

C:\>sqlplus sys/sys as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 11 11:26:09 2008


Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> conn trial/trial


Connected.
SQL> desc try01;
Name Null? Type
----------------------------------------- -------- ----------------------------

A NUMBER

SQL> select * from try01;

A
----------
9
9
9
9

Table is recovered.

Scenario 2:-

Controlfile lost.

C:\>rman catalog=dev/dev@reco1

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 11 11:35:53 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to recovery catalog database

RMAN> connect target

connected to target database (not started)

RMAN> startup nomount

Oracle instance started


Total System Global Area 281018368 bytes

Fixed Size 1248552 bytes


Variable Size 100664024 bytes
Database Buffers 176160768 bytes
Redo Buffers 2945024 bytes

RMAN> restore controlfile;

Starting restore at 11-NOV-08


allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: reading from backup piece
D:\ORACLE\PRODUCT\10.2.0\FLASH_REC
OVERY_AREA\ORCL\AUTOBACKUP\2008_11_11\O1_MF_N_670503116_4KL5MPLK_
.BKP
channel ORA_DISK_1: restored backup piece 1
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBAC
KUP\2008_1
1_11\O1_MF_N_670503116_4KL5MPLK_.BKP tag=TAG20081111T105156
channel ORA_DISK_1: restore complete, elapsed time: 00:00:27
output filename=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL
output filename=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL
output filename=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL
Finished restore at 11-NOV-08

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> recover database;

Starting recover at 11-NOV-08


Starting implicit crosscheck backup at 11-NOV-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 11-NOV-08

Starting implicit crosscheck copy at 11-NOV-08


using channel ORA_DISK_1
Crosschecked 1 objects
Finished implicit crosscheck copy at 11-NOV-08

searching for all files in the recovery area


cataloging files...
cataloging done

List of Cataloged Files


=======================
File Name:
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\20
08_11_
11\O1_MF_N_670503116_4KL5MPLK_.BKP

using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 4 is already on disk as file D:\ORACLE\PRODUCT\10.


2.0\ORADATA\ORCL\REDO01.LOG
archive log filename=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG
thread=1 s
equence=4
media recovery complete, elapsed time: 00:00:02
Finished recover at 11-NOV-08

RMAN> alter database open resetlogs;

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

Potrebbero piacerti anche