数据库用户的建立,表空间的建立,数据的编辑
2015-10-25 16:15
204 查看
//表空间 CREATE SMALLFILE TABLESPACE "ZUOYE" DATAFILE 'D:\ORACLE\11G\ORADATA\ORCL\ZUOYE.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO //表空间的空间修添加 ALTER TABLESPACE "ZUOYE" ADD DATAFILE 'D:\ORACLE\11G\ORADATA\ORCL\ZUOYE1.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED //创建用户 -- Create the user create user zuoye //用户名 identified by "123654789" //密码 default tablespace ZUOYE //表空间 temporary tablespace TEMP; //临时表空间 -- Grant/Revoke role privileges grant connect to zuoye; //授予connect权限 grant dba to zuoye; //授予dba权限 //列的内容 -- Create table create table T_HQ_ZYl ( "bianh" number not null, "xingm" varchar2(10) not null, "xingb" number default 1 not null, "nianl" number not null, "jiatzz" varchar2(50), "xins" number default 0 not null, "gongzsj" number not null ) ; //注释 -- Add comments to the columns comment on column T_HQ_ZYl."bianh" is '编号'; comment on column T_HQ_ZYl."xingm" is '姓名'; comment on column T_HQ_ZYl."xingb" is '性别:男-1;女-2;'; comment on column T_HQ_ZYl."nianl" is '年龄'; comment on column T_HQ_ZYl."jiatzz" is '家庭住址'; comment on column T_HQ_ZYl."xins" is '薪水'; comment on column T_HQ_ZYl."gongzsj" is '工作时间'; //检查,约束 -- Create/Recreate check constraints alter table T_HQ_ZY add constraint CHECK_BIANH check (bianh != bianh); alter table T_HQ_ZY add constraint CHECK_NIANL check (nianl>20 and nianl<50); alter table T_HQ_ZY add constraint CHECK_XINGB check (xingb = 1 or xingb = 2);
创建用户前需要先创建表空间。
创建表空间时注意将表空间文件的后缀名添加上!比如:biaokongjian.DBF 。 .DBF 就是需要注意的文件后缀
相关文章推荐
- MySQL基础——InnoDB简介一(简介)
- 修改mysql编码为UTF-8
- ORACLE数据库优化
- sql语句count 与与group By
- 数据库设计三大范式
- SQL语言的组成
- MySQL数据库的基本操作命令
- 实用SQL语句大全
- Mac 安装 MySQL5.7
- win7 安装64 MySQL
- sqlmap注入检测经验0x01
- Windows下MySQL 5.6安装及配置详细图解
- MAC MAMP 增加 memcache 扩展
- MySql 二进制类型
- 建工发债sql
- linux centos 7安装 mariadb
- 常用的oracle数据字典
- Windows下Memcache的安装及PHP扩展配置方法
- mysql数据库的导入导出
- oracle之事务和锁