|
physical-block.sh
- #!/bin/sh
- v_dbname=orcl
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/srvctl stop database -d $v_dbname"
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
- conn / as sysdba
- startup mount exclusive
- EOF
- rm -f /home/oracle/example01.dbf 2>/dev/null
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
- backup as copy datafile 5 format '/home/oracle/example01.dbf';
- EOF
- dd if=/dev/zero of=/home/oracle/example01.dbf bs=8192 count=1 seek=175 conv=notrunc
- 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
- rm -f +data/$v_dbname/DATAFILE/example*
- EOF
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
- run {
- set maxcorrupt for datafile 5 to 1;
- backup as copy datafilecopy '/home/oracle/example01.dbf' format '+data';
- }
- EOF
- sleep 3
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
- delete noprompt datafilecopy '/home/oracle/example01.dbf';
- switch datafile 5 to copy;
- EOF
- su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
- conn / as sysdba
- alter database open;
- 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 ;
|
|