Oracle坏块修复处理实验

坏块分为物理坏块和逻辑坏块,前者是硬件问题产生,后者是oracle内部数据有问题,本次实验针对后者。

给数据库开启归档模式

[oracle@cancer ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 15 17:09:40 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log lst
SP2-0718: illegal ARCHIVE LOG option
SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     4
Current log sequence           6
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  784998400 bytes
Fixed Size                  2257352 bytes
Variable Size             515903032 bytes
Database Buffers          264241152 bytes
Redo Buffers                2596864 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

1.创建实验所需的表空间、用户、表和相关实验数据

1.1创建相关表空间和用户

--创建一个大小为1m的表空间
create tablespace test
datafile '/u01/oracle/oradata/orcl/test01.dbf' size 1m;
--创建test用户
create user test identified by test default tablespace test temporary tablespace temp profile DEFAULT;
--授予相关的测试权限
grant connect,dba,resource,unlimited tablespace to test;
1.2创建表和模拟数据
SQL> create table test tablespace test as select * from scott.emp;

Table created.

SQL> insert into test select * from test;

14 rows created.

SQL> insert into test select * from test;

28 rows created.

.....

3584 rows created.

SQL> insert into test select * from test;

7168 rows created.

SQL> commit;

Commit complete.

SQL> insert into test select * from test;
insert into test select * from test
*
ERROR at line 1:
ORA-01653: unable to extend table TEST.TEST by 8 in tablespace TEST

SQL> select count(*) from test;


  COUNT(*)
----------
     14336
给表增加索引
SQL> create index idx_test on test(ename);
Index created

切换检查点,将数据写入数据文件

SQL> alter system checkpoint;

System altered.
2.破坏前先用rman备份表空间,得到可以修复的备份
[oracle@cancer ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Oct 15 18:0
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值