查看某表上的约束可以通过all_constraints视图中查看,另一个视图ALL_CONS_COLUMNS也包括组成表上约束列的信息:
SELECT constraint_name, table_name, r_owner, r_constraint_name
FROM all_constraints
WHERE table_name = 'table_name' and owner = 'owner_name';
FROM all_constraints
WHERE table_name = 'table_name' and owner = 'owner_name';
增加表空间的大小有两种方法:
1.增加额外的数据文件到表空间中
alter tablespace users add datafile '/u01/oradata/orcl/users02.dbf' size 25m;
2.修改表空间当前的数据文件
例如:alter database datafile '/u01/oradata/orcl/users01.dbf' resize 50M;
建立序列:
-- Create sequence
create sequence SEQ_NUMBER_B007
minvalue 1
maxvalue 999999999999999999999999999
start with 201761
increment by 1
cache 20;
create sequence SEQ_NUMBER_B007
minvalue 1
maxvalue 999999999999999999999999999
start with 201761
increment by 1
cache 20;
数据库表字段长度的修改(ORACLE 8 ):
1.如果表里没有数据,那么字段的长度、是否为空,可随便变更;
2.如果表里有数据,字段定义的长度从小变大,如varchar2(1) 到varchar2(5),可直接用如下语句:
alter table code_line_kind modify(line_kind varchar2(5);
alter table code_line_kind modify(line_kind varchar2(5);
3.如果表里有数据,字段定义的长度从大变小,如varchar2(5) 到varchar2(1),不能直接用如下语句:
alter table code_line_kind modify(line_kind varchar2(5);
alter table code_line_kind modify(line_kind varchar2(5);
而需要以下过程:
create table code_line_kind_bak as select * from code_line_kind;
alter table code_line_kind modify (line_kind varchar2(1);
insert into code_line_kind select * from code_line_kind_bak;
commit;
drop table code_line_kind_bak;
create table code_line_kind_bak as select * from code_line_kind;
alter table code_line_kind modify (line_kind varchar2(1);
insert into code_line_kind select * from code_line_kind_bak;
commit;
drop table code_line_kind_bak;
4.如果更改字段是否为空的属性,同3
杀死锁进程
杀死其锁进程[SID,SERIAL#],SQL语句如下:ALTER SYSTEM KILL SESSION ‘SID,SERIAL#'
数据库内存使用情况查询
select a.sid,b.name,a.value from v$sesstat a,v$statname b
where (b.name like '%uga%' or b.name like '%pga%') and a.statistic# = b.statistic#
order by value desc;
where (b.name like '%uga%' or b.name like '%pga%') and a.statistic# = b.statistic#
order by value desc;
9i 中进程使用内存可以通过 v$process 来查看 :
desc v$process