oracle创建新用户和用户表空间
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了oracle创建新用户和用户表空间,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3376字,纯文字阅读大概需要5分钟。
内容图文
![oracle创建新用户和用户表空间](/upload/InfoBanner/zyjiaocheng/515/2d01c71e7cf54f50846024a4c41c3a2c.jpg)
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;
grant create session,create table,unlimited tablespace to NAMEMATCHER;
5.然后再以楼主自己创建的用户登录,登录之后创建表即可。
conn username/password;
6.查看服务名
env |grep SID
7.授予dba权限
grant dba to username
7.使用上面的用户名、密码、sid登录plsql
每步执行的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
1.创建用户
create user user_name identified by "user_password"
default tablespace tbs_name
temporary tablespace temp profile DEFAULT;
2.授权
grant connect to user_name;
grant create indextype to user_name;
grant create job to user_name;
grant create materialized view to user_name;
grant create procedure to user_name;
grant create public synonym to user_name;
grant create sequence to user_name;
grant create session to user_name;
grant create table to user_name;
grant create trigger to user_name;
grant create type to user_name;
grant create view to user_name;
grant unlimited tablespace to user_name;
alter user user_name quota unlimited on tbs_name;
==================================================================
--查询用户默认使用的表空间
select username,default_tablespace from dba_users;
--修改默认表空间
alter user TRANSWATCH default tablespace TMS5_TABLES;
--给用户赋权限
grant create session,create table,unlimited tablespace to TRANSWATCH;
--查询用户使用的表空间
select table_name,tablespace_name from user_tables;
--查指定表空间下当前用户的所有表
select ‘alter table ‘||table_name||‘ move tablespace TMS5_TABLES;‘ from
user_tables where tablespace_name = ‘USERS‘;
--批量修改表空间
alter table SANCTIONED_CITIES move tablespace TMS5_TABLES;
...
--查询索引
select * from user_indexes;
--查指定索引表空间下当前用户的所有=索引
select ‘alter index ‘||index_name||‘ rebuild tablespace TMS5_INDEXES;‘from user_indexes;
--批量修改索引表空间
alter index SYS_IL0000077055C00004$$ rebuild tablespace TMS5_INDEXES;
alter index PK_SUPPORT_FILES rebuild tablespace TMS5_INDEXES;
...
--查询函LOB类型表所在索引表空间(ORA-02327: cannot create index on expression with datatype LOB 02327. 00000,报这个错是因为LOB类型导致)
select * from user_indexes where index_name like ‘SYS%‘
--表结构
desc SCREENING_IWL_ENTITY;
--移动含LOB类型表的索引到其他表空间
ALTER TABLE SCREENING_IWL_ENTITY MOVE LOB(DETAIL) STORE AS (TABLESPACE TMS5_INDEXES);
oracle创建新用户和用户表空间
标签:store maxsize watch bsp 数据库名 空间 ota te pro match
本文系统来源:https://www.cnblogs.com/liutoliu/p/11818659.html
内容总结
以上是互联网集市为您收集整理的oracle创建新用户和用户表空间全部内容,希望文章能够帮你解决oracle创建新用户和用户表空间所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。