RMAN結合Read Only、Exclude的備份策略
E:>9i
E:>echo off
OracleServiceEEYGLE 服務正在啟動 .........................................................
OracleServiceEEYGLE 服務已經啟動成功。
登陸資料庫,將部分表空間更改為Read Only:
E:>sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on Tue Apr 21 09:09:45 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
D:ORACLEORADATAEEYGLESYSTEM01.DBF
D:ORACLEORADATAEEYGLEUNDOTBS01.DBF
D:ORACLEORADATAEEYGLECWMLITE01.DBF
D:ORACLEORADATAEEYGLEDRSYS01.DBF
D:ORACLEORADATAEEYGLEEXAMPLE01.DBF
D:ORACLEORADATAEEYGLEINDX01.DBF
D:ORACLEORADATAEEYGLEODM01.DBF
D:ORACLEORADATAEEYGLETOOLS01.DBF
D:ORACLEORADATAEEYGLEUSERS01.DBF
D:ORACLEORADATAEEYGLEXDB01.DBF
D:ORACLEORADATAEEYGLEPERFSTAT.DBF
11 rows selected.
SQL> select sum(bytes)/1024/1024/1024 from v$datafile;
SUM(BYTES)/1024/1024/1024
-------------------------
1.65161133
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Disabled
Archive destination D:oracleoradataEEYGLEARCHIVE
Oldest online log sequence 52
Next log sequence to archive 53
Current log sequence 54
SQL> alter tablespace tools read only;
Tablespace altered.
SQL> alter tablespace perfstat read only;
Tablespace altered.
SQL> select 'alter tablespace '||tablespace_name ||' read only;' from dba_tablespaces;
'ALTERTABLESPACE'||TABLESPACE_NAME||'READONLY;'
----------------------------------------------------------
alter tablespace SYSTEM read only;
alter tablespace UNDOTBS1 read only;
alter tablespace TEMP read only;
alter tablespace CWMLITE read only;
alter tablespace DRSYS read only;
alter tablespace EXAMPLE read only;
alter tablespace INDX read only;
alter tablespace ODM read only;
alter tablespace TOOLS read only;
alter tablespace USERS read only;
alter tablespace XDB read only;
'ALTERTABLESPACE'||TABLESPACE_NAME||'READONLY;'
----------------------------------------------------------
alter tablespace PERFSTAT read only;
12 rows selected.
SQL> alter tablespace CWMLITE read only;
Tablespace altered.
SQL> alter tablespace DRSYS read only;
Tablespace altered.
SQL> alter tablespace EXAMPLE read only;
Tablespace altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
使用RMAN進行一次0級備份,注意根據skip readonly子句,Read ONLY表空間會被自動跳過:
E:>rman target /
Recovery Manager: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: EEYGLE (DBID=1052376487)
RMAN> run{
2> allocate channel c1 type disk;
3> backup incremental level 0 tag 'db0' format 'e:tempdb0%u_%s_%p'
4> database skip readonly;
5> sql 'alter system archive log current';
6> backup filesperset 3 format 'e:temparch%u_%s_%p' archivelog all delete input;
7> release channel c1;
8> }
using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=10 devtype=DISK
Starting backup at 21-APR-09
skipping read-only file 3
skipping read-only file 4
skipping read-only file 5
skipping read-only file 8
skipping read-only file 11
channel c1: starting incremental level 0 datafile backupset
channel c1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00002 name=D:ORACLEORADATAEEYGLEUNDOTBS01.DBF
input datafile fno=00001 name=D:ORACLEORADATAEEYGLESYSTEM01.DBF
input datafile fno=00010 name=D:ORACLEORADATAEEYGLEXDB01.DBF
input datafile fno=00009 name=D:ORACLEORADATAEEYGLEUSERS01.DBF
input datafile fno=00006 name=D:ORACLEORADATAEEYGLEINDX01.DBF
input datafile fno=00007 name=D:ORACLEORADATAEEYGLEODM01.DBF
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPDB008KD10DI_8_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:04:08
Finished backup at 21-APR-09
sql statement: alter system archive log current
Starting backup at 21-APR-09
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=51 recid=76 stamp=656093277
input archive log thread=1 sequence=52 recid=77 stamp=656093480
input archive log thread=1 sequence=53 recid=78 stamp=684753587
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPARCH09KD10M8_9_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:09
channel c1: deleting archive log(s)
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00051.001 recid=76 stamp=656093277
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00052.001 recid=77 stamp=656093480
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00053.001 recid=78 stamp=684753587
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=54 recid=79 stamp=684753596
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPARCH0AKD10MJ_10_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:17
channel c1: deleting archive log(s)
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00054.001 recid=79 stamp=684753596
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=55 recid=80 stamp=684753601
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPARCH0BKD10N5_11_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
channel c1: deleting archive log(s)
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00055.001 recid=80 stamp=684753601
Finished backup at 21-APR-09
released channel: c1
RMAN> exit
Recovery Manager complete.
備份完成之後修改部分資料:
E:>sqlplus /nolog
SQL*Plus: Release 9.2.0.8.0 - Production on Tue Apr 21 09:39:34 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect eygle/eygle
Connected.
SQL> create table eygle as select * from dba_objects;
Table created.
SQL> alter system switch logfile;
System altered.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
進行Level 1級的增量備份:
E:>rman target /
Recovery Manager: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: EEYGLE (DBID=1052376487)
RMAN> run{
2> allocate channel c1 type disk;
3> backup incremental level 1 tag 'db1' format 'e:tempdb1%u_%s_%p'
4> database skip readonly;
5> sql 'alter system archive log current';
6> backup filesperset 3 format 'e:temparch%u_%s_%p'
7> archivelog all delete input;
8> release channel c1;
9> }
using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=11 devtype=DISK
Starting backup at 21-APR-09
skipping read-only file 3
skipping read-only file 4
skipping read-only file 5
skipping read-only file 8
skipping read-only file 11
channel c1: starting incremental level 1 datafile backupset
channel c1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00002 name=D:ORACLEORADATAEEYGLEUNDOTBS01.DBF
input datafile fno=00001 name=D:ORACLEORADATAEEYGLESYSTEM01.DBF
input datafile fno=00010 name=D:ORACLEORADATAEEYGLEXDB01.DBF
input datafile fno=00009 name=D:ORACLEORADATAEEYGLEUSERS01.DBF
input datafile fno=00006 name=D:ORACLEORADATAEEYGLEINDX01.DBF
input datafile fno=00007 name=D:ORACLEORADATAEEYGLEODM01.DBF
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPDB10CKD120F_12_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:07
Finished backup at 21-APR-09
sql statement: alter system archive log current
Starting backup at 21-APR-09
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=56 recid=81 stamp=684755029
input archive log thread=1 sequence=57 recid=82 stamp=684755031
input archive log thread=1 sequence=58 recid=83 stamp=684755033
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPARCH0DKD122P_13_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:05
channel c1: deleting archive log(s)
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00056.001 recid=81 stamp=684755029
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00057.001 recid=82 stamp=684755031
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00058.001 recid=83 stamp=684755033
Finished backup at 21-APR-09
released channel: c1
RMAN> exit
Recovery Manager complete.
再更改資料庫內容:
E:>sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on Tue Apr 21 09:45:52 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
SQL> connect eygle/eygle
Connected.
SQL> drop table test;
Table dropped.
SQL> drop table eygle;
Table dropped.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
使用RMAN配置Exclude排除表空間,注意此處測試排除多個表空間的備份:
E:>rman target /
Recovery Manager: Release 9.2.0.8.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: EEYGLE (DBID=1052376487)
RMAN> configure exclude for tablespace INDX;
using target database controlfile instead of recovery catalog
tablespace INDX will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
RMAN> show exclude;
RMAN configuration parameters are:
CONFIGURE EXCLUDE FOR TABLESPACE 'INDX';
RMAN> configure exclude for tablespace ODM;
tablespace ODM will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
RMAN> show exclude;
RMAN configuration parameters are:
CONFIGURE EXCLUDE FOR TABLESPACE 'INDX';
CONFIGURE EXCLUDE FOR TABLESPACE 'ODM';
RMAN> configure exclude for tablespace TOOLS;
tablespace TOOLS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
RMAN>
RMAN> configure exclude for tablespace XDB;
tablespace XDB will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
RMAN> show exclude;
RMAN configuration parameters are:
CONFIGURE EXCLUDE FOR TABLESPACE 'INDX';
CONFIGURE EXCLUDE FOR TABLESPACE 'ODM';
CONFIGURE EXCLUDE FOR TABLESPACE 'TOOLS';
CONFIGURE EXCLUDE FOR TABLESPACE 'XDB';
RMAN> configure exclude for tablespace USERS;
tablespace USERS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
RMAN> show exclude;
RMAN configuration parameters are:
CONFIGURE EXCLUDE FOR TABLESPACE 'INDX';
CONFIGURE EXCLUDE FOR TABLESPACE 'ODM';
CONFIGURE EXCLUDE FOR TABLESPACE 'TOOLS';
CONFIGURE EXCLUDE FOR TABLESPACE 'USERS';
CONFIGURE EXCLUDE FOR TABLESPACE 'XDB';
RMAN> run{
2> allocate channel c1 type disk;
3> backup incremental level 1 tag 'db1' format 'e:tempdb1%u_%s_%p'
4> database skip readonly;
5> sql 'alter system archive log current';
6> backup filesperset 3 format 'e:temparch%u_%s_%p'
7> archivelog all delete input;
8> release channel c1;
9> }
allocated channel: c1
channel c1: sid=10 devtype=DISK
Starting backup at 21-APR-09
skipping read-only file 3
skipping read-only file 4
skipping read-only file 5
file 6 is excluded from whole database backup
file 7 is excluded from whole database backup
file 8 is excluded from whole database backup
file 9 is excluded from whole database backup
file 10 is excluded from whole database backup
skipping read-only file 11
channel c1: starting incremental level 1 datafile backupset
channel c1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00002 name=D:ORACLEORADATAEEYGLEUNDOTBS01.DBF
input datafile fno=00001 name=D:ORACLEORADATAEEYGLESYSTEM01.DBF
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPDB10EKD12B2_14_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:57
Finished backup at 21-APR-09
sql statement: alter system archive log current
Starting backup at 21-APR-09
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=59 recid=84 stamp=684755357
input archive log thread=1 sequence=60 recid=85 stamp=684755360
channel c1: starting piece 1 at 21-APR-09
channel c1: finished piece 1 at 21-APR-09
piece handle=E:TEMPARCH0FKD12D1_15_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
channel c1: deleting archive log(s)
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00059.001 recid=84 stamp=684755357
archive log filename=D:ORACLEORADATAEEYGLEARCHIVEARC00060.001 recid=85 stamp=684755360
Finished backup at 21-APR-09
released channel: c1
RMAN>
透過排除多個表空間、跳過Read Only表空間,可以簡化我們的備份策略,在特定條件下,有助於我們的資料庫管理與維護。
-The End-
相關文章 | 隨機文章 |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13879334/viewspace-1035204/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RMAN】RMAN的備份保留策略
- rman 備份策略
- RMAN 備份策略 scripts
- rman備份集的保留策略
- RMAN說,我能備份(9)--RMAN增量備份與備份保留策略
- 【rman備份策略】實驗
- Oracle備份及備份策略及基於Linux下 Oracle 備份策略(RMAN)OracleLinux
- RAC模式下的備份策略以及RMAN備份指令碼模式指令碼
- RMAN說,我能備份(18)--制訂備份策略
- RAC模式下的備份策略以及RMAN備份指令碼(轉)模式指令碼
- RAC模式下的備份策略以及RMAN備份指令碼(ZF)模式指令碼
- oracle rman備份及策略設定Oracle
- rman備份rac的總結
- 一次 rman 備份策略的調整
- oracle10g RMAN增量備份策略Oracle
- 三種Oracle RMAN備份加密策略(上)Oracle加密
- 三種Oracle RMAN備份加密策略(下)Oracle加密
- RMAN 常用操作命令二(備份保留策略)
- 一次rman備份 策略調整
- 探索ORACLE之RMAN_05備份策略Oracle
- Oracle ADG環境下的RMAN備份策略Oracle
- rman備份的策略和croosschek delete基本命令delete
- 對read only表空間進行熱備份和使用備份的controlfile進行恢復時的一點總結!
- MySQL中如何選擇合適的備份策略和備份工具MySql
- 基於Linux下 Oracle 備份策略(RMAN)LinuxOracle
- aix下rac環境rman備份策略部署AI
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略-備份冗餘GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略GUIIDE
- oracle RMAN 備份恢復總結Oracle
- oracle RMAN 備份恢復總結Oracle
- 一次磁碟空間緊缺的RMAN備份策略
- RMAN的備份原理
- RMAN的備份加密加密
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略-過期備份的批量刪除GUIIDE
- Backup And Recovery User's Guide-備份RMAN備份-使用RMAN備份備份集GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-RMAN備份的多個拷貝-備份的備份GUIIDE
- exp備份和rman備份的區別
- 【RMAN】RMAN備份至ASMASM