Bo's Oracle Station

查看: 2289|回复: 0

第56次:2015-05-28星期四

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2015-5-29 09:38:27 | 显示全部楼层 |阅读模式
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. 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
复制代码

逻辑坏块:

Recovery Manager complete.
[oracle@station90 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 28 21:31:11 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> create tablespace tbslogical  datafile size 10M nologging;

Tablespace created.

SQL> conn hr/oracle_4U
ERROR:
ORA-28002: the password will expire within 7 days


Connected.
SQL> create table tlogical( a  number , b varchar(20))   tablespace tbslogical;

Table created.

SQL> create index ilogical_a on tlogical(a) ;

Index created.

SQL> create index ilogical_b on tlogical(b) ;

Index created.

SQL> insert into tlogical values ( 23255,'logical block');

1 row created.

SQL> commit;

Commit complete.

SQL>
备份

insert /*+ append */ into tlogical select * from tlogical ;


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-26 20:22 , Processed in 0.104961 second(s), 24 queries .

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