实用oracle

--修改帐号密码
update

alter user mmxiurt_m identified by newpwd replace oldpwd;

--查表
select TABLE_NAME,owner from dba_tables where owner in ('COMMON','MMYY','MMZW')

select * from dba_dependencies t
where owner=upper('common') and referenced_name=upper('pc_ps_yxplan');

--看表的约束名
-- C 代表CHECK(条件约束)和NOT NULL(非空约束)。
-- P 代表PRIMARY KEY(主键约束)
-- R 代表REFERENTIAL INTEGRITY,即FOREIGN KEY(外键约束)
-- U 代表UNIQUE(唯一约束)

--C is for Check
--P is for Primary Key
-- R is for Referential (or Foreign Key)
--U is for Unique
SELECT table_name,constraint_name, constraint_type, r_constraint_name
FROM dba_constraints
WHERE table_name = '&tb_owner'
and owner = '&tb_name';

--查表使用的分区
select TABLE_OWNER,TABLE_NAME,PARTITION_NAME from ALL_TAB_PARTITIONS where table_owner='MMYY' and table_name='SP_WORKF_COMM_HIS';

--SQL 执行计划查看
explain plan for select servnumber,active from mmyy.subscriber where servnumber='13824896655';

execture sql 'select servnumber,active from mmyy.subscriber where servnumber=''13824896655''';
select to_char(SUBSID),REGION,''''||CUSTID from mmyy.cm_subs_subscriber;
between to_date('20070621000000', 'yyyymmddhh24miss') and to_date('20070624235959', 'yyyymmddhh24miss')

--删除重复记录
SQL> delete from a a where a.rowid!=(select max(rowid) from a b where a.bm=b.bm and a.mc=b.mc);


--创建空表
--on commit 表示提交后不清空表
--preserve row 插入记录
create global temporary table tmpx_table on commit preserve rows
as
select * from mmyy.subscriber where 1=1;

--查看删除表的回收空间
show recyclebin

--清掉删除的表的回收空间
purge table 表名
purge recyclebin --清掉所有

set serveroutput on --开output
--存储过程
select * from user_source where name=upper('px_dh_errworkf');
select object_name,status from user_objects where object_name=upper('px_dh_errworkf');

你可能感兴趣的:(oracle)