a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 194|回复: 1

[考试辅导] Oracle技术:使用RMAN排除表空间备份

[复制链接]
发表于 2012-8-4 14:06:19 | 显示全部楼层 |阅读模式
在RMAN的备份中,可以经由过程Exclude呼吁解除某些不需要备份的表空间。
1 j" F8 D. ?8 Q9 W* n  这样可以缩减备份的容量,对备份进行恰当优化和调整。( m' @3 H9 A# G) J/ D  K+ T
  解除某个表空间可以使用近似如下呼吁:
  V' }' C( i: w5 X1 a9 S$ g. q  configure exclude for tablespace users;# H8 R! K: r! u! ~- _, M
  其设置可以在RMAN中经由过程show exclude呼吁来查看。
! U" \& U$ v* t; o5 s  如不美观未来想姑且增添解除表空间的备份,站提醒: 可以经由过程以下呼吁实现:
& U( Q0 I5 m) m' [0 v  backup database noexclude;
: K! B' B9 m; \+ p  如不美观想打消解除设置则可以使用如下呼吁:
& c4 f# p4 L& X; a( J0 z  CONFIGURE EXCLUDE FOR TABLESPACE users CLEAR;
" T' F4 H2 C. {: y6 `4 ^  此外常用的解除备份呼吁还有:
3 P5 K9 A9 g/ q  BACKUP DATABASE SKIP READONLY, SKIP OFFLINE;% Y" e1 j$ \* U8 q# s" d6 p
  以下是一个简单的测试过程。( K- G$ E- ]8 n# a
  执行备份:
) g& B1 I. H0 z0 m  [oracle@test126 udump]$ rman target /! I: T2 X9 S; u) |$ Z# M1 V
  Recovery Manager: Release 10.2.0.1.0 - Production on Mon Oct 9 06:47:19 2006
