沙龙晃荡 | 去哪儿、陌陌、ThoughtWorks在主动化运维中的实践!10.28不见不散!
1, 连接数据库;
connect scott/123456;
断开数据库
disconn;
describe scott.emp;
3, 查看数据表
select empno,job,mgr,sal;
4,精华冲区中的 sql 语句保存到文件
14,履行 sql 文件的语句
save scott_emp_query.sql
5,将文件内容读入到缓冲区中
get scott_emp_query.sql list
6,应用 start 敕令攫取并运行 sql 文件
start scott_emp_query.sql
edit
8,将输出结不雅保存到指定文件中
spool scott_emp_outcome.txt append
9, 带变量的语句 &
select empno,ename,mgr,sal,deptno
from scott.emp
7, 精华冲区内容复制到名为 afiedt.buf 文件 (这个是默认文件) 中
where empno >=&temp;
select &column_name,deptno
from scott.emp
where &column_name>=7850;
select &&column_name ,deptno
from scott.emp
create global temporary table temp_book(
where &&column_name>=7850;
12, 不显示 “原值” 和 “新值” 信息
set veryify off;(on 是显示)
新招: 反斜杠 "/" 再次运行膳绫擎的萌芽
13,设置变量定义字符
set define '@'(设置今后定义变量的字符就变为 @,& 无效)
@ E:\TEMP\temp.sql (此处应当留意,路径是区分大年夜小写的)
15,应用 define 查看常量
define;
16, 设置常量
define temp=7850
查看常量
define temp
删除常量
undefine temp
17, 应用 column 设置输出格局
column empno heading '员工编号' format 9999column ename heading '员工姓名' format a10column mgr heading '上级编号' format 9999column hiredate heading '受雇日期' justfify centercolumn sal heading '员工工资' format $999,999.99select empno,ename,mgr,hiredate,salfrom scott.emp;
18, 设置一页显示若干行数据
set pagesize 20
19, 设置一行显示若干字符
10, 带两个变量的语句 (两次输入)
set linesize 20
20, 设置页眉页脚
ttitle 页眉, btitle 页脚
21,break 敕令用来分组,compute 敕令用来计算和
break on deptno;
compute sum of sal on deptno;
select empno,ename,mgr,sal,deptno
from scott.emp order by deptno;
22, 清除 column 格局
clear columns
23, 创建永远性表空间
create tablespace myspace
datafile '文件路径'
size 文件大年夜小
autoextend on next 主动增长大年夜小
maxsize 文件最大年夜值
语法解释:1,temporary|undo(创建撤销表空间)2,teblespace_name 3,datafile|tempfile'file_name'4,size5,reuse 若存在,则删掉落并从新创建6,autoextend off|on7,next number 主动扩大的大年夜小8,maxsize unlimited|number 指定命据文件最大年夜大年夜小9,mininum extent number 盘区可以分派到的最小尺寸10,blocksize number 设置数据块大年夜小11,online|offline 12,logging|nologging13,force logging 强迫表空间数据库对象任何操作都产诞辰记,否定 1214,default storage storage 指定保存在表空间中的数据库对象默认存储参数15,compress|nocompress 是否紧缩数据(清除列中的反复值)16,permanent|temporary 指定表空间中数据的保存情势17,extent management dictionary(数据字典情势治理)|local(本地化情势治理)18,autoallocate|uniform size number 右边为指定表中盘区大年夜小 19,segment space management auto |manual 指定表空间中段的治理方法
24,查看表空间属性
select * from dba_tablespace wheretablespace_name='表空间名';
25, 修改表空间状况
alter tablespace 表空间名 表空间状况;
26,修改表空间名字
27,应用数据字典查看余暇空间信息
select * from dba_free_space where tablespace_name='表空间名称';
28, 应用数据字典查看表空间数据文件信息
29, 修改表空间对应的数据文件大年夜小
alter database
datafile '表空间文件路径名称'
create table e_card(
resize 大年夜小
30, 为表空间增长新的数据文件
alter tablespace myspace
add datafile '数据文件路径名称'
size 大年夜小
2, 查看表构造
autoextend on next 自增大年夜小 maxsize 最大年夜值;
31, 删除 myspace 表空间数据文件
alter tablespace myspace
drop datafile '数据文件名称';
37, 创建临时表空间,将地点组指定为 group1
32,修改 myspace 表空间中数据文件的主动扩大性
推荐阅读
沙龙晃荡 | 去哪儿、陌陌、ThoughtWorks在主动化运维中的实践!10.28不见不散! 无论是开辟、测试照样运维过程中,大年夜家都可能会因为误操作、连错数据库、用错用户、语句前提有误等原因>>>详细阅读
地址:http://www.17bianji.com/lsqh/37968.html
1/2 1