1、切换服务器设置归档模式,如果已经是归档模式可跳过此步:
%sqlplus /nolog (启动sqlplus)
SQL> conn / as sysdba (以DBA身份连接数据库)
SQL> shutdown immediate; (立即关闭数据库)
SQL> startup mount (启动实例并加载数据库,但不打开)
SQL> alter database archivelog; (更改数据库为归档模式)
SQL> alter database open; (打开数据库)
SQL> alter system archive log start; (启用自动归档)
SQL> exit (退出)
2、连接:
%rman target=sys/password@mydb
(启动恢复管理器)
3、基本设置:
RMAN> configure default
device type to disk; (设置默认的备份设备为磁盘)
RMAN> configure device
type disk parallelism 2; (设置备份的并行级别,通道数)
RMAN> configure channel 1 device
type disk fromat '/backup1/backup_%U';
(设置备份的文件格式,只适用于磁盘设备)
RMAN>
configure channel 2 device type disk fromat '/backup2/backup_%U';
(设置备份的文件格式,只适用于磁盘设备)
RMAN> configure controlfile
autobackup on;
(打开控制文件与服务器参数文件的自动备份)
RMAN> configure controlfile
autobackup format for device type disk to '/backup1/ctl_%F';
(设置控制文件与服务器参数文件自动备份的文件格式)
4、查看所有设置:
RMAN> show all
5、查看数据库方案报表:
RMAN> report schema;
6、备份全库:
RMAN> backup database plus
archivelog delete input;
(备份全库及控制文件、服务器参数文件与所有归档的重做日志,并删除旧的归档日志)
7、备份表空间:
RMAN> backup tablespace system plus
archivelog delete input;
(备份指定表空间及归档的重做日志,并删除旧的归档日志)
8、备份归档日志:
RMAN> backup archivelog
all delete input;
9、复制数据文件:
RMAN> copy datafile 1 to
'/oracle/dbs/system.copy';
10、查看备份和文件复本:
RMAN> list backup;
11、验证备份:
RMAN> validate backupset
3;
12、从自动备份中恢复服务器参数文件:
RMAN> shutdown
immediate; (立即关闭数据库)
RMAN> startup nomount; (启动实例)
RMAN> restore spfile to pfile
'/backup1/mydb.ora' from autobackup;
(从自动备份中恢复服务器参数文件)
13、从自动备份中恢复控制文件:
RMAN> shutdown
immediate; (立即关闭数据库)
RMAN> startup nomount; (启动实例)
RMAN> restore controlfile to '/backup1'
from autobackup;
(从自动备份中恢复控制文件)
14、恢复和复原全数据库:
RMAN> shutdown immediate; (立即关闭数据库)
RMAN> exit (退出)
%mv /oracle/dbs/tbs_12.f
/oracle/dbs/tbs_12.bak (将数据文件重命名)
%mv
/oracle/dbs/tbs_13.f /oracle/dbs/tbs_13.bak (将数据文件重命名)
%mv
/oracle/dbs/tbs_14.f /oracle/dbs/tbs_14.bak (将数据文件重命名)
%mv
/oracle/dbs/tbs_15.f /oracle/dbs/tbs_15.bak (将数据文件重命名)
%rman target=rman/rman@mydb
(启动恢复管理器)
RMAN> startup
pfile=/oracle/admin/mydb/pfile/initmydb.ora
(指定初始化参数文件启动数据库)
RMAN> restore
database; (还原数据库)
RMAN> recover
database; (恢复数据库)
RMAN> alter
database open; (打开数据库)
15、恢复和复原表空间:
RMAN> sql
'alter tablespace users offline immediate';
(将表空间脱机)
RMAN> exit (退出恢复管理器)
%mv
/oracle/dbs/users01.dbf /oracle/dbs/users01.bak (将表空间重命名)
%rman
target=rman/rman@mydb (启动恢复管理器)
RMAN> restore
tablespace users; (还原表空间)
RMAN> recover
tablespace users; (恢复表空间)
RMAN> sql
'alter tablespace users online'; (将表空间联机)
16、增量备份与恢复:
第一天的增量基本备份:
RMAN> backup
incremental level=0 database plus archivelog delete input;
第二天的增量差异备份:
RMAN> backup
incremental level=2 database plus archivelog delete input;
第三天的增量差异备份:
RMAN> backup
incremental level=2 database plus archivelog delete input;
第四天的增量差异备份:
RMAN> backup
incremental level=1 database plus archivelog delete input;
第五天的增量差异备份:
RMAN> backup
incremental level=2 database plus archivelog delete input;
第六天的增量差异备份:
RMAN> backup
incremental level=2 database plus archivelog delete input;
第七天的增量差异备份:
RMAN> backup
incremental level=0 database plus archivelog delete input;
增量恢复:
RMAN>
shutdown immediate;
RMAN> exit
%mv
/oracle/dbs/tbs_12.f /oracle/dbs/tbs_12.bak
%mv
/oracle/dbs/tbs_13.f /oracle/dbs/tbs_13.bak
%mv
/oracle/dbs/tbs_14.f /oracle/dbs/tbs_14.bak
%mv
/oracle/dbs/tbs_15.f /oracle/dbs/tbs_15.bak
%rman
target=rman/rman@mydb
RMAN> startup
pfile=/oracle/admin/mydb/pfile/initmydb.ora
RMAN> restore
database;
RMAN> recover
database;
RMAN> alter
database open.(e129)on.htm
simulator/doc/license_keys.htm
simulator/doc/sdk.style.css
simulator/doc/davehitzforeword.htm
simulator/doc/faq.htm
simulator/doc/troubleshooting.htm
simulator/license.htm
simulator/readme.htm
simulator/runsim.sh
simulator/setup.sh
simulator/sim.tgz