一、登陸linux,以oracle用戶登陸(若是是root用戶登陸的,登陸後用 su - oracle命令切換成oracle用戶)linux
二、以sysdba方式來打開sqlplus,命令以下: sqlplus / as sysdbasql
三、建立臨時表空間:數據庫
--查詢臨時表空間文件的絕對路徑。若是須要的話,能夠經過查詢來寫定絕對路徑。通常用${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;
四、建立表空間:oracle
--查詢用戶表空間文件的絕對路徑: 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);
五、建立用戶和密碼,指定上邊建立的臨時表空間和表空間ide
create user hc_notify identified by hc_password default tablespace NOTIFYDB temporary tablespace NOTIFYDB_TEMP;
六、賦予權限spa
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登陸指定的實例,建立咱們本身的表了。code
一、查看用戶權限對象
--查看用戶要具有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.刪除用戶表空間it
--查看錶空間文件 select name from v$datafile; --中止表空間的在線使用 alter tablespace 表空間名稱 offline; --刪除表空間NOTIFYDB_TEMP及其包含數據對象以及數據文件 drop tablespace NOTIFYDB_TEMP including contents and datafiles;
Oracle用戶權限查詢相關操做:
--查看全部的用戶 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;