/* 步驟: 1、創建表空間 2、創建用戶 3、用戶授權 */ /*創建表空間*/ create tablespace QCJ_TABLESPACE /*表空間物理文件名稱*/ datafile 'QCJ_TABLESPACE.dbf' -- 這種方式指定表空間物理文件位置 -- datafile ...
/*
步驟:
1、創建表空間
2、創建用戶
3、用戶授權
*/
/*創建表空間*/
create tablespace QCJ_TABLESPACE
/*表空間物理文件名稱*/
datafile 'QCJ_TABLESPACE.dbf'
-- 這種方式指定表空間物理文件位置
-- datafile 'F:\APP\QIUCHANGJIN\ORADATA\ORCL\QCJ_TABLESPACE.dbf'
-- 大小 500M,每次 5M 自動增大,最大不限制
size 500M autoextend on next 5M maxsize unlimited;
/* 創建用戶*/
create user qiuchangjin
IDENTIFIED BY root --用戶密碼
default tablespace QCJ_TABLESPACE-- 表空間是上面創建的
temporary tablespace TEMP -- 臨時表空間預設 TEMP
profile DEFAULT;
--password expire;
/*密碼過期需要重設密碼,意思是當你用這個新建立的密碼過期用戶首次登錄後,系統會提示你重新輸入新密碼,不然會拒絕你登陸,重設新密碼後就可以登錄,該用戶的密碼就是你新設的密碼,相當於首次登錄修改密碼這樣的選項。*/
/* 用戶授權_1*/
grant connect,resource,dba to qiuchangjin;
/* 用戶授權_2*/
grant connect to qiuchangjin with admin option;
grant dba to qiuchangjin with admin option;
grant resource to qiuchangjin with admin option;
/*查詢所有表空間物理位置*/
select name from v$datafile;
/*查詢當前用戶的表空間*/
select username,default_tablespace from user_users;
/*修改用戶的預設表空間*/
alter user 用戶名 default tablespace 新表空間;
/*查詢所有的表空間*/
select * from user_tablespaces;
/* 刪除表空間*/
alter tablespace QCJ_TABLESPACE offline;
drop tablespace QCJ_TABLESPACE including contents and datafiles;