1.压缩存储数据时,create table 加上COMPRESS选项,向表插入数据时,要排序插入,这样相同数据就存放一次,节约空间提高I/O效率。弊端,经常UPDATE的话会影响DML性能
2.表字段的unused和查看
- alter table t1 set unused column column_name
- select obj#,col#,name from sys.col$
- where obj# = 'select object_id from dba_objects where object_name = 'T1';
- alter table t1 drop unused columns;
3.使用UTL_FILE包导出表为文本,适用大表导出
- declare
- v_file utl_file.file_type;
- begin
- v_file:=utl_file.fopen('/u01','output.txt','w');
- utl_file.putf(v_file,'output date: %s\n',sysdate);
- utl_file.new_line(v_file);
- for i in(select * from scott.t1) loop
- utl_file.putf(v_file,'%s,%s,%s\n',i.ename,i.empno,i.sal);
- end loop;
- utl_file.fclose(v_file);
- end;
- /
4. v$transaction 跟 v$session 使用v$transaction.addr = v$session.taddr关联