表空间的扩展_表空间自动扩展

2020-02-27 其他范文 下载本文

表空间的扩展由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“表空间自动扩展”。

表空间扩展说明

17:58:05 执行SQL语句异常!

insert into DC_FILE_REC(file_log_id,link_id,source_path,source_file,dcm_file_id,switch_id,exchange_id,fi)17:58:05 SQL异常信息 :

java.sql.SQLException: ORA-01654: unable to extend index DICDCM.IDX_FILE_REC4 by 1024 in tablespace DICDCMX

17:58:05 free database connector!17:58:05 分发链路 : tuoji-etsmet-c : 写文件分发日志表异常 : /bill2/met/bjets/data/USRMETER1H 17:58:05 create database connector!用户:system 密码:manager 从后台进入sql操作

#sqlplus ‘/ as sysdba’输入用户名密码即可

1、SQL> desc dba_segments;Name

Type

Nullable Default Comments

OWNER

VARCHAR2(30)Y

Username of the segment owner

PARTITION_NAME VARCHAR2(30)Y

Partition/Subpartition Name, if any, of the segment

SEGMENT_TYPE

VARCHAR2(18)Y

Type of segment: “TABLE”, “CLUSTER”, “INDEX”, “ROLLBACK”, “DEFERRED ROLLBACK”, “TEMPORARY”,“SPACE HEADER”, “TYPE2 UNDO” or “CACHE” SEGMENT_NAME

VARCHAR2(81)Y

Name, if any, of the segment

TABLESPACE_NAME VARCHAR2(30)Y

Name of the tablespace containing the segment

HEADER_BLOCK

NUMBER

Y

ID of the block containing the segment header

BYTES

NUMBER

Y

Size, in bytes, of the segment

EXTENTS

NUMBER

Y

Number of extents allocated to the segment

NEXT_EXTENT

NUMBER

Y

Size, in bytes, of the next extent to be allocated to the segment

MIN_EXTENTS

NUMBER

Y

Minimum number of extents allowed in the segment

MAX_EXTENTS

NUMBER

Y

Maximum number of extents allowed in the segment

PCT_INCREASE

NUMBER

Y

Percent by which to increase the size of the next extent to be allocated

FREELISTS

NUMBER

Y

Number of proce freelists allocated in this segment

HEADER_FILE

NUMBER

Y

ID of the file containing the segment header

BLOCKS

NUMBER

Y

Size, in Oracle blocks, of the segment

INITIAL_EXTENT NUMBER

Y

Size, in bytes, of the initial extent of the segment

FREELIST_GROUPS NUMBER

Y

Number of freelist groups allocated in this segment

RELATIVE_FNO

NUMBER

Y

Relative number of the file containing the segment header

BUFFER_POOL

VARCHAR2(7)Y

The default buffer pool to be used for segments blocks2、根据segment_name查询表空间的名称

SQL> select segment_name,tablespace_name from dba_segments where segment_name='DC_FILE_REC';SEGMENT_NAME

TABLESPACE_NAME------------------------------------------------DC_FILE_REC

DICDCM_DEFAULT3、根据表空间的名字从表dba_data_files中查表空间的文件名: SQL> select

file_name

from

dba_data_files

where tablespace_name='DICDCM_DEFAULT';FILE_NAME------------------/oradata/ora9/dicdcm_default_1.dbf /oradata/ora9/dicdcm_default_2.dbf /oradata/ora9/dicdcm_default_3.dbf /oradata/ora9/dicdcm_default_4.dbf4、扩展指定的表空间大小 SQL> alter tablespace

DICDCM_DEFAULT

add

datafile '/oradata/ora9/dicdcm_default_5.dbf' size 1000m;Tablespace altered5、查看所有的表空间名称

SQL> select tablespace_name from dba_tablespaces;TABLESPACE_NAME------------------------------SYSTEM UNDOTBS1 TEMP DRSYS INDX TOOLS USERS DICDCM_TBS1 DICDCM_TBS2 DICDCM_TBS3 DICDCM_TBS4 DICDCM_TBS5 DICDCM_TBS6 DICDCM_DEFAULT DICDCM_IDX DICDCM_TEMP rows selected6、根据segment_name从表dba_segments中查询表空间名称 SQL> select segment_name,tablespace_name from dba_segments where segment_name='IDX_FILE_REC4';SEGMENT_NAME

