Oracle命令(三):Oracle用戶


1、顯示當前用戶名
  select user from dual;
  show user

2、顯示當然用戶有哪些表
  select * from tab;

3、顯示當所有用戶的表
  select * from user_tables;

4、顯示當有用戶可以訪問表
  select * from all_tables;

5、顯示用戶為SCOTT的表
  select * from dba_tables where owner='SCOTT';

6、顯示所有用戶名和帳戶的狀態
  select username,account_status from dba_users;

7、顯示所有用戶信息
  select * from dba_users;

8、將SCOTT帳號解鎖(加鎖)
  alter user scott account unlock(lock);

9、當前用戶的缺省表空間
  SELECT DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME=(select user from dual);

10、顯示當前數據庫的用戶
  SELECT USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE,TEMPORARY_TABLESPACE FROM DBA_USERS;

11、建立一個新用戶
  create user edpthw identified by "123456"
  default tablespace users
  temporary tablespace temp
  quota unlimited on users
  quota 10m on mytbs2;

12、給用戶授權
  grant connect,resource to edpthw;

13、分別授權
  GRANT CREATE ANY TABLE TO "hmtong"
  GRANT CREATE TABLE TO "hmtong"
  GRANT DROP ANY TABLE TO "hmtong"
  GRANT SELECT ANY TABLE TO "hmtong"

14、對象授權
  GRANT SELECT ON "hmtong"."A" TO "edpthw"

15、折消授權
  REVOKE UNLIMITED TABLESPACE FROM "hmtong"

16、折消對象授權
  REVOKE SELECT ON "hmtong"."A" FROM "edpthw"

17、用戶改密碼 

  alter user edpthw identified by edpthw;

18、授權sysdba給指定用戶
  grant sysdba to hmtong;

19、取消指定用戶的sysdba權限
  revoke sysdba from hmtong;

20、修改系統的授權的屬性
  alter system set remote_login_passwordfile=exclusive;

  能sysdba登錄,能授權
  alter system set remote_login_passwordfile=shared scope=spfile; 只能sysdba登錄,不能授權
  alter system set remote_login_passwordfile=NONE; 取消

21、授權連接給指定用戶
  GRANT "CONNECT" TO "hmtong"; GRANT UNLIMITED TABLESPACE,CONNECT,RESOURCE TO HMTONG;

22、查詢Pwfile中存放的用戶信息
  select * from v$pwfile_users;

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM