%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 (退出)
恢復數據庫必須在mount狀態下
%rmantarget=rman/rman@mydb(啟動恢復管理器)
RMAN> configure default device type to disk; (設置默認的備份設備為磁盤)
RMAN> configure device type disk parallelism
RMAN> configure channel
RMAN> configure channel
RMAN> configure controlfile autobackup on; (打開控制文件與服務器參數文件的自動備份)
RMAN> configure controlfile autobackup format for device type disk to
RMAN> show all;
RMAN> report schema;
RMAN> backup database plus archivelog delete input; (備份全庫及控制文件
RMAN> backup tablespace system plus archivelog delete input; (備份指定表空間及歸檔的重做日志
RMAN> backup archivelog all delete input;
RMAN> copy datafile
RMAN> copy datafile
RMAN> list copy of datafile
RMAN> delete copy of datafile
RMAN> list backup;
RMAN> validate backupset
RMAN> shutdown immediate; (立即關閉數據庫)
RMAN> startup nomount; (啟動實例)
RMAN> restore spfile to pfile
RMAN> shutdown immediate; (立即關閉數據庫)
RMAN> startup nomount; (啟動實例)
RMAN> restore controlfile to
RMAN> shutdown immediate; (立即關閉數據庫)
RMAN> exit (退出)
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%rmantarget=rman/rman@mydb(啟動恢復管理器)
RMAN> startup pfile=/oracle/admin/mydb/pfile/initmydb
RMAN> restore database; (還原數據庫)
RMAN> recover database; (恢復數據庫)
RMAN> alter database open; (打開數據庫)
RMAN> sql
RMAN> exit (退出恢復管理器)
%mv /oracle/dbs/users
%rmantarget=rman/rman@mydb(啟動恢復管理器)
RMAN> restore tablespace users; (還原表空間)
RMAN> recover tablespace users; (恢復表空間)
RMAN> sql
第一天的增量基本備份
RMAN> backup incremental level=
第二天的增量差異備份
RMAN> backup incremental level=
第三天的增量差異備份
RMAN> backup incremental level=
第四天的增量差異備份
RMAN> backup incremental level=
第五天的增量差異備份
RMAN> backup incremental level=
第六天的增量差異備份
RMAN> backup incremental level=
第七天的增量差異備份
RMAN> backup incremental level=
backup incremental level=
增量恢復
RMAN> shutdown immediate;
RMAN> exit
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%mv /oracle/dbs/tbs_
%rmantarget=rman/rman@mydb
RMAN> startup pfile=/oracle/admin/mydb/pfile/initmydb
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open;
基於時間點的恢復
export ORACLE_SID=order
rman target / nocatalog
set DBID=
startup nomount;
restore controlfile from autobackup;
alter database mount;
restore database until time
recover database until time
alter database open resetlogs;
From:http://tw.wingwit.com/Article/program/Oracle/201311/18199.html