用SQL语句创建表空间

使用SQL语句进行创建. 

1.创建表空间 

-- 公共模块表空间 
create tablespace cctc_core     
logging     
datafile   
'/ORACLE/PRODUCT/10.2.0/ORADATA/cctchdcq/cctc_core.dbf'     
size 100m    
autoextend on next  10m     
extent management local     
segment space management auto 
/
-- 业务表空间 
create tablespace cctc_operation     
logging     
datafile   
'/ORACLE/PRODUCT/10.2.0/ORADATA/cctchdcq/cctc_operation.dbf'     
size 100m     
autoextend on next  10m     
extent management local     
segment space management auto 
/ 
2.创建用户并分配权限 

-- Create the user  
create user HDCQ   
default tablespace CCTC_CORE--默认表空间   
temporary tablespace TEMP   
profile DEFAULT   
quota unlimited on cctc_core--设定用户的表空间   
quota unlimited on cctc_operation;--设定用户的表空间 
-- Grant/Revoke role privileges 设定用户权限 
grant connect to HDCQ with admin option; 
grant dba to HDCQ with admin option; 
grant resource to HDCQ with admin option; 
-- Grant/Revoke system privileges 表空间的系统权限 
grant unlimited tablespace to HDCQ with admin option;  
3.创建表 

create table  t_organization  (
-- 主键
org_pk             number(10,0)                not null,     
-- 父主键     
father_org_pk      number(10,0) default 0,     
-- 组织机构名称     
org_name           varchar2(100)             not null,     
-- 创建时间     
create_time        varchar2(50) default    
to_char(sysdate,'yyyy-MM-dd HH:mm:ss')  not null,     
constraint pk_t_organization primary key (org_pk)
) 
tablespace cctc_core
/
create sequence seq_organization     
start with 140     
increment by 1     
maxvalue   9999999999     
minvalue   1     
cycle
/ 
-- ============================================= 
--用途:创建客户来电表 
-- 表名:t_customer  
-- ============================================= 
create table t_customer  
( 
--主键    
customer_pk           raw(16)                      not null,    
--客户名称    
customer_name   varchar2(200)        not null,    
--客户电话    
customer_phone        varchar2(100)                 not null,    
--创建人    
create_user_pk        int                   not null,    
--创建时间    
create_time varchar2(50) default 
to_char(sysdate,'yyyy-MM-dd HH:mm:ss') not null,     
constraint pk_t_customer primary key (customer_pk) 
)
tablespace cctc_operation
/ 




  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值