將自己最常用的一些指令碼放上來,這樣方便查詢

jixuewen發表於2007-11-05
常用的指令碼或者檢視,記不住的都放上來。[@more@]

dictionary資料字典檢視
v$fixed_table動態效能表
col A0 format a20; set colsep |
select name,value$ from props$ where name='NLS_CHARACTERSET'
alter session set nls_date_format="MM-DD-YYYY hh24:mi:ss";
sqlldr userid=omcr/a control=loadsysclass.txt data= class.txt
load data infile 'd:car.csv' append into tables jxw fileds terminated by "," (id,go)
exec statspack.snap -生成統計
@$ORACLE_HOME/rdbms/admin/spreport
dba_part_tables
dba_part_indexes查詢索引的情況
cd $ORACLE_BASE/admin/$ORACLE_SID/bdump
對於埠號,需要看$ORACLE_HOME/install/portlist.ini來看。
select tablespace_name, initial_extent from dba_tablespaces
where allocation_type='UNIFORM';
查詢建表的DDL
SELECT DBMS_METADATA.GET_DDL('TABLE','TABLENAME','SCHEMA') FROM DUAL;
v$fixed_view_definition查詢基本表
dba_tab_partitions
alter table xxx drop partition part_xxx update global indexes;
alter index PERFNODEB_INDEX rebuild partition partition_name;
dba_ind_partitions
user_source檢視過程原始碼 常用物件: user_objects; v$bh; dba_dml_locks
execute dbms_logmnr.start_logmnr(DictFileName => 'd:oracledict.ora');
analyze table abc compute statistics;
execute dbms_stats.GATHER_DATABASE_STATS;
sql_trace:
alter session set events '10046 trace name context forever,level 12'
alter session set events '10046 trace name context off';

解釋計劃: @?/rdbms/admin/utlxplp.sql
select * from table(dbms_xplan.display);
dbms_system.set_sql_trace_in_session(sid,serial#,TRUE)
dbms_system.set_sql_trace_in_session(sid,serial#,false)
dbms_session.set_nls('NLS_DATE_LANGUAGE','AMERICAN');
revoke dba from omcr;
grant connect to omcr;
grant RESOURCE to omcr;
grant select_catalog_role to omcr;
grant create any trigger to omcr;
grant administer database trigger to omcr;
oracle的官方文件performance tuning guide and reference
alter session set plsql_warnings='enable:informational'

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

相關文章