Bo's Oracle Station

查看: 1795|回复: 0

第17和第18次:2015-07-04星期六上下午

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2015-7-5 09:22:06 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2015-7-5 09:29 编辑

第17和第18次:2015-07-04星期六上下午

  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. startup mount exclusive
  7. EOF

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

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

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

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

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

  22. sleep 3

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


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

  1. select  * from dba_tables t where t.owner='HR' and t.table_name='DEPARTMENTS';

  2. select * from v$datafile;

  3. '+DATA/orcl/datafile/example.265.816169651'

  4. '+DATA/orcl/datafile/example.265.884169393'

  5. select  * from v$rman_configuration;

  6. select  * from dba_tablespaces;

  7. alter tablespace users online;


  8. select  * from dba_data_files;

  9. select  * from v$block_change_tracking;

  10. select   d.FILE# ,
  11.            avg(datafile_blocks),
  12.             avg(blocks_read),
  13.             avg(blocks_read/datafile_blocks) * 100 AS PCT_READ_FOR_BACKUP,
  14.             avg(blocks)
  15.      from v_$backup_datafile   d
  16.    where d.USED_CHANGE_TRACKING= 'YES'
  17.    group by d.FILE#;


  18. select * from V$DATABASE_BLOCK_CORRUPTION;

  19. select  * from v$backup_corruption;

  20. select  * from v$copy_corruption;

  21. select  file#  , d.SECTION_SIZE   from V_$BACKUP_DATAFILE  d ;

  22. select * from v$restore_point;

  23. create restore  point  rsp1 as of scn 884195078;
复制代码

上完1Z0-053第4,5章        (52-12)
回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-22 05:27 , Processed in 0.038856 second(s), 25 queries .

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