- 浏览: 7170 次
- 性别:
- 来自: 杭州
-
最新评论
文章列表
查v$access视图
select * from v$access where owner='过程的所属用户' and name='刚才查到的过程名'
3.查出sid和serial#
查v$session视图
select sid,serial#,paddr from v$session where sid='刚才查到的sid';
杀死session 报: ora-00031:标记要终止的会话 。
按照以下处理:杀死线程。
select spid, osuser, s.program
from v$session s, v$process p
where s.paddr = p. ...
HSTA 用户名 ;tprofitdealcurrentdetails 为需要收集得表名
begin
dbms_stats.gather_table_stats(ownname => 'HSTA',tabname => 'tprofitdealcurrentdetails',estimate_percent => 10,method_opt=> 'for all indexed columns');
end;
--oracle 函数round 是用于四舍五入, 格式:TRUNC(data[,fmt])
--oracle 函数TRUNC 是用于截位, 格式:TRUNC(data[,fmt])
--Oracle trunc()函数的用法
/**************日期********************/
/*1.*/select trunc(sysdate) from dual; --2016/3/3 今天的日期为2016/3/3
/*2.*/select trunc(sysdate, 'mm') from dual ; --2016/3/1 返回当月 ...
查oracle中表字段信息
- 博客分类:
- oracle
--查表所在空间,
select table_name,tablespace_name,temporary from user_tables where table_name='TFUNDINFO';
--查表字段明细信息
select column_name,data_type ,data_length from user_tab_columns where table_name='TFUNDINFO';
Oracle
- 博客分类:
- 表结构-添加,删除字段
添加字段的语法:alter table tablename add (column datatype [default value][null/not null],….);
修改字段的语法:alter table tablename modify (column datatype [default value][null/not null],….);
删除字段的语法:alter table tablename drop (column);
--举例:
--创建表
create table test1
(id varchar2(20) not null);
--添加字段
alter tabl ...
oracle 一些不常用的函数
函数: lpad(a,b,c)
参数: a : 字符 , b : 补成几位 ,c : 补的东西
功能: 左侧补字符。
举例: select lpad('6',2,0) from dual;
结果: “06”
函数: add_months(a,b)
参数: a : 日期 , b : 数字
功能: 获取b个月后的日期。
举例: select add_months(date '2015-09-08',6) from dual;
结果: 2016/3/8
函数:coalesce(value1, valu ...
oracle 锁表后该怎么解锁。
1.下面的语句用来查询哪些对象被锁:
select object_name,machine,s.sid,s.serial#
from v$locked_object l,dba_objects o ,v$session s
where l.object_id = o.object_id and l.session_id=s.sid;
2.下面的语句用来杀死一个进程:
alter system kill session '24,111'; (其中24,111分别是上面查询出的sid,serial#)
关于开窗函数
row_number() over (partition by [字段1] order by [字段2] desc);
row_number() 用于[字段1]数据相同的时候,给相同数据进行编号,例如[字段1]相同的数据有两条,根据[字段2]排序,然后给这两条数据分别编上1和2.
例如:select t0.* , row_number() over (partition by t0.c_username order by rowid desc) l_num from t_user t0 ;
他会把名字一样的人进 ...
--先用管理员身份登录数据库
--创建表空间
create tablespace 表空间的名称
datafile '表空间所对应的DBF数据文件存储路径'
size 数据文件的初始大小
autoextend on next 数据文件的增量大小
maxsize unlimited;--数据文件最大大小,无限制。
--示例
create tablespace TestSpace
datafile 'C:\app\Administrator\oradata\orcl\TestSpace.dbf'
size 10M autoextend on next 1M
maxsize unl ...
min(),max()函数的返回值,
1.如果max(###),###是字符串,且是数字类字符串。返回值会把字符转换成数字。
SELECT min(t.c_businflag) FROM trequest t where t.c_fundcode='HA0065';
2.如果max(###),###是日期。返回值还是日期。
SELECT min(t.d_date) into i FROM trequest t where t.c_fundcode='HA0065';
3.如果max(###),###是字符串,是一般类字符串。返回值是该字符串。