ORACLE获取表所占用空间大小计算和展示

  1. 脚本:

                SELECT s.segment_name,
                       decode(SUM(BYTES), null, 0, SUM(BYTES) / 1024)
                  FROM DBA_SEGMENTS S, dba_tables t
                 where s.owner = 'you segment owner'
                   and t.owner = 'your table owner'
                   and s.segment_name = t.table_name
                   and s.blocks is not null
                   and s.blocks > 0
                 group by s.segment_name
                having SUM(BYTES) > 0

                其中有些表的大小为表初始大小,尽管数据行为0,也能包含在其中,因为之前的行被删除,高水位线没下来。

                如果要快速计算表大概拥有的行数可以通过DBA_SEGMENTS 中的blocks汇总值和抽样的blocks中的平均行数的乘积来确定。

  2、格式化:

               将查询的数据导入Excel,在Excel2007中对数据表大小格式化显示公式:

              =IF(C15555<1024,CONCATENATE(C15555,"k"),IF((C15555<1024*1024),CONCATENATE(C15555/1024,"M"),IF((C15555<1024*1024*1024),CONCATENATE(C15555/1024/1024,"G"),C15555)))

               其中C15555为表占空间大小,单位为K,在Excel 2003中公式只支持7层函数嵌套。

               如:                


 

posted @ 2008-08-18 15:20 张中健 阅读(179) | 评论 (0)编辑

        

       2008北京奥运男子100M决赛时,解说员在一个一个的介绍,镜头上一个比一个更黑亮的身体。Woo,全是强悍的黑人,没有白种人,没有黄种人......

太强悍了。枪声一响,八匹黑马低头就冲,冲了20米左右个个开始抬头,个个嘴巴大口吸气大口呼气,没过一阵子就冲到一半的赛程;此时一位身穿黄马褂的黑马就像阿干正被欺负他的同学追赶一样象受到刺激使劲向前跑,一下子把后面的人拉下明显的一段,其实白天女子100M跑中一黑人MM也是这样的,不过还是这位显得更为轻松,更自然,姿态看起来更美。此间解说员也只顾着自己看了,等冲到终点时,才听解说员解说他就是博尔特,而且他的主项是200M。马还是黑马好。

posted @ 2008-08-17 18:45 张中健 阅读(153) | 评论 (0)编辑

在计算机报上看到荷兰银行的20个数据中心有大约7pb磁盘和超过20pb的磁带存储,而且每年50%~70%存储量的增长,

于是想看看pb究竟有多大,计算一下27pb大约为 40万个80的硬盘大小。

1Byte = 8 Bit
1 KB = 1,024 Bytes
1 MB = 1,024 KB = 1,048,576 Bytes
1 GB = 1,024 MB = 1,048,576 KB = 1,073,741,824 Bytes
1 TB = 1,024 GB = 1,048,576 MB = 1,073,741,824 KB = 1,099,511,627,776 Bytes
1 PB = 1,024 TB = 1,048,576 GB =1,125,899,906,842,624 Bytes  (13107.2个80G的
1 EB = 1,024 PB = 1,048,576 TB = 1,152,921,504,606,846,976 Bytes
1 ZB = 1,024 EB = 1,180,591,620,717,411,303,424 Bytes
1 YB = 1,024 ZB = 1,208,925,819,614,629,174,706,176 Bytes

posted @ 2008-08-14 10:04 张中健 阅读(292) | 评论 (0)编辑

BCL和FCL

 

BCL:ase Class Library 是CLI的一部分,是CLR的一部分(CLR 是CLI在window平台的一种实现,另外 Rotor和Mono也对CLI进行实现)。

在Professional .Net Framework 2.0 ( .Net Framework 2.0 高级编程)一书中就BCL讲述了基本类型,数组,集合,I/O,文件,网络互连,国际化等主题。

下面是来自Standard ECMA-335 Common Language Infrastructure (CLI) 4th edition (June 2006)的摘录:

http://www.ecma-international.org/publications/standards/Ecma-335.htmECMA-335.pdf


 

5.3 Base Class Library (BCL)
The Base Class Library is part of the Kernel Profile. It is a simple runtime library for modern programming
languages. It serves as the Standard for the runtime library for the language C# as well as one of the CLI
Standard Libraries. It provides types to represent the built-in data types of the CLI, simple file access, custom
attributes, security attributes, string manipulation, formatting, streams, collections, among other things.


 

FCL:不是CLR的一部分,是微软在BCL基础上创建的各种类库,如WinForms, Data等。

 

参考:http://www.thedatafarm.com/blog/PermaLink.aspx?guid=059890a2-fc5f-416a-9b29-7ec411ab4293

 

posted @ 2008-08-06 14:44 张中健 阅读(91) | 评论 (0)编辑

 C#中对象创建的方式

  1. 使用new 创建
  2. 使用对象的MemberwiseClone
  3. 使用工厂方法创建
  4. 使用序列化和反序列化创建
  5. 使用反射创建
  6. 使用类型推导(c# 3.0)

 另外c# 3.0 中增加了一种类型扩展方法。

posted @ 2008-08-05 12:53 张中健 阅读(37) | 评论 (0)编辑
 
一、随时间变化的输出文件:
 
col outputfilename new_value v_filename noprint;
select  to_char(sysdate,'yyyy-mm-ddpmhh24miss')||'UPDATE.LOG' outputfilename from dual;
SPOOL &v_filename;
 
...................
 
SPOOL OFF
 
注: COL的用法使用 help col
 
二、从环境变量中获取值:
 
WINDOWS下:
SQL> spool %OS%.TXT;
Started spooling to C:\Program Files\PLSQL Developer\Windows_NT.TXT
 

 

posted @ 2008-07-02 11:49 张中健 阅读(54) | 评论 (0)编辑