-- 查看数据库版本select * from v$versionwhererownum<=1;--=================================================================================BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release11.2.0.4.0 - 64bit Production--=================================================================================col FILE_NAME for a50select file_name from dba_data_files;--=================================================================================FILE_NAME--------------------------------------------------/u01/app/oracle/oradata/orcl/system01.dbf/u01/app/oracle/oradata/orcl/sysaux01.dbf/u01/app/oracle/oradata/orcl/undotbs01.dbf/u01/app/oracle/oradata/orcl/users01.dbf/u01/app/oracle/oradata/orcl/disdb01.dbf--=================================================================================createtablespace cbo datafile'/u01/app/oracle/oradata/orcl/cbo.dbf'size100m autoextendonmaxsize300m uniformsize1m segmentspacemanagementmanual;createuser cbo identifiedby cbo defaulttablespace cbo;grant dba to cbo;
设置多块读参数
col value for a50selectvaluefrom v$parameter wherename='db_file_multiblock_read_count';--=================================================================================VALUE--------------------------------------------------128--=================================================================================altersystemset db_file_multiblock_read_count=16;show parameter db_file_multiblock_read_count--=================================================================================NAMETYPEVALUE------------------------------------ ----------- ------------------------------db_file_multiblock_read_count integer16--=================================================================================
建表并插入数据
-- 设置pctfree 99,一行一个blockconn cbo/cbocreatetable fulltable asselect * from dba_objects where1=0 ;altertable fulltable pctfree 99pctused1;insertinto fulltable select * from dba_objects whererownum<2;altertable fulltable minimize records_per_block;insertinto fulltable select * from dba_objects whererownum<1000;commit;
收集表统计信息
BEGINDBMS_STATS.GATHER_TABLE_STATS(ownname => 'CBO',tabname => 'FULLTABLE',estimate_percent => 100,method_opt => 'for all columns size 1',degree => DBMS_STATS.AUTO_DEGREE,cascade=>TRUE);END;/select owner,blocks from dba_tables where owner='CBO'and table_name='FULLTABLE';--=================================================================================OWNER BLOCKS------------------------------ ----------CBO 1000--=================================================================================