1.oracle特点

2.oracle体系
- 实例:一组oracle后台进程以及在服务器中分配的共享内存区域。
- 数据库:基于磁盘的数据文件、控制文件、日志文件、参数文件和归档文件等组成的物理文件集合。
- 数据库服务器
三者之间的关系:实例用于控制和管理数据库;数据库为实例提供数据
3.oracle存储结构
- 物理存储结构:展示oracle在操作系统中的物理文件(数据文件)组成情况,主要有系统数据文件、撤销数据文件以及用户数据文件
- 逻辑存储结构:描述oracle内部组织和管理方式。逻辑存储结构是从逻辑的角度分析数据库的构成,其结构是一种层次结构,主要由表空间、段、区间以及数据块构成。其中,表空间是用来进行数据存储的(表、function、存储过程),是实际物理存储区域。oracle默认的系统表空间有:

4.oracle启动数据库实例与关闭实例过程
- 启动数据库实例:启动实例-->加载数据库-->打开数据库
 - 关闭实例:关闭数据库-->卸载数据库-->关闭oracle实例

?5.oracle创建表空间以及用户
- 创建表空间
 - ?创建用户

?6.oracle对表的操作
首先需要了解SQL语句类型
- DML(数据操纵语言):select、insert、update、delete
- DDL(数据定义语言):create、alter、drop
- DCL(数据控制语言):grant(授权访问)、remoke(撤销访问)
- 事务控制:commit(提交事务)、rollback(事务处理回退)、savepoint(设置保存点)、lock(对部分事务锁定)
(1)创建表
- create table 表名(字段名,字段类型);
- 在scott模式下创建表:create table scott.表名(字段名,字段类型);
- 基于已经存在的表或视图创建表:create table 表名 as select * from 表名;
(2)重命名表
alter table 表名 rename to 表名;
(3)删除表
- 删除:drop table 表名 cascade constraints;
- 查看是否在回收站:select?object_name,original_name from recyclebin where original_name='表名'
- 恢复删除的表:flashback ?table 表名 to before drop;
(4)修改表的状态
- 只读状态(不能做任何的DML和DDL操作,可以转移表空间):alter table 表名 read only;
- 可读写状态:alter table 表名 read write;
(5)对字段的操作
- 增加新字段:alter table 表名 add(字段名 字段类型);
- 删除字段:a.删除一个字段:alter table 表名 drop column 字段名;
? ? ? ? ? ? ? ? ? ? ? ? ?b.删除两个或多个字段:alter table 表名 drop? (字段名1,字段名2,..);
- 修改字段(把字段长度由2改成4):alter table 表名 ?modify 字段名 varchar2(4);
(6)表约束

a.定义时禁用:create table student(stucode varchar2(4) not null,age int constraint age_ck check(age >0 and age <20 ) disable);
b.禁用已存在的:alter table 表名 disable constraint ?约束名;
alter table 表名 drop ?constraint 约束名;
(7)指定别名
- 为列指定别名可以使用as关键字:select empno as '员工编号' from emp;
- 也可以不使用直接指定:select empno '员工编号' from emp;
(8)筛选查询


(9)分组查询
?
(10)表连接?

?
|