Oracle表空间规划处理

配置:

操作系统:Windowns2000Server(Sp4,安装目录:C:\Winnt)

数据库系统:Oracle8.1.7(安装目录:C:\Oracle)

硬盘:5块SCSI硬盘(分C、D、E、F、G五个盘符)

应用系统:大型Erp系统(安装目录:C:\Erp)

 

一、前提:

Oracle安装完毕之后,Erp系统安装之前,应对表空间作一个有效的规划,以免系统在运行之时,出现数据库不协调问题。

二、前提:

Oracle安装完毕之后,应用系统安装之前,应对表空间作一个有效的规划,以免系统在运行之时,出现数据库不协调问题。

三、原因:

Oracle安装之后,会自动生成一些表空间及回滚段,对于一套大型的Erp系统来讲,Oracle自身的设置肯定是不能满足的,所以要对逻辑结构和物理结构作一个有效的对应规划。

四、方案:

建立一些大的数据表空间,包括数据表空间、索引表空间、回滚表空间和临时表空间,同时根据Erp系统的访问量,确定要建立多少个回滚段。同时,表空间应该尽量建立在不同的物理磁盘上,以减少用户之间的I/O竞争。

五、规划:

C盘:NT系统、Oralce系统、Erp系统。

D盘:用户表空间1(3G、自动扩展) 回滚表空间1(1G、自动扩展)

E盘:用户表空间2(3G、自动扩展) 回滚表空间2(1G、自动扩展)

F盘:索引表空间1(2G、自动扩展) 临时表空间1(0.5G、不自动扩展)

G盘:索引表空间2(2G、自动扩展) 临时表空间2(0.5G、不自动扩展)

 

六、实现过程:

  • 查看系统有哪些回滚段、存放在哪些表空间上:

C:\>sqlplus internal/oracle

SQL>Col owner format a10

SQL>Col segment_name format a20

SQL>Col tablespace_name format a20

SQL>Selectowner,segment_name,tablespace_name,sum(bytes)/1024/1024 M

2 from  dba_segments

3 wheresegment_type = ‘ROLLBACK’#此处的segment_type值一定要大小

4 group byowner,segment_name,tablespace_name;

 

OWNER      SEGMENT_NAME         TABLESPACE_NAME             M

------------------------------ -------------------- ----------

SYS        RBS0                 RBS                           4

SYS        RBS1                 RBS                           4

SYS        RBS2                 RBS                           4

SYS        RBS3                 RBS                           4

SYS        RBS4                 RBS                           4

SYS        RBS5                 RBS                           4

SYS        RBS6                 RBS                           4

SYS        SYSTEM               SYSTEM                  .390625

 

已选择8行。

 

 

  • 查看回滚段的状态

 SQL>Selectsegment_id,segment_name,tablespace_name,owner,owner,file_id,status

2 fromdba_rollback_segs;

 

SEGMENT_IDSEGMENT_NA TABLESPACE OWNER        FILE_ID STATUS

-------------------- ---------- ---------- ---------- ----------

##########SYSTEM     SYSTEM     SYS       ########## ONLINE

##########RBS0       RBS        PUBLIC     ########## ONLINE

##########RBS1       RBS        PUBLIC    ########## ONLINE

##########RBS2       RBS        PUBLIC     ########## ONLINE

##########RBS3       RBS        PUBLIC     ########## ONLINE

##########RBS4       RBS        PUBLIC     ########## ONLINE

##########RBS5       RBS        PUBLIC     ########## ONLINE

##########RBS6       RBS        PUBLIC     ########## ONLINE

 

已选择8行。

 

  • 由此可以看出,Oracle系统自身的回滚空间是蛮小的,现在作如下修改:

²  使原有回滚段下线,即失效:

alter rollback segment rbs0 offline;

alter rollback segment rbs1 offline;

alter rollback segment rbs2 offline;

alter rollback segment rbs3 offline;

alter rollback segment rbs4 offline;

alter rollback segment rbs5 offline;

alter rollback segment rbs6 offline;

²  删除原有回滚段,以便重新建立:

drop rollback segment rbs0;

drop rollback segment rbs1;

drop rollback segment rbs2;

drop rollback segment rbs3;

drop rollback segment rbs4;

drop rollback segment rbs5;

drop rollback segment rbs6;

