熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Oracle創建表空間、創建用戶以及授權、查看權限

2022-06-13   來源: Oracle 

  創建臨時表空間創建臨時表空間

  CREATE TEMPORARY TABLESPACE test_temp

  TEMPFILE C:oracleproductoradataorcltest_tempdbf

  SIZE M

  AUTOEXTEND ON

  NEXT M MAXSIZE M

  EXTENT MANAGEMENT LOCAL;

  創建表空間

  CREATE TABLESPACE HISTDB

  datafile D:oracleproductoradataZJGIStest_tempdbf

  SIZE M

  AUTOEXTEND ON

  NEXT M MAXSIZE M

  EXTENT MANAGEMENT LOCAL;

  創建用戶並指定表空間

  CREATE USER username IDENTIFIED BY password

  DEFAULT TABLESPACE TEST_DATA

  TEMPORARY TABLESPACE TEST_TEMP;

  給用戶授予權限

  GRANT

  CREATE SESSION CREATE ANY TABLE CREATE ANY VIEW CREATE ANY INDEX CREATE ANY PROCEDURE

  ALTER ANY TABLE ALTER ANY PROCEDURE

  DROP ANY TABLE DROP ANY VIEW DROP ANY INDEX DROP ANY PROCEDURE

  SELECT ANY TABLE INSERT ANY TABLE UPDATE ANY TABLE DELETE ANY TABLE

  TO username;

  

  /*分為四步 */

  /*第創建臨時表空間 */

  create temporary tablespace user_temp

  tempfile D:oracleoradataOracleiuser_tempdbf

  size m

  autoextend on

  next m maxsize m

  extent management local;

  /*第創建數據表空間 */

  create tablespace user_data

  logging

  datafile D:oracleoradataOracleiuser_datadbf

  size m

  autoextend on

  next m maxsize m

  extent management local;

  /*第創建用戶並指定表空間 */

  create user username identified by password

  default tablespace user_data

  temporary tablespace user_temp;

  /*第給用戶授予權限 */

  grant connectresourcedba to username;

  

  查看用戶權限

  查看所有用戶

  查看所有用戶

  SELECT * FROM DBA_USERS;

  SELECT * FROM ALL_USERS;

  SELECT * FROM USER_USERS;

  查看用戶系統權限

  查看用戶系統權限

  SELECT * FROM DBA_SYS_PRIVS;

  SELECT * FROM USER_SYS_PRIVS;

  查看用戶對象或角色權限

  查看用戶對象權限

  SELECT * FROM DBA_TAB_PRIVS;

  SELECT * FROM ALL_TAB_PRIVS;

  SELECT * FROM USER_TAB_PRIVS;

  查看所有角色

  查看所有用戶

  SELECT * FROM DBA_ROLES;

  查看用戶或角色所擁有的角色

  查看用戶或角色所擁有的角色

  SELECT * FROM DBA_ROLE_PRIVS;

  SELECT * FROM USER_ROLE_PRIVS;

  刪除新建用戶

  刪除用戶

  drop user username

  刪新建表空間

  刪除用戶

  drop tablespace tablespaceName


From:http://tw.wingwit.com/Article/program/Oracle/201311/19013.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.