oracle大表怎么评估,oracle查大表

如何判断一个表是大表还是小表 in Oracle

其实随着技术的发展,大表和小表的概念也不停的变化的。

创新互联公司是一家专注于成都网站制作、网站建设、外贸网站建设与策划设计,潮阳网站建设哪家好?创新互联公司做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:潮阳等地区。潮阳做网站价格咨询:18980820575

一般而言,大表的记录数超过100万吧

记录数超过1000万条,为超大表,一般就要分区了,否则性能没办法保证的。

Oracle表空间容量评估

1. 推荐一个使用平均值估算表空间的脚本:

--不适用windows

with t1 as (

select ss.run_time,ts.name,

decode((round(su.tablespace_usedsize*dt.block_size/1024/1024,2)),null,0,(round(su.tablespace_usedsize*dt.block_size/1024/1024,2))) used_size_mb

from

dba_hist_tbspc_space_usage su,

(select trunc(BEGIN_INTERVAL_TIME) run_time,max(snap_id) snap_id from dba_hist_snapshot

group by trunc(BEGIN_INTERVAL_TIME) ) ss,

v$tablespace ts,

dba_tablespaces dt

where su.snap_id = ss.snap_id

and su.tablespace_id = ts.ts#

and ts.name NOT LIKE '%TEMP%'

and ts.name NOT LIKE '%UNDO%'

and ts.name = dt.tablespace_name order by 2,1),

t2 as (

select e.run_time,e.name,e.used_size_mb,e.used_size_mb - b.used_size_mb growth

from t1 e, t1 b

where e.name = b.name and e.run_time = b.run_time +1),

t5 as (select a.TABLESPACE_NAME,

        a.FILE_NAME,

        a.FILE_ID,

        a.BYTES,

        a.AUTOEXTENSIBLE,

        a.ONLINE_STATUS,

        a.MAXBYTES,

        case

          when a.AUTOEXTENSIBLE = 'YES' and

                a.ONLINE_STATUS not in ('OFFLINE', 'SYSOFF') then

            nvl(a.MAXBYTES, 0)

          else

            nvl(a.BYTES, 0)

        end file_max_size

    from dba_data_files a

    where a.tablespace_name NOT LIKE '%TEMP%'

    and a.tablespace_name NOT LIKE '%UNDO%'

    ),

t3 as (

select tsz.tablespace_name,

tsz.alloc_size_mb,ave.avg_growth_per_day_mb,ave.avg_growth_per_day_mb*90 projected_growth_for_3mths_mb

from

(select tablespace_name, round(sum(file_max_size)/1024/1024,2) alloc_size_mb  from t5 group by tablespace_name) tsz,

(select name,decode(round(avg(growth),2),null,0.11,0,0.11, round(avg(growth),2)) avg_growth_per_day_mb from t2 group by name) ave

where tsz.tablespace_name = ave.name),

t6 as (select

d.tablespace_name tablespace_name,

round((d.sumbytes/1024/1024),2) total_g ,

round(decode(f.sumbytes,null,0,f.sumbytes)/1024/1024,2) free,

round(((d.sumbytes-f.sumbytes)/1024/1024),6) size_could_be_used,

round((d.sumbytes-decode(f.sumbytes,null,0,f.sumbytes))*100/d.sumbytes,2) used_pct,

(100-round((d.sumbytes-decode(f.sumbytes,null,0,f.sumbytes))*100/d.sumbytes,2))*round((d.sumbytes/1024/1024),2) real_free

from

(select

  tablespace_name,  sum(bytes) sumbytes

from dba_free_space  group by tablespace_name) f,

(select tablespace_name,      sum(bytes) sumbytes   

  from dba_data_files    group by tablespace_name) d

where f.tablespace_name(+) = d.tablespace_name)

select t4.tablespace_name,decode(t3.alloc_size_mb,null,0,t3.alloc_size_mb) alloc_sz_mb,

--t6.real_free/round(decode(avg_growth_per_day_mb,null,365,0,365,(t3.avg_growth_per_day_mb)),2) Days_To_Be_Used,

((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb  Days_To_Be_Used,

round(t6.size_could_be_used*100/t3.alloc_size_mb,4) used_pct_auto,

t6.used_pct used_pct_real

from t3,t6,

(select a.tablespace_name,

round(a.bytes/1024/1024/1024,2) alloc,

round(c.bytes/1024/1024/1024,2) free

from sys.sm$ts_avail a,

sys.sm$ts_free c

where a.tablespace_name = c.tablespace_name(+)

and a.tablespace_name NOT LIKE '%TEMP%'

and a.tablespace_name NOT LIKE '%UNDO%'

) t4

where t4.tablespace_name = t3.tablespace_name(+)

and t4.tablespace_name = t6.tablespace_name(+)

--and ((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb =30

and ((100-decode(round(t6.size_could_be_used*100/t3.alloc_size_mb,2),null,0,round(t6.size_could_be_used*100/t3.alloc_size_mb,2)))/100*t3.alloc_size_mb)/avg_growth_per_day_mb=0

order by 1;

2. 通过线性回归参数预测未来使用量(待补充):

Oracle如何预估将要创建的索引和表的大小

先预估数据量,然后用数据量乘上总字段长度,可以大致预估出表大小

oracle大表是甚么怎样定义

通常对于小表,Oracle建议通过全表扫描进行数据访问,对于大表则应该通过索引以

Oracle通过一个内部参数_small_table_threshold来定义大表和小表的界限。

电脑电压是怎么回事~!

自考中有拉长线的说法,什么是拉长线?

oracle中亿级大表,怎么进行迁移评估

我们之前有遇到过这样的情况,是采用分表来处理的,有一个实时表,仅存放本月数据(实时增加的),历史数据按月分表存储(每个表数据量大概是一百万到400万),分表命名根据时间设定一定规则(目的是为了能动态查询)


网站标题:oracle大表怎么评估,oracle查大表
路径分享:http://azwzsj.com/article/dsigdep.html