日期:2014-05-16  浏览次数:20463 次

Oracle常用语句

首先需要知道你登录的用户名,然后以sysdba登录,然后执行下列的语句:

在系统命令行输入sqlplus? /@sid as sysdba

?

--查询最大线程数量
show parameter processes

?

--查询最大会话数量?
show parameter sessions

?

--查询当前使用会话数量
select count(*) from v$session;
?
--查询当前数据库文件存放位置
show parameter spfile;

?

--修改processes

alter system set processes=300 scope=spfile;
--修改sessions值
alter system set sessions=335 scope=spfile;
--修改后要重启数据库,更改才生效。
shutdow immediate;
--启动
startup;

?

??

--查看用户使用的缺省表空间名称
sqlplus? as sysdba?? select username,default_tablespace from dba_users;

?

--查看表空间总大小,及其已使用大小
select a.tablespace_name,a.bytes10241024 Sum MB,(a.bytes-b.bytes)10241024 used MB,b.bytes10241024 free MB,?? round(((a.bytes-b.bytes)a.bytes)100,2) percent_used?? from?? (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,?? (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b?? where a.tablespace_name=b.tablespace_name?? order by ((a.bytes-b.bytes)a.bytes) desc;

?

--查询文件存放位置
select name from v$datafile;

--查询dba表空间
select tablespace_name from dba_tablespaces;

?

--查询dba所有用户
select * from dba_users;

?

--查询最新执行sql的前10条
select * from V$SQL where rownum <10;