orcle经常使用语句
--1.创建暂时表空间
create temporary tablespace AUTOMONITORV5_temp
tempfile 'D:\ORACLE\KARL\ORADATA\ORCL\AUTOMONITORV5_temp.DBF'
size 50m
autoextend on
next 50m maxsize 10240m
extent management local; --2.创建表空间
create tablespace AUTOMONITORV5
logging
datafile 'D:\ORACLE\KARL\ORADATA\ORCL\AUTOMONITORV5.DBF'
size 50m
autoextend on
next 50m maxsize 12720m
extent management local; --3.创建用户
create user automonitorv5 identified by "123456"
default tablespace AUTOMONITORV5
temporary tablespace AUTOMONITORV5_temp; --4.授权
grant connect,resource,dba to automonitorv5; --5.删除用户
drop user automonitorv5 cascade; --6.删除表空间
DROP TABLESPACE automonitorv5 INCLUDING CONTENTS AND DATAFILES; --7.查询表空间位置及大小
select tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
from dba_data_files
order by tablespace_name; --8.表空间使用率
SELECT a.tablespace_name "表空间名",
total "表空间大小",
free "表空间剩余大小",
(total - free) "表空间使用大小",
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; --9.增大表空间大小
alter database datafile 'D:\ORACLE\KARL\ORADATA\ORCL\AUTOMONITORV5.DBF' resize 4000m; --10.添加文件个数
alter tablespace AUTOMONITORV5
add datafile 'D:\ORACLE\KARL\ORADATA\ORCL\AUTOMONITORV51.DBF' size 1000m; --11.设置表空间自己主动增长
alter database datafile 'D:\ORACLE\KARL\ORADATA\ORCL\AUTOMONITORV5.DBF'
autoextend on next 100m maxsize 10240m; --12.获取10年前的日期
select to_char(sysdate-numtoyminterval(10,'year'),'yyyy-MM-dd HH24:mi:ss') from dual; --13.小数转字符补零方法
1)将小数点前的第一位置为0就可以(注意9的个数要大于数值的位数)
select to_char(.23,'fm999999990.999999999') from dual;
2)既然小于1的小数首位必定是'.',那就推断首位是否为'.'。是则在前面加上'0'就可以
select decode(substr(.23,1,1),'.','0'||.23,.23) from dual;
<a target=_blank href="http://www.2cto.com/database/201304/205087.html">oracle小数转字符串</a>
orcle经常使用语句的更多相关文章
- python第六天 函数 python标准库实例大全
今天学习第一模块的最后一课课程--函数: python的第一个函数: 1 def func1(): 2 print('第一个函数') 3 return 0 4 func1() 1 同时返回多种类型时, ...
- whdxlib
1 数据库系统实现 实 验 指 导 书 齐心 彭彬 计算机工程与软件实验中心 2016 年 3 月2目 录实验一.JDBC 应用程序设计(2 学时) ......................... ...
- Orcle 查询语句
首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott ac ...
- Orcle基本语句(六)
-- Created on 2017/1/5 by ADMINISTRATOR DECLARE -- Local variables here i ; v_name ) := '张晓风'; v_age ...
- ORCLE基本语句(二)
select语句的基本语法: [ORDER BY < COLUMN1, COLUMN2, COLUMN3...> [ASC 或 DESC]]
- Orcle基本语句(三)
COMMIT; --查询表内所有内容 SELECT * FROM stu_info; --查询部分列,并赋予别名 SELECT stu_id 学生标号,stu_name 学生姓名 FROM stu_i ...
- Orcle常用语句
在SQLPlus界面的操作语句: 查看\设置每行内显示的字符数:show\set linesize [linesize] 查看\设置一次显示的行数:show\set pagesize [pagesiz ...
- Orcle基本语句(一)
--创建学生信息表,约束放在所有列定义之后 CREATE TABLE stu_info( stu_id INTEGER, stu_name NVARCHAR2() NOT NULL, stu_sex ...
- Orcle基本语句(五)
--分页查询---begin --sqlserver top --mysql limit --oracle rownum(伪列),oracle中伪列(rownum,rowid) --查询工资为前五的信 ...
随机推荐
- [转] C#中发送消息给指定的窗口,以及接收消息
原文C#中发送消息给指定的窗口,以及接收消息 public class Note { //声明 API 函数 [DllImport("User32.dll", EntryPoint ...
- 翻译【ElasticSearch Server】第一章:开始使用ElasticSearch集群(1)
我们要做的第一件事是安装ElasticSearch.对于多数应用程序,您开始安装和配置,通常忘记这些步骤的重要性,直到发生了糟糕的事情.这章我们将广泛关注ElasticSearch的这部分.请注意本章 ...
- Fixing the Great Wall
题意: 在一条线上,有n个坏的地方要修机器人修,机器人的移动速度V,若坏的地方立即被修花费ci,若没修,每单位时间增加d,出去机器人的开始位置,求修完n个地方的最小花费. 分析: 非常经典,求解“未来 ...
- IOS 给图片添加水印 打印文字
1.加文字 -(UIImage *)addText:(UIImage *)img text:(NSString *)text1 { //get image width and ...
- IOS NSNotificationCenter 通知的使用
1.注册通知 [NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notify) name:@" ...
- 个人经验 - Android的RelativeLayout布局的layout_height属性设置为wrap_content时的坑
Android的RelativeLayout布局的layout_height属性设置为wrap_content时的坑: 此坑出现的条件: 1.RelativeLayout布局的layout_heigh ...
- WCF扩展
WCF 可扩展性 WCF 提供了许多扩展点供开发人员自定义运行时行为. WCF 在 Channel Layer 之上还提供了一个高级运行时,主要是针对应用程序开发人员.在 WCF 文档中,它常被称为服 ...
- 四款超棒的jQuery数字化签名插件
在浏览器中,我们有很多方式来绘制生成签名效果,并且有很多很棒很智能的jQuery插件.数字化签名是未来的发展方向,正是这个原因我们这里收集并且推荐了四款超棒的jQuery数字化签名插件,希望大家喜欢! ...
- C++实现网格水印之调试笔记(五)—— 提取出错
在实现提取水印的过程中,遇到了一些问题 首先还是根据论文中的思路来梳理一下整个提取流程 读入两个模型,一个原始模型ori_mesh, 一个水印模型wm_mesh. 将两个模型对齐(即放在同一个坐标系下 ...
- 最短路+线段交 POJ 1556 好题
// 最短路+线段交 POJ 1556 好题 // 题意:从(0,5)到(10,5)的最短距离,中间有n堵墙,每堵上有两扇门可以通过 // 思路:先存图.直接n^2来暴力,不好写.分成三部分,起点 终 ...