十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1.验证备份是否可以被成功还原,完全还原确定需应用哪些备份集和归档日志。
2.检查用于恢复数据库的的最新备份集,以确认备份是否完整,检查恢复所需要的数据文件副本和归档日志备份集。
RMAN> restore database validate; Starting restore at 07-OCT-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting validation of datafile backup set channel ORA_DISK_2: starting validation of datafile backup set channel ORA_DISK_1: reading from backup piece /home/oracle/backup/data_50qiv187_1_1.bak channel ORA_DISK_2: reading from backup piece /home/oracle/backup/data_51qiv187_1_1.bak channel ORA_DISK_1: piece handle=/home/oracle/backup/data_50qiv187_1_1.bak tag=DB0 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: reading from backup piece /home/oracle/backup/data_50qiv187_2_1.bak channel ORA_DISK_2: piece handle=/home/oracle/backup/data_51qiv187_1_1.bak tag=DB0 channel ORA_DISK_2: restored backup piece 1 channel ORA_DISK_2: reading from backup piece /home/oracle/backup/data_51qiv187_2_1.bak channel ORA_DISK_2: piece handle=/home/oracle/backup/data_51qiv187_2_1.bak tag=DB0 channel ORA_DISK_2: restored backup piece 2 channel ORA_DISK_2: reading from backup piece /home/oracle/backup/data_51qiv187_3_1.bak channel ORA_DISK_1: piece handle=/home/oracle/backup/data_50qiv187_2_1.bak tag=DB0 channel ORA_DISK_1: restored backup piece 2 channel ORA_DISK_1: reading from backup piece /home/oracle/backup/data_50qiv187_3_1.bak channel ORA_DISK_2: piece handle=/home/oracle/backup/data_51qiv187_3_1.bak tag=DB0 channel ORA_DISK_2: restored backup piece 3 channel ORA_DISK_2: reading from backup piece /home/oracle/backup/data_51qiv187_4_1.bak channel ORA_DISK_1: piece handle=/home/oracle/backup/data_50qiv187_3_1.bak tag=DB0 channel ORA_DISK_1: restored backup piece 3 channel ORA_DISK_1: validation complete, elapsed time: 00:01:03 channel ORA_DISK_2: piece handle=/home/oracle/backup/data_51qiv187_4_1.bak tag=DB0 channel ORA_DISK_2: restored backup piece 4 channel ORA_DISK_2: validation complete, elapsed time: 00:01:12 Finished restore at 07-OCT-153.校验数据文件的是否存在坏块:
RMAN> backup check logical validate database; Starting backup at 07-OCT-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=+DATA/phub/datafile/llc01.dbf input datafile file number=00005 name=+DATA/phub/datafile/example.287.891340843 input datafile file number=00003 name=+DATA/phub/datafile/undotbs1.260.891340857 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00007 name=+DATA/phub/datafile/idx01.dbf input datafile file number=00002 name=+DATA/phub/datafile/sysaux.272.891340857 input datafile file number=00001 name=+DATA/phub/datafile/system.271.891340857 input datafile file number=00004 name=+DATA/phub/datafile/users.269.891340843 channel ORA_DISK_2: backup set complete, elapsed time: 00:00:55 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 14660 98639 3880208 File Name: +DATA/phub/datafile/system.271.891340857 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 65879 Index 0 13480 Other 0 4541 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 2 OK 0 23933 120381 3880206 File Name: +DATA/phub/datafile/sysaux.272.891340857 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 35531 Index 0 30258 Other 0 30598 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 4 OK 0 4478 87390 3006034 File Name: +DATA/phub/datafile/users.269.891340843 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 81242 Index 0 730 Other 0 910 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 7 OK 0 98073 131072 3010614 File Name: +DATA/phub/datafile/idx01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 32360 Other 0 639 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- Control File OK 0 646 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:59 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 3 OK 0 1 18560 3880208 File Name: +DATA/phub/datafile/undotbs1.260.891340857 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 18559 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 5 OK 2192 31371 44325 3819558 File Name: +DATA/phub/datafile/example.287.891340843 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 4394 Index 0 1149 Other 0 7406 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 6 OK 0 166327 393216 3015852 File Name: +DATA/phub/datafile/llc01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 192240 Index 0 32080 Other 0 2569 Finished backup at 07-OCT-154.校验单个数据文件:
RMAN> backup check logical validate datafile 1; Starting backup at 07-OCT-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=+DATA/phub/datafile/system.271.891340857 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- Control File OK 0 646 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 14660 98639 3880343 File Name: +DATA/phub/datafile/system.271.891340857 Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 65879 Index 0 13480 Other 0 4541 Finished backup at 07-OCT-155.备份进度查询:
select case when opname like '%aggregate%' then 'total' else opname end opname, trunc(sofar * 100 / totalwork, 2) || '%' progress, units from v$session_longops where opname like 'RMAN%' and totalwork > sofar;OPNAME PROGRESS UNITS ------------------------------------------------------------ ----------------------------------------- -------------------------------- RMAN: incremental datafile backup 62.28% Blocks total 0% Blocks RMAN: incremental datafile backup 75.47% Blocks6.恢复进度查询:
SELECT sid, serial#, CONTEXT, sofar, totalwork, round(sofar / totalwork * 100, 2) "% Complete" FROM v$session_longops WHERE opname LIKE 'RMAN:%' AND opname NOT LIKE 'RMAN: aggregate%'; SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete ---------- ---------- ---------- ---------- ---------- ---------- 8 5 1 329181437312 75.27 192 31 1 281220456096 61.66恢复完成:
SELECT sid, serial#, CONTEXT, sofar, totalwork, round(sofar / totalwork * 100, 2) "% Complete" FROM v$session_longops WHERE opname LIKE 'RMAN:%' 9 AND opname NOT LIKE 'RMAN: aggregate%'; SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete ---------- ---------- ---------- ---------- ---------- ---------- 8 5 1 437312437312 100 192 31 1 456096456096 100简单备份脚本:
run { allocate channel C1 device type disk maxpiecesize=51200M; allocate channel C2 device type disk maxpiecesize=51200M; sql 'alter system switch logfile'; crosscheck archivelog all; delete noprompt expired archivelog all; delete noprompt archivelog until time 'sysdate-15'; backup incremental level=0 tag='db0' as compressed backupset database include current controlfile format '/back/level0/df_%U.bak'; release channel C1; release channel C2; crosscheck backup; delete noprompt obsolete; delete noprompt expired backup; }另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。