rman进行备份、恢复

    rman备份可以很复杂,但学习需要由浅入深,下面是最常见的几种备份、恢复方式。

备份数据的路径与大小:

SQL> show parameter  DB_RECOVERY_FILE_DEST
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      E:\oracle11g\guogang\rman_backup
db_recovery_file_dest_size           big integer 10G

备份:

C:\Documents and Settings\guogang>sqlplus / as sysdba;

SQL> create tablespace rman_ts datafile 'E:\oracle11g\guogang\orcl\rman_ts.dbf'   size 150M;
SQL> create user rman identified by rman
temporary tablespace TEMP02
default tablespace rman_ts
quota unlimited on rman_ts;

SQL> grant recovery_catalog_owner to rman;

C:\Documents and Settings\guogang>rman catalog rman/rman

RMAN>create catalog tablespace rman_ts;

C:\Documents and Settings\guogang>rman target rman/rman -- catalog数据库作为RMAN的资料库

C:\Documents and Settings\guogang>rman target  /   --控制文件作为RMAN的资料库

RMAN> backup database;

RMAN> list backupset;

RMAN> backup tablespace USERS;

RMAN> backup datafile 4;


恢复:

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database open;


C:\Documents and Settings\guogang>rman target /

RMAN> restore database;--恢复整个数据库

RMAN> recover database;

RMAN> restore tablespace USERS;--恢复表空间

RMAN> recover tablespace USERS;

RMAN> restore datafile 4;--恢复数据文件

RMAN> recover datafile 4;

     注意的是:在10.2.0.1.0上,建资料库报错,在google上查,是bug,需要升级到10.2.0.4.0 。

 

你可能感兴趣的:(rman)