您的位置:首页 > 数据库 > Oracle

Oracle常用SQL集锦

2014-03-11 08:55 288 查看
1.创建用户

create user username 

  identified by "12345678"

  default tablespace --表空间

  temporary tablespace --表空间-临时

  profile DEFAULT;

-- Grant/Revoke role privileges 

grant dba to username with admin option;

-- Grant/Revoke system privileges 

grant unlimited tablespace to username with admin option; 

1.循环

begin

 for rec in (select t.telphone ,t.id, t.message,t.name from T_SYS_SMS t where t.telphone like '13688%')

     loop

         DBMS_OUTPUT.put_line(rec.message || 'test ' || rec.name);

     end loop;

end;

修改新增表空间 alter tablespace DZJC add datafile 'E:\oracle\product\10.2.0\oradata\db\dzjc001' size 12048M;

ORA-12505 错误JDBC连不上,PL/SQl连的上的时候,Service_NAME和instance_name

可以通过select intance_name from $instance查询当前的名称。

可能是双击热备份情况,或者ORACLE服务名称和示例不一样的情况。

修改游标大小

 alter system set open_cursors=2000 scope=both;

查找前十条性能差的sql. 

SELECT * FROM (select PARSING_USER_ID,EXECUTIONS,SORTS, 

COMMAND_TYPE,DISK_READS,sql_text FROM v$sqlarea 

order BY disk_reads DESC )where ROWNUM<10 ;

exp p_hai/12345@192.9.207.34/orcl file=d:\haigang_0727.dmp full=n   

exp dz/dz@192.9.207.34/orcl file=d:\dzt.dmp full=n   tables=(DEPT,EMP,BONUS,SALGRADE,T1,T2,T3,T4,T)  query=\"where rownum<=5000\" 

--查询某个父节点下面的所有子节点

select distinct * from T_SYS_MENU m 

 start with id in ('20061115000000001')--父节点ID

 connect by prior id = m.parentid
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: