建立用户和表空间:
一、登陆linux,以oracle用户登陆(若是是root用户登陆的,登陆后用 su - oracle命令切换成oracle用户)
二、以sysdba方式来打开sqlplus,命令以下: sqlplus / as sysdba
三、建立临时表空间:linux
--查询临时表空间文件的绝对路径。若是须要的话,能够经过查询来写定绝对路径。通常用${ORACLE_HOME}就能够了 select name from v$tempfile; create temporary tablespace NOTIFYDB_TEMP tempfile '${ORACLE_HOME}\oradata\NOTIFYDB_TEMP.bdf' size 100m reuse autoextend on next 20m maxsize unlimited;
四、建立表空间:sql
--查询用户表空间文件的绝对路径: select name from v$datafile; create tablespace NOTIFYDB datafile '${ORACLE_HOME}\oradata\notifydb.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);
五、建立用户和密码,指定上边建立的临时表空间和表空间数据库
create user hc_notify identified by hc_password default tablespace NOTIFYDB temporary tablespace NOTIFYDB_TEMP;
六、赋予权限oracle
grant dba to hc_notify; grant connect,resource to hc_notify; grant select any table to hc_notify; grant delete any table to hc_notify; grant update any table to hc_notify; grant insert any table to hc_notify;
通过以上操做,就可使用hc_notify/hc_password登陆指定的实例,建立咱们本身的表了。ide
删除表空间:spa
一、查看用户权限对象
--查看用户要具有drop tablespace的权限,若是没有,先用更高级的用户(如sys)给予受权 select a2.username,a1.privilege from dba_sys_privs a1 , user_role_privs a2 where a1.privilege = 'DROP TABLESPACE' and a1.grantee =a2.granted_role
二、删除临时表空间索引
--查看临时表空间文件 select name from v$tempfile; --查看用户和表空间的关系 select USERNAME,TEMPORARY_TABLESPACE from DBA_USERS; --若是有用户的默认临时表空间是NOTIFYDB_TEMP的话,建议进行更改 alter user xxx temporary tablespace tempdefault; ---设置tempdefault为默认临时表空间 alter database default temporary tablespace tempdefault; --删除表空间NOTIFYDB_TEMP及其包含数据对象以及数据文件 drop tablespace NOTIFYDB_TEMP including contents and datafiles;
3.删除用户表空间开发
--查看表空间文件 select name from v$datafile; --中止表空间的在线使用 alter tablespace 表空间名称 offline; --删除表空间NOTIFYDB_TEMP及其包含数据对象以及数据文件 drop tablespace NOTIFYDB_TEMP including contents and datafiles;
Oracle用户权限查询相关操做:get
--查看全部的用户 select * from all_users; --查看当前用户信息 select * from user_users; --查看当前用户的角色 select * from user_role_privs; --查看当前用户的权限 select * from user_sys_privs; --查看当前用户的表可操做权限 select * from user_tab_privs; --查看某一个表的约束,注意表名要 大写 select * from user_constraints where table_name='TBL_XXX'; --查看某一个表的全部索引,注意表名要 大写 select index_name,index_type,status,blevel from user_indexes where table_name = 'TBL_XXX'; --查看索引的构成,注意表名要 大写 select table_name,index_name,column_name, column_position FROM user_ind_columns WHERE table_name='TBL_XXX'; --系统数据字典 DBA_TABLESPACES 中记录了关于表空间的详细信息 select * from sys.dba_tablespaces; --查看用户序列 select * from user_sequences; --查看数据库序列 select * from dba_sequences;
后续有不少开发填坑的文章发布,若是对你有帮助,请支持和加关注一下
http://e22a.com/h.05ApkG?cv=AAKHZXVo&sm=339944
https://shop119727980.taobao.com/?spm=0.0.0.0