章二十六 用户管理的完全恢复
在mount状态下恢复数据文件
conn sys/admin as sysdba
startup force mount
select file#, error from v$recover_file;
host copy .. //复制备份文件
recover datafile 1; (file#)
auto
alter database open;
在open状态下恢复关闭后意外丢失的数据文件
conn sys/admin as sysdba
startup force mount
select file#, error from v$recover_file;
alter database datafile 4 offline; (file#)
alter database open;
host copy .... //复制备份文件
recover datafile 4
auto
alter database datafile 4 online;
在open状态下恢复打开时意外丢失的数据文件
select file#, error from v$recover_file;
alter database datafile 4 offline; (file#)
host copy ... //复制备份文件
recover datafile 4
auto
alter database datafile 4 online;
在open状态下恢复未备份数据文件
conn sys/admin as sysdba
startup force mount
select file#, error from v$recover_file;
alter database datafile 4 offline; (file#)
alter database open;
alter database create datafile ' '
recover datafile 4
auto
alter database datafile 4 online;
章二十七 用户管理的不完全恢复
基于时间的恢复
conn sys/admin as sysdba
shutdown immediate
startup mount
host copy ....
recover automatic database until time 'yyyy-mm-dd hh:mm:nn'
alter database open resetlog;
重新备份所有的数据库文件和控制文件
基于scn的恢复
select current_scn from v$database;
conn sys/admin as sysdba
shutdown immediate
startup mount
host copy .....
recover atutomatic database until change scn_id
alter database open resetlog;
重新备份所有的数据库文件和控制文件
基于取消的恢复
conn sys/admin as sysdba
shutdown immediate
startup mount
host copy .....
recover database until cancel
alter database open resetlog;
重新备份所有的数据库文件和控制文件
基于控制备份文件的恢复
conn sys/admin as sysdba
shutdown immediate
startup mount
recover database until time 'yyyy-mm-dd hh:mm:nn' using backup controfile
auto
alter database open resetlog;
重新备份所有的数据库文件和控制文件
章二十八 其他恢复问题
章二十九 在NOARCHIVELOG模式下用户管理的备份与恢复
章三十 RMAN基础
连接到RMAN
rman target sys/admin nocatalog
rman nocatalog
connect target sys/admin //连接到目标数据库
rman target sys/admin@demo catalog rman/rman@rcat
rman
connect tartget sys/admin@demo
connect catalog rman/rman@rcat
配置 RMAN
show all; //显示RMAN配置
CONFIGURE DEFAULT DEVICE TYPE TO SBT;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; //配置默认设备
配置被冗余策略
CONFIGURE RETENTION POLICY TO REDUNDANCY 3; //配置被冗余度, 如果特定文件的备份次数超过冗余度, 将会将早期备份标记为"废弃"
配置恢复窗口
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; //配置恢复窗口, 如果当前时间与特定备份的备份时间超过恢复窗口值, 在该备份被标记为"废弃"
CONFIGURE RETENTION POLICY TO NONE; //禁止冗余策略
CONFIGURE BACKUP OPTIMIZATION ON; //配置备份优化, 若先前备份已包括相同文件, 则backup 命令会跳过该文件
高级备份选项
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3; //备份多个备份副本
CONFIGURE EXCLUDE FOR TABLESPACE DATA03; //配置免除表空间
RMAN维护命令
RPORT
report schema; //报告数据库方案
report obsolete redundancy 2; //报告废弃备份
report unrecoverable; //报告不可恢复数据文件
report need backup; //报告需备份数据文件
过气
LIST
list backup;
list backupset
list copy;
list archivelog;
list failure;
list expired copy;
list expired backup;
CROSSCHECK
crosscheck backup;
crosscheck copy;
CHANGE
DELETE
delete backup;
delete copy;
delete obsolete; //删除废弃备份
delete expired backup; //删除过期备份
阅读(955) | 评论(0) | 转发(0) |