日期:2014-05-16  浏览次数:20541 次

用SQL语言管理Oracle数据库

1,查看数据库的基本属性:
SELECT dbid 数据库编号,name 数据库名称,db_unique_name 全局名称,created 创建时间,log_mode 归档方式,open_mode 访问方式,platform_name 版本类型 FROM v$database;

2,查看所有数据库对象的类别和大小:
SELECT count(name) num_instances,type,sum(source_size) source_size,sum(parsed_size) parsed_size,sum(code_size) code_size,
sum(error_size) error_size, sum(source_size) +sum(parsed_size) +sum(code_size) +sum(error_size) size_required FROM dba_object_size GROUP BY type ORDER BY 2;

NUM_INSTANCES TYPE                       SOURCE_SIZE PARSED_SIZE  CODE_SIZE ERROR_SIZE SIZE_REQUIRED
------------- -------------------------- ----------- ----------- ---------- ---------- -------------
          264 FUNCTION                         90226      163614     286766          0        540606
        16417 JAVA CLASS                           0           0   79741994          0      79741994
          306 JAVA DATA                            0           0    9061460          0       9061460
          770 JAVA RESOURCE                        0           0   10738795          0      10738795
          843 PACKAGE                        5570226     5597328    2593462          0      13761016
          787 PACKAGE BODY                  16979979           0   20748156          0      37728135
           83 PROCEDURE                       195788       80300     266716          0        542804
           77 SEQUENCE                             0       21269          0          0     &n