利用dbmsbackuprestore恢复数据库
# i9 y* j$ t$ h- _) B' }进行测试之前先将数据库做全备: # g2 @% T- O4 E2 E( P, _: F
引用 8 {* Y7 H) G) U" P8 ^9 Q
RMAN> run {
& j0 l& T# b7 s, s 2> allocate channel ch00 device type disk;
* w2 p( H$ ]+ ^1 o7 F8 \ J V4 _ 3> backup database include current controlfile format ‘/backup/full%t’ tag=’FULLDB’; / b3 @2 s& Q) \0 k$ q$ D8 v
4> sql ‘alter system archive log current’; ( _6 S& b# ?4 e1 p
5> backup archivelog all format ‘/backup/arch%t’ tag=’ARCHIVELOG’;
! k) g( H0 U' R9 f3 P) O 6> release channel ch00;
# T* r; y- C( o' F" q3 k6 [1 j3 Q 7> }
9 d+ q" Q! d/ Q* { allocated channel: ch00
6 ~& c) Y" T& [4 ~8 b v4 V channel ch00: sid=17 devtype=DISK 7 c" R* r5 |' n% c8 S `6 r) ]. @
Starting backup at 20-JAN-10
& B3 O7 s# G, f0 c, _: h$ N8 S channel ch00: starting full datafile backupset 9 r. T, b/ g4 J2 g! ~2 x
channel ch00: specifying datafile(s) in backupset
\9 P1 S( q* o; D/ S including current controlfile in backupset
! u, z5 P- ~2 i8 l/ B& Y9 _ input datafile fno=00001 name=/app/oracle/oradata/ora9i/system01.dbf
5 h$ @ `% y% }, ]( A( B; ]* H input datafile fno=00002 name=/app/oracle/oradata/ora9i/undotbs01.dbf
& }- @* Y& ?, E* x @& q4 x input datafile fno=00005 name=/app/oracle/oradata/ora9i/example01.dbf
5 y. {8 t% c: H: k! { input datafile fno=00011 name=/app/oracle/oradata/ora9i/STREAM01.dbf
8 L7 q1 Z# j2 J3 n; V' b input datafile fno=00010 name=/app/oracle/oradata/ora9i/xdb01.dbf ; V7 W8 B0 G1 N1 f
input datafile fno=00006 name=/app/oracle/oradata/ora9i/indx01.dbf 6 O) [' i1 f& a2 B" e5 w4 y
input datafile fno=00009 name=/app/oracle/oradata/ora9i/users01.dbf
1 c2 r$ u2 ]3 a a input datafile fno=00003 name=/app/oracle/oradata/ora9i/cwmlite01.dbf $ C: K7 K/ F0 O
input datafile fno=00004 name=/app/oracle/oradata/ora9i/drsys01.dbf
7 }# S: \& n) k" i; i9 @9 I input datafile fno=00007 name=/app/oracle/oradata/ora9i/odm01.dbf
& r* i2 x0 i: a! k8 E5 _( z input datafile fno=00008 name=/app/oracle/oradata/ora9i/tools01.dbf
5 f! ~3 i( p. u% m! Y' l; G channel ch00: starting piece 1 at 20-JAN-10
% Y2 ^+ U4 F7 C- A& N) h t6 r! D channel ch00: finished piece 1 at 20-JAN-10
- o# {9 w5 {" r& q9 G5 Q0 ~$ J piece handle=/backup/full708756233 comment=NONE
+ m) \7 c/ J& h; m* ~ L9 x& \ channel ch00: backup set complete, elapsed time: 00:02:26 0 a' ?# Z3 n1 N* P
Finished backup at 20-JAN-10
, L- Y6 K# a! j3 V Starting Control File and SPFILE Autobackup at 20-JAN-10
, E5 z' f/ a9 Z h: B c piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-00 comment=NONE
j0 x w0 T9 F7 x9 J0 u Finished Control File and SPFILE Autobackup at 20-JAN-10
7 ]( K4 h0 \; X sql statement: alter system archive log current " z9 m* Q5 p! c2 w @, ?) r
Starting backup at 20-JAN-10
% k; x2 w8 u# B1 V+ O- K9 B) i current log archived 0 C! g5 A' C! ^# [% B
channel ch00: starting archive log backupset
' z7 _6 a8 e7 r! g# y( H; z channel ch00: specifying archive log(s) in backup set , f; N( ?& h! T7 l& Q
input archive log thread=1 sequence=1 recid=254 stamp=708756150 5 z0 u. P8 j& i' P
input archive log thread=1 sequence=2 recid=255 stamp=708756383
8 w w! m' R- t. q, m input archive log thread=1 sequence=3 recid=256 stamp=708756383 ' g/ d6 T/ I8 J; y
channel ch00: starting piece 1 at 20-JAN-10
, G4 C! G$ J1 j+ N channel ch00: finished piece 1 at 20-JAN-10 K& U; ?' N: E0 M/ Z# R
piece handle=/backup/arch708756383 comment=NONE * C/ K# _/ R% f! |2 C: s# E
channel ch00: backup set complete, elapsed time: 00:00:02
: l( z8 `) ^1 A5 {8 I Finished backup at 20-JAN-10 $ w% c0 j0 i" [% b3 _! l, K- Z/ }
Starting Control File and SPFILE Autobackup at 20-JAN-10 ( q3 h# q! V2 ^; j5 G- e
piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-01 comment=NONE - {" W" ]% h3 O: E8 [
Finished Control File and SPFILE Autobackup at 20-JAN-10 ( a) w7 _9 ]8 s7 F* M4 l
released channel: ch00 ; H( }1 Z: }4 z- M7 B( S
2 C+ m: x* }/ Z- @# u O 假设现在数据库异常宕机
$ J% g4 g. ]4 |7 g3 U+ i: d 引用 4 v( ]6 ?5 S- v" f2 E
SQL> shutdown abort " Q' @. S- Q# o; b+ j# N, W
ORACLE instance shut down
. t6 Y C3 b& ` 启动数据库至nomount状态 |