ORACLE 常用命令和SQL

--创建表空间
create tablespace XXXXX datafile 'D:\oracle\product\10.2.0\oradata\oral10\xxxxx.dbf' size 100M;

create tablespace misscall datafile 'F:\app\zphome\oradata\orcl\misscall.dbf' size 2048M autoextend on next 50M maxsize unlimited;

--创建用户
create user username identified by password default tablespace voice_yasen;

--用户基本权限
grant connect,resource to voice_yasen;

--如果需要使用IMP倒入数据,最简单方式给他DBA权限
grant dba to voice_yasen;

2.修改ORACLE-WEB管理服务的端口

call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()',8000));

  

查看表空间

扫描二维码关注公众号,回复: 1343978 查看本文章
SELECT a.tablespace_name "表空间名",
       round(total / 1024 / 1024, 2) || 'M' 表空间大小,
       round(free / 1024 / 1024, 2) || 'M' 表空间剩余大小,
       round((total - free) / 1024 / 1024, 2) || 'M' 表空间使用大小,
       ROUND((total - free) / total, 4) * 100 "使用率 %"
  FROM (SELECT tablespace_name, SUM(bytes) free
          FROM DBA_FREE_SPACE
         GROUP BY tablespace_name) a,
       (SELECT tablespace_name, SUM(bytes) total
          FROM DBA_DATA_FILES
         GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;

查看连接数

--当前连接数
select * from v$session where username is not null

--列举用户的连接数
select username,count(username) from v$session where username is not null group by username

--总连接数
select count(*) from v$session

--当前存活的连接数(并发)
select count(*) from v$session where status='ACTIVE'

--显示最大连接参数值
show parameter processes

猜你喜欢

转载自acooly.iteye.com/blog/1704007