使用者相關
解鎖使用者
授予使用者dba權限
建立一個使用者
知識點
檢視一個使用者的角色
檢視資料庫中所有的使用者
檢視某個使用者所擁有的表
檢視目前使用者所擁有的所有表
oracle預置使用者
檢視表空間
檢視使用者所在的表空間
查詢目前使用者的資料庫
删除使用者
先鎖定使用者:
擷取sid和serial id
關閉對應會話
最後删除使用者
檢視目前的資料庫名
理論知識
表空間概念
使用system進行登入(或者直接使用<code>sqlplus "/as sysdba"</code>),登陸後執行:
<code>alter user 要解鎖的使用者名 account unlock;</code>
使用system進行登入,登陸後執行:
<code>grant connect,resource,dba to 要授予dba權限的使用者名;</code>
<code>create user ot identified by orcl1234;</code>
建立一個使用者,使用者名為<code>ot</code>,密碼為<code>orcl1234</code>
同一個資料庫,使用不同的非系統自帶使用者登入,檢視所有的表時,結果是不同的,查詢結果隻會顯示該使用者建立的表
<code>select * from dba_role_privs where grantee='你想查詢的使用者';</code>
可以從這個查詢結果中判斷使用者是否具有dba權限
<code>select * from all_users</code>
<code>select * from all_tables where owner='test';</code>
<code>select table_name from user_tables;</code>
https://www.cnblogs.com/feiyun8616/p/6497690.html
<code>select tablespace_name from dba_tablespaces;</code>
<code>select username,default_tablespace from dba_users order by username;</code>
<code>select * from v$database;</code>
ot使我們要删除的使用者
<code>alter user ot account lock;</code>
<code>select * from v$session where username='ot';</code>
<code>alter system kill session 'sid,serialid</code>
<code>drop user ot cascade</code>
<code>select name from v$database;</code>
表空間
資料庫的邏輯存儲空間,可以了解為在資料庫中開辟的空間用來存儲資料庫對象(虛拟空間,沒有确定的大小)
表空間和資料庫檔案的關系
表空間由一個或多個資料檔案組成,資料檔案的大小和位置可以自己定義