TABLESPACE_NAME------------------------------------------------IDX_FILE_REC4

DICDCM_IDX7、根据表空间的名字从表dba_data_files中查表空间的文件名: SQL> select

file_name

from

dba_data_files

where tablespace_name='DICDCM_IDX';FILE_NAME------------------/oradata/ora9/dicdcm_idx_1.dbf /oradata/ora9/dicdcm_idx_2.dbf /oradata/ora9/dicdcm_idx_3.dbf /oradata/ora9/dicdcm_idx_4.dbf8、扩展指定的表空间大小 SQL> alter

tablespace

DICDCM_IDX

add

datafile '/oradata/ora9/dicdcm_idx_5.dbf' size 1024m;Tablespace altered

扩展dicdcm_temp表空间的大小

他的作用:用来排序、生成中间的一些结果等等。(比如SQL里面使用GROUP BY / ORDER BY等语句,先用PGA的内存去排序,当内存不够了,就需要使用到临时表空间)。临时表空间在OEM里面看不够了,但是可能还是有的。

v$sort_segment试图里面有说明,可以看到每个临时表空间使用了多少,还有多少;只有v$sort_segment里面的free_blocks没有了,才需要扩(select FREE_BLOCKS from v$sort_segment where TABLESPACE_NAME='DICDCM_TEMP')SQL>alter temporary

tablespace

dicdcm_temp

add

tempfile '/oradata/ora9/dic_temp_2.dbf' size 1024m;

数据库表空间使用情况监控(字典管理表空间)

数据库运行了一段时间后,由于不断的在表空间上创建和删除对象,会在表空间上产生大量的碎片,DBA应该及时了解表空间的碎片和可用空间情况,以决定是否要对碎片进行整理或为表空间增加数据文件。

select tablespace_name, count(*)chunks , max(bytes/1024/1024)max_chunk from dba_free_space group by tablespace_name;上面的SQL列出了数据库中每个表空间的空闲块情况,如下所示: TABLESPACE_NAME CHUNKS MAX_CHUNK----------------------------------------INDX 1 57.9921875 RBS 3 490.992188 RMAN_TS 1 16.515625 SYSTEM 1 207.296875 TEMP 20 70.8046875 TOOLS 1 11.8359375 USERS 67 71.3671875 其中,CHUNKS列表示表空间中有多少可用的空闲块(每个空闲块是由一些连续的Oracle数据块组成),如果这样的空闲块过多,比如平均到每个数据文件上超过了100个,那么该表空间的碎片状况就比较严重了,可以尝试用以下的SQL命令进行表空间相邻碎片的接合:

alter tablespace 表空间名 coalesce;然后再执行查看表空间碎片的SQL语句,看表空间的碎片有没有减少。如果没有效果,并且表空间的碎片已经严重影响到了数据库的运行,则考虑对该表空间进行重建。

MAX_CHUNK列的结果是表空间上最大的可用块大小,如果该表空间上的对象所需分配的空间(NEXT值)大于可用块的大小的话,就会提示ORA-1652、ORA-1653、ORA-1654的错误信息,DBA应该及时对表空间的空间进行扩充,以避免这些错误发生。

对表空间的扩充对表空间的数据文件大小进行扩展,或向表空间增加数据文件,具体操作见“存储管理”部份。

查看表空间利用率 select

fs.tablespace_name “表空间名”,(df.totalspacefs.freespace)/df.totalspace),2)||' %' “已使用百分比”, round(100*(1-(df.totalspace-fs.freespace)/df.totalspace),2)||' %' “剩余百分比” from

(select tablespace_name,round(sum(bytes)/1048576)Totalspace from dba_data_files group by tablespace_name)df,(select tablespace_name,round(sum(bytes)/1048576)Freespace from dba_free_space group by tablespace_name)fs where

df.tablespace_name = fs.tablespace_name;

《表空间的扩展.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
表空间的扩展
点击下载文档
相关专题 表空间自动扩展 空间 表空间自动扩展 空间
[其他范文]相关推荐
    [其他范文]热门文章
      下载全文