show sga;
查看服务进程
select * from v$bgprocess
select * from v$controlfile
select * from v$datafile
select * from v$logfile
orcale 使用内存是以“块”为单位的
show parameter db
show parameter shared
show parameter db_catch
show parameter log
动态修改内存缓冲大小 9i后的新功能
alert system set db_catch_size = 64m;
alert system set shared_pool_size =
dictionary catch = row catch
select * from authors
db_catch_advice是系统对内存大小设置的一个建议
alert system set db_catch_advice = on;.
alert system set large_pool_size=20m
alert system set java_pool_size=*
fuction: 函数可以嵌套
单行
多行
字符,数字,日期,转换,通用
字符:
lower,upper,initcap
concat(联接),substr(+/-,1,4),length,instr,lpad/rpad(左/右填充),trim,replace
数字:
round(45.2342,3)(四舍五入的),trunc(23.123123,2)(截取),mod(1600,300)-->100
日期: +-×/都可用
months_between,add_months,next_day,last_day,round,trunc
data,time,sysdate-系统时间
转换:
Implicit date type conversion &&&&&&&&&& Explicit date type conversion
to_number,to_char,to_date
通用:
nvl(1,2),nvl2(1,2,3),nullif(1,2)(是否相等,如果是,填充空值,coal
case expr when ***_*1 then return **_*1
[expr when ***_*2 then return **_*2]
else
end
decode
join
select t1.id,t1.name from t1,t2 where t1.id(+)=t2.id
select t1.id,t1.name from t1,t2 where t1.id=t2.id(+)
(
select sum(org_id) from sys_user group by org_id
select substr(create_datetime,1,5) from sys_user
select substr(user_code,-1,10) from sys_user
select lower(user_code),upper(user_code),initcap(user_code) from sys_user
select user_code||''||user_name from sys_user
select concat (user_code,user_name)from sys_user
SELECT length(user_code) from sys_user
select instr(user_code,'S') from sys_user
select lpad(user_code,10,'_')from sys_user
select rpad(user_code,10,'_')from sys_user
select trim('S' from user_code) from sys_user
select last_day(create_datetime) from sys_user
select a.org_code ,a.org_name,b.user_code
from sys_organization a
join sys_user b
on a.QE_ID=b.org_id
select user_code,org_id from sys_user group by org_id, user_code having org_id>10
)
子查询时,不可以使用ORDER BY 语句
返回多行时,用IN , ANY , ALL 来处理
数据操作语句:
增加新行
修改已经存在的行
删除已经存在的行
rename tts to tt2;
truncate table tts; ddl语句,不做记录。
delete table tts;dml语句,记录。
comment on table id is 'this is a table ID';
ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMETNS
//创建用户,并赋予权限
create user qqqq
identified qqqq
--
grant create session
【
create table,create sequesce,create view
】
to qqqq
create role testrole1;
grant create table,create session to testrole1; --系统的
grant select on tt1 to testrole1;--用户级的
grant testrole1 to qqqq;
owner do: --受于用户权限,同时允许它受于第三个人
grant select sales
to system
with grant option;
撤消:
revoke select
on kong.sales
from kxf
【CASCADE CONSTRAINTS】
UNION / UNION ALL 区别
select qe_id from sys_user where qe_id >100
intersect(交集) minus(减)
select qe_id from sys_user where qe_id <400
select extract(year from create_datetime) from sys_user
超级结果聚合:
ROLLUP和CUBE 和grouping() function 0 or 1
GROUPING SETS