oracle登录管理员创建数据库和表空间
登录管理员最高权限账号
cmd输入sqlplus 回车,或者直接打开sqlplus
用户名:sys
密码:sys as sysdba
1.首先,创建(新)用户:
create user username identified by password;
username:新用户名的用户名
password: 新用户的密码
也可以不创建新用户,而仍然用以前的用户,如:继续利用scott用户
2.创建表空间:
create tablespace tablespacename datafile 'd:\data.dbf' size xxxm;
tablespacename:表空间的名字
d:\data.dbf':表空间的存储位置
xxx表空间的大小,m单位为兆(M)
3.将空间分配给用户:
alter user username default tablespace tablespacename;
将名字为tablespacename的表空间分配给username
4.给用户授权:
grant create session,create table,unlimited tablespace to username;
5.然后再以楼主自己创建的用户登录,登录之后创建表即可。
conn username/password;
每步执行的sql:(sjzx是数据库名、用户名、密码、表空间名)
(1)create user sjzx identified by sjzx
(2)create tablespace sjzx datafile 'D:\db\app\oradata\orcl\sjzx.dbf' size 100m autoextend on next 32m maxsize 2048m
(3)alter user sjzx default tablespace sjzx
(4)grant create session,create table,unlimited tablespace to sjzx
完整步骤:
--创建两个数据库的文件
create tablespace spsy_data
logging
datafile 'D:\orcal11\oradata\orcl\spsy_data.dbf'
size 100m
autoextend on
next 10m maxsize unlimited
extent management local;
create temporary tablespace spsy_temp
tempfile 'D:\orcal11\oradata\orcl\spsy_temp.dbf'
size 100m
autoextend on
next 10m maxsize 500m
extent management local;
--创建用户与上面创建的文件形成映射关系
create user spsy identified by 000000 default tablespace spsy_data temporary tablespace spsy_temp;
--添加权限
grant connect,resource,dba to spsy;
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步