oracle常用语句汇总

1,查询 chr(10)回车 chr(13)换行
select * from test where tcd like '%'||chr(10)||'%'
回车替换成空格
select t.tcnm,replace(t.tcnm,chr(10),' ') from t07_nbh_tsdt t
where t.tcnm like '%'||chr(10)||'%'

2,添加分区
alter table t07_transaction add partition PL_6203 tablespace AML_T07;

alter table t64_rule truncate partition PT_6203;

3,分区相关信息查询
select t.partitioned,t.* from all_tables t where t.table_name ='';
select t.pa from user_part_tables where t.table_name =' ';
select substr(t.partition_name,4) ,t.partiton_name from user_tab_partitions t where t.talbe_name='';

4,查询dblink
select * from dba_db_links
select * from aa@to_abc ;
5,杀session
alter system kill sessioin '23,345';
6,创建索引
create index UI_T00_addr on t00_party(addr);
7,添加列
alter table t00_organ add (ip varchar2(15));
8,oracle看懂执行计划
https://www.cnblogs.com/Dreamer-1/p/6076440.html
9,开启执行计划(注意在Pl/sql不行,需要在sqlplus)
set autotrace on;
10,解决autotrace不显示Predicate Information的问题
drop table PLAN_TABLE;
@?/rdbms/admin/utlxplan

你可能感兴趣的:(oracle常用语句汇总)