Bo's Oracle Station

查看: 1919|回复: 0

课程第42次:2016-07-01星期五

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-7-2 16:42:30 | 显示全部楼层 |阅读模式
课程第42次:2016-07-01星期五:
select  p.spid
from v_$session s, v_$process p
where s.PADDR=p.ADDR and s.TERMINAL='pts/12';

select  * from v$backup_corruption;

select  * from v$copy_corruption;

select  * from v$database_block_corruption;

---
select  * from v$database_block_corruption;

select * from v$backup_corruption;


physical-block.sh:
  1. #!/bin/sh
  2. v_dbname=orcl
  3. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/srvctl stop database -d $v_dbname"
  4. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  5. conn / as sysdba
  6. shutdown abort
  7. startup mount exclusive
  8. EOF

  9. rm -f /home/oracle/example01.dbf 2>/dev/null

  10. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  11. backup as copy datafile 5 format '/home/oracle/example01.dbf';
  12. EOF

  13. dd if=/dev/zero of=/home/oracle/example01.dbf bs=8192 count=1 seek=175 conv=notrunc

  14. su - oracle -c "export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/grid ; export ORACLE_SID=+ASM ; /u01/app/oracle/product/11.2.0.3/grid/bin/asmcmd" <<EOF
  15. rm -f +data/$v_dbname/DATAFILE/example*
  16. EOF

  17. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  18. run {
  19. set maxcorrupt for datafile 5 to 1;
  20. backup as copy  datafilecopy '/home/oracle/example01.dbf' format '+data';
  21. }
  22. EOF

  23. sleep 3

  24. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  25. delete noprompt datafilecopy '/home/oracle/example01.dbf';
  26. switch datafile 5 to copy;
  27. EOF


  28. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  29. conn / as sysdba
  30. alter database open;
  31. EOF
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 02:54 , Processed in 0.032333 second(s), 25 queries .

快速回复 返回顶部 返回列表