利用dbmsbackuprestore恢复数据库 $ k( r; a; ]. _$ R. x' u, x0 S
进行测试之前先将数据库做全备:
$ p* }6 |0 N# L; f5 s9 { 引用 " X: `5 t& y/ j: H
RMAN> run { " A$ \0 O% C8 m' O* P) j
2> allocate channel ch00 device type disk;
: e6 }# Z G% F' l; r( ^( M 3> backup database include current controlfile format ‘/backup/full%t’ tag=’FULLDB’; 7 m) V' x* n7 ~" a" e4 E
4> sql ‘alter system archive log current’; 0 O5 q6 V0 w" u* O! ?; h1 a
5> backup archivelog all format ‘/backup/arch%t’ tag=’ARCHIVELOG’;
* P* |$ d3 `; F8 ? i 6> release channel ch00; # g1 u, j' E& W, l- B3 d
7> }
$ O' f6 P4 c: c8 C allocated channel: ch00
. `* e6 _1 w U) Y channel ch00: sid=17 devtype=DISK
# G% }$ {; ]3 e* ?( R/ h4 r Starting backup at 20-JAN-10
+ ]6 I* m3 P0 _- x {/ o channel ch00: starting full datafile backupset " c$ I" e3 T4 J+ T4 O2 L; m6 q
channel ch00: specifying datafile(s) in backupset 5 _6 Z8 t$ O t4 D" ?. l1 ^
including current controlfile in backupset
4 j0 r0 L& D) e0 f/ F input datafile fno=00001 name=/app/oracle/oradata/ora9i/system01.dbf . h2 l. ?6 I/ ^0 X# J1 I8 }
input datafile fno=00002 name=/app/oracle/oradata/ora9i/undotbs01.dbf
) @+ l8 P+ C% J* S# J7 o7 \: z4 P input datafile fno=00005 name=/app/oracle/oradata/ora9i/example01.dbf
7 ^- u4 ?4 M+ r; I* z- Q input datafile fno=00011 name=/app/oracle/oradata/ora9i/STREAM01.dbf ; }! H3 z. o" @8 g8 C
input datafile fno=00010 name=/app/oracle/oradata/ora9i/xdb01.dbf
( w" p! v7 ]. p/ P input datafile fno=00006 name=/app/oracle/oradata/ora9i/indx01.dbf
& z8 |1 \; y0 ^% [6 @2 W' | input datafile fno=00009 name=/app/oracle/oradata/ora9i/users01.dbf
4 W3 x5 t/ ?# n8 { input datafile fno=00003 name=/app/oracle/oradata/ora9i/cwmlite01.dbf ' s4 ~% ]2 x" ]$ C! {
input datafile fno=00004 name=/app/oracle/oradata/ora9i/drsys01.dbf - n, P4 r3 j, i' z1 M0 W; Y
input datafile fno=00007 name=/app/oracle/oradata/ora9i/odm01.dbf
; b- f* b$ Q" L0 i8 i6 s input datafile fno=00008 name=/app/oracle/oradata/ora9i/tools01.dbf
! l2 v: |4 Y% M- _7 y1 p ^9 q channel ch00: starting piece 1 at 20-JAN-10 # S& j1 k4 y3 v; u* s( F( {
channel ch00: finished piece 1 at 20-JAN-10 " W% e+ h, j* g& l2 y" j
piece handle=/backup/full708756233 comment=NONE $ O& ?( ?# x* {
channel ch00: backup set complete, elapsed time: 00:02:26 , s* v6 X) m6 i# Q- r" t& k0 n
Finished backup at 20-JAN-10
O" d, y" ~) R2 H3 P3 [ Starting Control File and SPFILE Autobackup at 20-JAN-10 ( }7 m5 f% M0 l4 {5 e
piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-00 comment=NONE * U; ]( z0 A& P b; N
Finished Control File and SPFILE Autobackup at 20-JAN-10
2 h0 f' j4 S* } sql statement: alter system archive log current 0 j l. ]9 j, S, p ^
Starting backup at 20-JAN-10 ' M7 T! \/ ^8 M* q) P' D
current log archived
- W& p3 D: B( S+ y channel ch00: starting archive log backupset : A5 E6 t, {5 h, J, w
channel ch00: specifying archive log(s) in backup set $ v \. N( {! T0 m- L, z
input archive log thread=1 sequence=1 recid=254 stamp=708756150 ( j( k4 W7 [$ w3 C- f+ U! c
input archive log thread=1 sequence=2 recid=255 stamp=708756383
Z' K- X+ L' h' \: j input archive log thread=1 sequence=3 recid=256 stamp=708756383
3 Y4 }7 o, g" i) o channel ch00: starting piece 1 at 20-JAN-10 & c6 R$ q9 e, ~$ E) v
channel ch00: finished piece 1 at 20-JAN-10 * u9 J. s. N# A6 b$ o& ^
piece handle=/backup/arch708756383 comment=NONE ; d0 u: u6 q9 o0 R; ]
channel ch00: backup set complete, elapsed time: 00:00:02
; u! a* l4 _( N5 }: J Finished backup at 20-JAN-10
' ]* D! O2 H* b4 ?2 h8 t) d/ H Starting Control File and SPFILE Autobackup at 20-JAN-10
' R1 h3 Y( A4 Y+ d: [* } piece handle=/app/oracle/product/9.0.2/dbs/c-2494723682-20100120-01 comment=NONE
& d0 t) k1 _2 O2 x/ @) v Finished Control File and SPFILE Autobackup at 20-JAN-10 0 z3 X1 ^; S/ b% J2 _
released channel: ch00
7 Y* q, ]7 c5 r5 p 6 J, ^7 n9 }$ j
假设现在数据库异常宕机 - l, u( \4 r7 ~8 [7 F# s
引用 ' f& \! D7 Z% o# P) f1 F1 N
SQL> shutdown abort
/ h, Q& i( `3 J. Q: H% q* E ORACLE instance shut down
5 \4 L" C5 M1 Y3 V0 g) ^ 启动数据库至nomount状态 |