--查詢暫存資料表空間檔案的絕對路徑。如果需要的話,可以通過查詢來寫定絕對路徑。一般用${ORACLE_HOME}就可以了
select name from v$tempfile;
create temporary tablespace mpg_temp98 tempfile '${ORACLE_HOME}\oradata\mpg_temp98.bdf' size 100m reuse autoextend on next 20m maxsize unlimited;
4.建立資料表空間:
--查詢使用者資料表空間檔案的絕對路徑:
select name from v$datafile;
create tablespace MPG_DATA98 datafile '${ORACLE_HOME}\oradata\MPG_DATA98.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);
5.建立使用者和密碼,指定上邊建立的暫存資料表空間和資料表空間
create user mpg_admin98 identified by mpg_admin98 default tablespace MPG_DATA98 temporary tablespace mpg_temp98;
6.給使用者授予許可權 要給dba許可權*/
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, create any trigger,create table,
insert any table, update any table, delete any table ,unlimited tablespace,connect,resource,dba to mpg_admin98;
6.系統許可權回收:系統許可權只能由DBA使用者回收
命令:SQL> Revoke connect, resource,dba from mpg_admin98;
1.刪除某個使用者
drop user mpg_admin98 cascade;
/*刪除暫存資料表空間 */
--查看暫存資料表空間檔案
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 mpg_temp13 including contents and datafiles;
alter user mpg_admin13 temporary tablespace mpg_temp13;
drop user mpg_admin13 cascade;
select sid,serial# from v$session where username='mpg_admin13';
--修改使用者資料表空間
alter user mpg_admin13 default tablespace MPG_DATA13 ;--建立時候指定資料表空間
--刪除暫存資料表空間(刪除之前要確定沒用在使用)
drop tablespace MPG13_TEMP including CONTENTS and datafiles;
--刪除資料表空間
drop tablespace MPG13_DB including CONTENTS and datafiles;