Oracle创建表空间和表

//创建数据表空间

格式:create tablespace 表间名 datafile '数据文件名'  表空间大小 

 

create tablespace zzbm_data
logging
datafile 'd:\oracle\oradata\zzbm\zzbm_data01.dbf'
size 32m
autoextend on
next 32m maxsize 20000m
extent management local;

 

//创建用户并指定表空间

格式:create user 用户名 identitfled by 密码 default 表空间

create user username identified by password
default tablespace zzbm_data
temporary tablespace zzbm_temp;

 

//给用户授予权限

格式:grant connect,resource to 用户名

grant connect,resource to username;

 

//设置用户密码永不过期

格式:alter profile default limit password_life_time unlimited


ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

 

//查询表空间
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space,t.maxbytes/(1024*1024),t.maxblocks
from dba_data_files t
order by tablespace_name;

posted @ 2020-01-13 16:17  BinBinPeng  阅读(118)  评论(0)    收藏  举报