首页 > 数据库技术 > 详细

Oracle数据库个人整理常用的表空间、用户、授权操作

时间:2018-02-23 12:59:32      阅读:279      评论:0      收藏:0      [点我收藏+]

1、表空间相关sql

-- 创建表空间名为test_tablespace_name,存储位置为D:\DB\oradata\orcl\test_tablespace_name.dbf,大小为128m,无限制,超出后每次增长10m
create tablespace test_tablespace_name datafile D:\DB\oradata\orcl\test_tablespace_name.dbf‘ size 128m autoextend on next 10m maxsize unlimited;
-- 查看表空间名为test_tablespace_name信息
SELECT file_name, tablespace_name, bytes, autoextensible
  FROM dba_data_files
 WHERE tablespace_name = test_tablespace_name‘;
-- 删除表空间 test_tablespace_name
alter tablespace test_tablespace_name offline;
-- 将磁盘上的数据文件一同删除
drop tablespace test_tablespace_name including contents and datafiles;

2、用户相关sql

-- 新建用户 test_user/test_password,指定表空间为test_tablespace_name
create user test_user identified by test_password default tablespace test_tablespace_name temporary tablespace temp;
-- 修改用户密码
ALTER USER test_user identified by 123456;
-- 删除用户
DROP USER test_user CASCADE;
-- 锁定用户
alter user test_user account lock;
-- 解锁用户
alter user test_user account unlock;
-- 查询用户信息
select * from all_users;
-- 更详细的用户信息
select * from dba_users;

3、授权相关sql

-- 授予test_user用户dba权限
grant resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace to test_user;
-- 撤销test_user用户dba权限
REVOKE resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace FROM test_user;
--查看当前用户的系统权限
select * from user_sys_privs;
--查看当前用户的对象权限
select * from user_tab_privs;
--查看当前用户的所有角色
select * from user_role_privs;

 

yexiangyang

moyyexy@gmail.com


 

Oracle数据库个人整理常用的表空间、用户、授权操作

原文:https://www.cnblogs.com/moy25/p/8461354.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!