0 U2 c; D! n! t) x" M* a0 Q' f  Copyright (c) 1982, 2005, Oracle. All rights reserved.
6 m7 w* P" h2 K% R6 i) u# h; C  connected to target database: EYGLE (DBID=2590148133)
3 ]. s0 ?, h$ C& j( b  RMAN> configure exclude for tablespace users;+ L: @5 W* P1 w9 B/ R1 C
  using target database control file instead of recovery catalog  r  z6 s; h( [/ P4 r
  tablespace USERS will be excluded from future whole database backups
! h# X$ V8 a/ z2 \- j& C' g  new RMAN configuration parameters are successfully stored
* a6 N6 [5 b7 H# w; z& V% Y  RMAN> backup full database;# e3 d" H2 }3 x( [3 D4 F
  Starting backup at 09-OCT-06
; C5 ~) e2 I- |( _5 r7 ~/ `9 Q  allocated channel: ORA_DISK_1
& |  a( ^% Z: }# l  channel ORA_DISK_1: sid=527 devtype=DISK4 d' P4 j# @/ h0 q9 U( H
  file 4 is excluded from whole database backup5 x) H3 F! }1 A# y) O+ S
  channel ORA_DISK_1: starting full datafile backupset
7 v1 r; e6 I4 T+ u3 l1 \1 x  channel ORA_DISK_1: specifying datafile(s) in backupset4 O7 s( b1 |  ]. R/ J* t9 s
  input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf; m: Y& R: J3 o$ I- ~/ l2 {
  input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf
) F3 Q; i! i! o# v: V  input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf
3 y9 ^7 T. ~( w  channel ORA_DISK_1: starting piece 1 at 09-OCT-06) F9 d7 ~: g1 l0 B4 J. g
  channel ORA_DISK_1: finished piece 1 at 09-OCT-06
+ h3 F4 s& o) G4 r  piece handle=/opt/oracle/flash_recovery_area/EYGLE/backupset/+ D; y) e$ {; S. }& U' W
  2006_10_09/o1_mf_nnndf_TAG20061009T070612_2lm135od_.bkp tag=TAG20061009T070612 comment=NONE, w. F# f( c1 ~4 N2 m2 i, V
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:48
7 \% D4 o! u; K% k) T/ H2 V  channel ORA_DISK_1: starting full datafile backupset7 i" S' w9 T% z0 r: n8 Y* B
  channel ORA_DISK_1: specifying datafile(s) in backupset
. Y- B. B) O% v# h/ E6 O1 e( A! i  including current control file in backupset, r" I1 k% i9 A3 V1 B1 l
  channel ORA_DISK_1: starting piece 1 at 09-OCT-06, h% ?2 X  X* S' ~: h& ]" [3 q; y
  channel ORA_DISK_1: finished piece 1 at 09-OCT-06
) s% H. @9 u; ?! N. {4 U  piece handle=/opt/oracle/flash_recovery_area/EYGLE/backupset/
' f5 N9 d5 |, s. O1 @  2006_10_09/o1_mf_ncnnf_TAG20061009T070612_2lm14ppc_.bkp tag=TAG20061009T070612 comment=NONE8 L( e4 [& X( p3 t$ U1 p. @
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
- s- ^2 u( [4 H7 x1 m; s1 Y, K  Finished backup at 09-OCT-06
$ j2 }. v" @0 {  RMAN> exit% e, d% d- G/ u( }, z- m: J
  Recovery Manager complete.
; m+ ^+ \! b9 @  然后封锁数据库,我们可以进行一次恢复考试考试:: l! ~8 ]8 b4 d* }# y$ O' W" m
  [oracle@test126 udump]$ sqlplus "/ as sysdba"
  c# O1 J+ i  T, j6 N% _0 t7 P2 _+ S7 X1 g  SQL*Plus: Release 10.2.0.1.0 - Production on Mon Oct 9 07:07:28 20061 r' Q% g' ?2 H; u) i5 f" `8 u
  Copyright (c) 1982, 2005, Oracle. All rights reserved.- s' L2 r% a+ Y. V) ^# o) m" K
  Connected to:5 i9 e* R; ]# F
  Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production+ J( @8 `, }, K( D, J
  With the Partitioning and Data Mining options  y; ]6 a4 o6 Y$ A- M
  SQL> select name from v$datafile;
回复

使用道具 举报

 楼主| 发表于 2012-8-4 14:06:20 | 显示全部楼层

Oracle技术:使用RMAN排除表空间备份

  NAME- n. x: b% J8 J6 q; ]
  /opt/oracle/oradata/eygle/system01.dbf
8 l- A/ [9 d' C  /opt/oracle/oradata/eygle/undotbs01.dbf
4 J1 g* F8 n6 A1 x4 P  /opt/oracle/oradata/eygle/sysaux01.dbf
" e; e) a+ L9 l' |  /opt/oracle/oradata/eygle/users01.dbf  P2 O1 x( C+ R; a: d; _, L
  SQL> shutdown immediate;
# x/ T9 R6 f" C" b: I5 H  Database closed.+ N2 Z$ {( G4 _
  Database dismounted.! @' N% Z) p. l1 ~( g# |" Q
  ORACLE instance shut down.
5 m( Z8 w: A2 I/ U, T  L  SQL> exit
$ n- x  ^# W! k+ z/ w& ?! p  Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
" T6 f$ k! y3 q% W5 q  N% X6 l  With the Partitioning and Data Mining options/ Z9 a& n6 Y6 Z: q  f5 q' E
  看看恢复历程:4 v0 k2 q9 S# i$ s2 C* X
  [oracle@test126 udump]$ rman target /# A  }9 a! U" q, Y3 l( j
  Recovery Manager: Release 10.2.0.1.0 - Production on Mon Oct 9 07:08:40 2006
# Z: K7 K# k- v1 n/ d  Copyright (c) 1982, 2005, Oracle. All rights reserved.
+ L9 Z# y& ?% F$ a  connected to target database (not started)
7 l  d; Q, {* z9 B4 B% |; d  RMAN> startup mount;, d& D' @% A% ?. s2 A6 G6 \
  Oracle instance started% E- a( @4 l* S- K
  database mounted
; p# F; r# F, d% G! c/ ?, O  Total System Global Area 536870912 bytes
" ]+ e  s+ U: a- D/ V$ W! q# K  Fixed Size 1220460 bytes
/ U2 d3 n; _! V$ ]5 v2 ~  Variable Size 150995092 bytes. F+ O+ y7 b' c% [! P! i2 O
  Database Buffers 377487360 bytes$ ]3 [& U1 F# G. I6 {2 W
  Redo Buffers 7168000 bytes+ Q% t7 m( Y: H# Y
  RMAN> restore database;" x: Q- e" {' s' Z! Z
  Starting restore at 09-OCT-06
* r! t- j! s( c( e8 ~4 {  using target database control file instead of recovery catalog
) s. e4 E9 j  {  allocated channel: ORA_DISK_1$ x" @, e; J. ?  H( U& _
  channel ORA_DISK_1: sid=542 devtype=DISK2 M. K- J# y' V8 k4 L* R5 U+ h, g
  file 4 is excluded from whole database backup
: S, b$ D( N; O) [7 z  channel ORA_DISK_1: starting datafile backupset restore
+ f  l7 x2 d1 O3 S! l3 t  channel ORA_DISK_1: specifying datafile(s) to restore from backup set2 `; P. I; K( K3 e) s' k, w( |# d1 K
  restoring datafile 00001 to /opt/oracle/oradata/eygle/system01.dbf
6 z2 m$ `3 c, C  restoring datafile 00002 to /opt/oracle/oradata/eygle/undotbs01.dbf
  y- M% i7 b- X7 [  restoring datafile 00003 to /opt/oracle/oradata/eygle/sysaux01.dbf
+ p3 G/ C+ s8 s! C8 b' N) i  channel ORA_DISK_1: reading from backup piece /opt/oracle/flash_recovery_area/EYGLE/backupset/
* N  P+ a1 d  t! g) e  2006_10_09/o1_mf_nnndf_TAG20061009T070612_2lm135od_.bkp  ]' D+ M& j- m7 v
  channel ORA_DISK_1: restored backup piece 1
! G& O! j- n# ?* x! ~  piece handle=/opt/oracle/flash_recovery_area/EYGLE/backupset/6 A* z+ @& O5 n. C+ [
  2006_10_09/o1_mf_nnndf_TAG20061009T070612_2lm135od_.bkp tag=TAG20061009T0706126 m5 L5 {+ }. H
  channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
2 S- a( j7 K  ]& h3 t- v2 ]  failover to previous backup
- l1 T  P7 l2 D+ }$ ]6 L$ e/ \  Finished restore at 09-OCT-06
: \6 K5 h# w: I# A  RMAN> recover database;/ Y  Z' R" _  w( [: S
  Starting recover at 09-OCT-06
% B$ b$ v) v2 a  k* c5 f+ }9 r  using channel ORA_DISK_1
' j8 y2 g  }+ O& d1 K1 F! L: I2 G2 G  starting media recovery
: L' Q2 R' k" Q$ l5 v. M7 u) V3 \  media recovery complete, elapsed time: 00:00:02
& N" d+ v! {! D# o% s  Finished recover at 09-OCT-06
4 {! z! j+ y. e  RMAN> alter database open;0 F6 h) a: Y0 s# R. |% i
  database opened1 x0 V! H1 ]1 A- s% ?
  RMAN>
$ q* |; o' ~: X7 O5 r/ Q; N7 N  站提醒: 如不美观未备份的表空间文件丢失踪,不成恢复,你可能需要重建以还原数据库。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-4 17:37 , Processed in 0.362876 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表