[oracle]常用SQL汇总

创建用户

create user 用户名 identified by 密码 default tablespace 默认表空间 temporary tablespace 临时表空间;

查看表空间大小

select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

查看表空间及利用率

select a.tablespace_name, total, free, total-free as used from
(select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a,
(select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b
where a.tablespace_name = b.tablespace_name;

查看临时表空间及利用率

select tablespace_name, tablespace_size/1024/1024 as total, allocated_space/1024/1024 as used, free_space/1024/1024 as free  from dba_temp_free_space;

查看临时表空间信息

select * from dba_temp_files;

查看某表的索引信息

select * from user_indexes where table_name = ‘表名‘

查看表的列信息

select * from user_tab_columns where table_name=‘表名‘

原文地址:https://www.cnblogs.com/wendelhuang/p/8125612.html

时间: 2024-08-02 19:13:01

[oracle]常用SQL汇总的相关文章

oracle常用SQL语句(汇总版)

Oracle数据库常用sql语句 ORACLE 常用的SQL语法和数据对象 一.数据控制语句 (DML) 部分 1.INSERT (往数据表里插入记录的语句) INSERT INTO 表名(字段名1, 字段名2, ……) VALUES ( 值1, 值2, ……); INSERT INTO 表名(字段名1, 字段名2, ……) SELECT (字段名1, 字段名2, ……) FROM 另外的表名; 字符串类型的字段值必须用单引号括起来, 例如: ’GOOD DAY’ 如果字段值里包含单引号’ 需要

DBA_Oracle DBA常用SQL汇总(概念)

2014-06-20 BaoXinjian DBA常用的SQL汇总 1.监控索引是否使用 alter index &index_name monitoring usage; alter index &index_name nomonitoring usage; select * from v$object_usage where index_name = &index_name; 2.求数据文件的I/O分布 select df.name,phyrds,phywrts,phyblkr

Oracle常用SQL总结

基础 1:创建数据库 CREATE DATABASE dbname 2:删除数据库 DELETE DATABASE dbname 3:备份sql server 创建备份数据的device: USE master EXEC sp_addumpdevice 'disk', 'testBack', 'c:/mssql7backup/MyNwind_1.dat' 开始备份: BACKUP DATABASE PUBS TO testback 4:创建新表 crate table table-name(co

oracle 常用sql

--1,随机抽取一条数据 select column from (select * from table order by dbms_random.value ) where rownum = 1; --2,选取一个表中的重复数据 select column from table group by column having count(*) > 1 --3,日期截取 1)如2012-4-27 9:20:22只截取后面的时分秒 select to_char(sysdate,'hh24:mi:ss

【SQL实践】其他常用SQL汇总

[SQL实践]其他常用SQL汇总 1.联表更新 update students stu inner join course on course.STUDENT_ID=stu.id set stu.name=course.ID

ORACLE 常用SQL查询

一.ORACLE的启动和关闭 1 .在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su  -  oracle a.启动ORACLE系统 oracle > svrmgrl SVRMGR > connect internal SVRMGR > startup SVRMGR > quit b.关闭ORACLE系统 oracle > svrmgrl SVRMGR > connect internal SVRMGR > shutdown

oracle 常用命令汇总

登入oracle sqlplus / as sysdba SQL> startup ---启动oracle 数据库 SQL> shutdown immediate --停止数据库 conn smsdb/password --连接到smsdb用户 回到终端机模式,输入: $ lsnrctl status 检查看看监听器是否有启动 如果没有启动,可以输入: $ lsnrctl start emctl 另外也可以发现http://localhost.localdomain:1158/em 目前是没有

oracle常用函数汇总

一.运算符算术运算符:+ - * / 可以在select 语句中使用连接运算符:|| select deptno|| dname from dept; 比较运算符:> >= = != < <= like between is null in逻辑运算符:not and or 集合运算符: intersect ,union, union all, minus 要求:对应集合的列数和数据类型相同 查询中不能包含long 列 列的标签是第一个集合的标签 使用order by时,必须使用位置

oracle 常用函数汇总

一.字符函数字符函数是oracle中最常用的函数,我们来看看有哪些字符函数:lower(char):将字符串转化为小写的格式.upper(char):将字符串转化为大写的格式.length(char):返回字符串的长度.substr(char, m, n):截取字符串的子串,n代表取n个字符的意思,不是代表取到第n个replace(char1, search_string, replace_string)instr(C1,C2,I,J) -->判断某字符或字符串是否存在,存在返回出现的位置的索引