设为首页收藏本站

Botang唐波's Oracle Station

查看: 804|回复: 0

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

[复制链接]

719

主题

1081

帖子

7844

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
7844
发表于 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|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-9-18 21:24 , Processed in 0.099515 second(s), 24 queries .

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