一
1oracle体系结构主要组件
Oracle体系结构的3个主要组件:
1.文件:组成数据库实例的5个文件(参数文件,控制文件,数据文件,临时数据文件,重做日志文件)
2.系统全局区域SGA( System Global Area): Java池,共享池等
3.物理进程与线程: 在数据库上运行3种不同类型的进程(服务器server进程,后台backgroud进程,从属slave进程)
内存结构
1.SGA(System Global Area)
2.PGA(Process Global Area)
3.UGA(User Global Area)
2 oracle 详细资料 tnsnames.ora
3.创建用户(其中system/sys用户具有管理员权限,而scott用户只有普通用户权限)
create user pp 用户名
identified by 911 密码
[Default tablespace test1] 默认表空间
[Temporary tablespace temp2] 临时表空间
授权
oracle用户权限有两种类型:系统权限和对象权限;
系统权限执行某些数据库操作(如创建表空间);对象权限 对某一特定对象(表,视
图,序列等)执行特定操作
Grant connect to pp; 允许连接数据库并在数据库中创建表或其他对象
Grant resource to pp; 允许用户使用数据库中的空间
Grant create to pp;
Grant sequence to pp;
Grant select on 表 to pp;
作业:
创建一个名称为David 的用户,口令为davidpass,并授予其连接数据库和创建表对象
的权限,同时授予其访问另一个用户Martin表test的权限.
二
1.数据类型
2.伪列
RowID 行地址; select RowID,userName from User where userName='pp';
RowNum 行数; 从表中提取10条记录 select * from User where RowNum<11;
3删除表记录
truncate table 表名
4 显示表结构
Desc 表名
5. 利用现有的表创建新表
create table newtable as select * from oldtable; 全部拷贝
create table newtable as select code,desc,hand from oldtable;拷贝三个列及数据;
create table newtable as select * from oldtable where 1=2; 只拷贝表结构;
6.事务处理
commint rollback savepoint(回滚点)
eg:
update ..
savepoint mark1;
delete ..
savepoing mark2;
rollback to savepoing mark1;
commit;
三 SQL函数
1.单行函数
1.日期函数
Add_Months(d,n);
Months_between(d1,d2);
Last_day(d);
round(d,[fmt]);
next_day(d,'星期二');
Trunc(d,[fmt]);
Extract(fmt from d);
2字符函数
3 数字函数
4 转换函数
5其他函熟
转换null值 的单行函数
2.分组函数
3.分析函数
附:
accp的oracle资料
数据库有下面两类组件:物理组件和逻辑组件。
物理组件是操作系统文件,有下面三种类型:数据库文件或数据文件、控制文件、
恢复日志文件
逻辑组件决定数据库中物理空间的使用,它包括:表空间、段、数据区、模式对象
Oracle 数据库中的典型表空间是:SYSTEM ,DATA,USER ,TOOLS, TEMP
Oracle 支持 Char、Varchar2、Number、Long、Date、Raw、Long Raw 和 LOB 等
数据类型
插入来自其他表的记录
-语法:
Insert into <table_name>
(SELECT column_names from <existing_table_name>);
SQL 函数
单行函数的分类
日期函数
字符函数
数字函数
转换函数
其他函数
常规函数
日期函数
Add_months
Last_day
Months_between
Round
Next_day
Trunc
Greatest
字符函数
Substr
Instr
Length
Lpad
Rpad
Trim
Decode
数字函数
Mod
Round
Trunc
Sign
Ln
转换函数
To_char( )
To_date( )
To_number(
其他函数
Uid
User
Vsize
常规函数
NVL
NVL2
NULLIF
COALESCE
不同的分组函数
Avg
Max
Min
Sum
Count
Stddev
variance
Group By 子句
Having 字句
ROLLUP
CUBE
Oracle数据库基础

被折叠的 条评论
为什么被折叠?