²  建立数据表空间(在各个硬盘上预先手工建好Oradata目录);

u  创建用户表空间1:

create tablespace user1 logging datafile

  ‘d:\oradata\user1_1.ora’size 512M,

‘d:\oradata\user1_2.ora’size 512M,

‘d:\oradata\user1_3.ora’size 512M,

‘d:\oradata\user1_4.ora’size 512M,

‘d:\oradata\user1_5.ora’size 512M,

‘d:\oradata\user1_6.ora’size 512M

autoentend on next 5M maxsize unlimited

default storage(initial 128k next 2M pctincrease 0);

 

u  创建回滚表空间1:

create tablespace roll1 logging datafile

 ‘d:\oradata\roll1_1.ora’size512M,

‘d:\oradata\roll1_2.ora’size 512M

autoextend on next 5M maxsize unlimited

default storage(initial 40M next 5M pctincrease 0);

 

u  创建用户表空间2:

create tablespace user2 logging datafile

‘e:\oradata\user2_1.ora’szie 512M,

‘e:\oradata\user2_2.ora’szie 512M,

‘e:\oradata\user2_2.ora’szie 512M,

‘e:\oradata\user2_2.ora’szie 512M,

‘e:\oradata\user2_2.ora’szie 512M,

‘e:\oradata\user2_2.ora’szie 512M

autoextend on next 5M maxsize unlimited

default storage(initial 128k next 2M pctincrease 0);

 

u  创建回滚表空间2:

create tablespace roll2 logging datafile

‘e:\oradata\roll2_1.ora’size 512M,

‘e:\oradata\roll2_2.ora’size 512M

autoextend on next 5M maxsize unlimited

default storage(initial 40M next 5M pctincrease 0);

 

u  创建索引表空间1:

create tablespace index1 logging datafile

‘f:\oradata\oradb\index1_1.ora’ size 512M,

‘f:\oradata\oradb\index1_2.ora’ size 512M,

‘f:\oradata\oradb\index1_3.ora’ size 512M,

‘f:\oradata\oradb\index1_4.ora’ size 512M

autoextend on next 5M maxsize unlimited

default storage(initial 128K next 5M pctincrease 0);

 

u  创建临时表空间1:

create tablespace temp1 logging datafile

‘f:\oradata\oradb\temp1_1.ora’ size 512M

default storage(initial 10M next 3M pctincrease 0)

temporary;

 

u  创建索引表空间2:

create tablespace index1 logging datafile

‘g:\oradata\oradb\index2_1.ora’ size 512M,

‘g:\oradata\oradb\index2_2.ora’ size 512M,

‘g:\oradata\oradb\index2_3.ora’ size 512M,

‘g:\oradata\oradb\index2_4.ora’ size 512M

autoextend on next 5M maxsize unlimited

default storage(initial 128K next 5M pctincrease 0);

 

u  创建临时表空间2:

create tablespace temp1 logging datafile

‘g:\oradata\oradb\temp2_1.ora’ size 512M

default storage(initial 10M next 3M pctincrease 0)

temporary;

 

²  在两个回滚表空间中,分别创建回滚段,并使其上线(即有效):

create public rollback segment rbs0 tablespace roll1;

create public rollback segment rbs1 tablespace roll1;

create public rollback segment rbs2 tablespace roll1;

create public rollback segment rbs3 tablespace roll1;

create public rollback segment rbs4 tablespace roll1;

create public rollback segment rbs5 tablespace roll1;

create public rollback segment rbs6 tablespace roll2;

create public rollback segment rbs7 tablespace roll2;

create public rollback segment rbs8 tablespace roll2;

create public rollback segment rbs9 tablespace roll2;

create public rollback segment rbs10 tablespace roll2;

create public rollback segment rbs11 tablespace roll2;  

 

alter rollback segment rbs0 online;

alter rollback segment rbs1 online;

alter rollback segment rbs2 online;

alter rollback segment rbs3 online;

alter rollback segment rbs4 online;

alter rollback segment rbs5 online;

alter rollback segment rbs6 online;

alter rollback segment rbs7 online;

alter rollback segment rbs8 online;

alter rollback segment rbs9 online;

alter rollback segment rbs10 online;

alter rollback segment rbs11 online;

你可能感兴趣的:(Oracle表空间规划处理)