oracle基础-用户与表空间

系统用户

sys–超级用户
system–管理员用户
sysman–操作企业管理器
scott–Oracle创始人的名字

用sqlplus登录

system/orcl@127.0.0.1:1521

查看登录用户

show user

解锁/锁定用户

alter user username account unlock/lock

表空间

–永久表空间(表,视图,存储过程)
–临时表空间(中间执行过程)
–UNDO表空间(事务修改前的数据)

查看用户表空间

desc dba_tablespaces; 查询表空间
select tablespce_name from dba_tablespaces;
desc user_tablespaces;查询普通用户表空间

设置用户表空间

alter user system default tablespace system;
设置用户system的默认表空间为system;

创建表空间

create [temporary] tablespace tablespace_name tempfile|datafile 'xx.dbf' size xx;
创建表空间语句
eg:
create tablespace test datafile 'testfile.dbf' size 10m;创建永久性表空间
create temporary tablespace test tempfile 'testfile.dbf' size 10m;创建临时表空间
select file_name from dba_data_files where tablespace_name='TEST';查看表空间文件路径

修改表空间状态

select status from dba_tablespaces where tablespace_name='test';查看表空间状态
alter tablespace test offline/online;修改表空间离线/在线状态;
alter tablespace test read only/read write;修改表空间只读/读写状态;

修改数据文件

alter tablespace table_name add datafile 'xx.dfb' size xx;增加数据文件
alter tablespace table_name drop datafile 'xx.dfb' size xx;删除数据文件

删除表空间

drop tablespace table_name [including contents]
删除表空间 [删除数据文件]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李卓书

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值