《ORACLE 9i/10g/11g程式設計藝術》學習筆記 配置環境

gogoair發表於2013-11-17
sqlplus引數設定:
一般可以用glogin.sql檔案,位於$ORACLE_HOME\SQLPLUS\ADMIN 目錄下。
也可以使用login.sql檔案,但必須從該檔案所在目錄內啟動SQL*PLUS才有效

define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 700 --行寬
set pagesize 9999 
column plan_plus_exp format a80
column global_name new_value gname
set termout off
define gname=idle
column global_name new_value gname
select lower(user) || '@' || substr( global_name, 1, decode( dot, 0, length(global_name), dot-1) ) global_name
  from (select global_name, instr(global_name,'.') dot from global_name );
set sqlprompt '&gname> '
set termout on

設定autotrace:
cd $ORACLE_HOME/rdbms/admin
以sys執行utlxplan.sql;
執行create public synonym plan_table for plan_table;
執行grant all on plan_table to public;

cd $ORACLE_HOME/sqlplus/admin;
以sys執行plustrce.sql;
執行grant plustrace to public;

set autotrace off;
set autotrace on;
set autotrace on explain;
set autotrace on statistics;
set autotrace traceonly;

配置Statspack:
以sysdba執行$ORACLE_HOME\rdbms\admin\spcreate.sql
回滾指令碼:spdrop.sql,安裝日誌:spcpkg.lis 

runstats指令碼:
exec runStats_pkg.rs_start;
 insert into t1 select * from big_table where rownum <= 1000000;commit;
exec runStats_pkg.rs_middle;
begin for x in (select * from big_table where rownum<=1000000) loop insert into t2 values x; end loop; commit; end;
/
exec runStats_pkg.rs_stop;

mystat檢視redo位元組數:
 @mystat "redo size"
update big_table set owner =  lower(owner) where rownum <= 1000;
@mystat2

show_space用於列印資料庫段的空間利用率:
exec show_space('BIG_TABLE');


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29260211/viewspace-776774/,如需轉載,請註明出處,否則將追究法律責任。

相關文章