Oracle建立資料表空間和使用者

來源:互聯網
上載者:User

標籤:io   ar   os   使用   sp   strong   資料   on   div   

    建立資料表空間和使用者的步驟:  

  1. 使用者  
  2. 建立:create user 使用者名稱 identified by "密碼";  
  3. 授權:grant create session to 使用者名稱;  
  4.             grant create table to  使用者名稱;  
  5.             grant create tablespace to  使用者名稱;  
  6.             grant create view to  使用者名稱;  
建立資料表空間和使用者的步驟:使用者建立:create user 使用者名稱 identified by "密碼";授權:grant create session to 使用者名稱;            grant create table to  使用者名稱;            grant create tablespace to  使用者名稱;            grant create view to  使用者名稱;

 

 
  1. 資料表空間  
  2. 建立資料表空間(一般建N個存資料的資料表空間和一個索引空間):  
  3. create tablespace 資料表空間名  
  4. datafile ‘ 路徑(要先建好路徑)\***.dbf  ‘ size *M  
  5. tempfile ‘ 路徑\***.dbf ‘ size *M  
  6. autoextend on  --自動成長   
  7. --還有一些定義大小的命令,看需要   
  8.  default storage(  
  9.  initial 100K,  
  10.  next 100k,  
  11. );  
資料表空間建立資料表空間(一般建N個存資料的資料表空間和一個索引空間):create tablespace 資料表空間名datafile ‘ 路徑(要先建好路徑)\***.dbf  ‘ size *Mtempfile ‘ 路徑\***.dbf ‘ size *Mautoextend on  --自動成長--還有一些定義大小的命令,看需要 default storage( initial 100K, next 100k,);
 
  1. 例子:建立資料表空間  
  2. create tablespace DEMOSPACE   
  3. datafile ‘E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf‘   
  4. size 1500M   
  5. autoextend on next 5M maxsize 3000M;  
  6. 刪除資料表空間  
  7. drop tablespace DEMOSPACE including contents and datafiles  
例子:建立資料表空間create tablespace DEMOSPACE datafile ‘E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf‘ size 1500M autoextend on next 5M maxsize 3000M;刪除資料表空間drop tablespace DEMOSPACE including contents and datafiles

 

  1. 使用者權限  
  2. 授予使用者使用資料表空間的許可權:  
  3. alter user 使用者名稱 quota unlimited on 資料表空間;  
  4. 或 alter user 使用者名稱 quota *M on 資料表空間;  
使用者權限授予使用者使用資料表空間的許可權:alter user 使用者名稱 quota unlimited on 資料表空間;或 alter user 使用者名稱 quota *M on 資料表空間;


完整例子:

 

  1. --資料表空間   
  2. CREATE TABLESPACE sdt  
  3. DATAFILE ‘F:\tablespace\demo‘ size 800M  
  4.          EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;   
  5. --索引資料表空間   
  6. CREATE TABLESPACE sdt_Index  
  7. DATAFILE ‘F:\tablespace\demo‘ size 512M           
  8.          EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;       
  9.   
  10. --2.建使用者   
  11. create user demo identified by demo   
  12. default tablespace demo;  
  13.    
  14. --3.賦權   
  15. grant connect,resource to demo;  
  16. grant create any sequence to demo;  
  17. grant create any table to demo;  
  18. grant delete any table to demo;  
  19. grant insert any table to demo;  
  20. grant select any table to demo;  
  21. grant unlimited tablespace to demo;  
  22. grant execute any procedure to demo;  
  23. grant update any table to demo;  
  24. grant create any view to demo;  
--資料表空間CREATE TABLESPACE sdtDATAFILE ‘F:\tablespace\demo‘ size 800M         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; --索引資料表空間CREATE TABLESPACE sdt_IndexDATAFILE ‘F:\tablespace\demo‘ size 512M                  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;     --2.建使用者create user demo identified by demo default tablespace demo; --3.賦權grant connect,resource to demo;grant create any sequence to demo;grant create any table to demo;grant delete any table to demo;grant insert any table to demo;grant select any table to demo;grant unlimited tablespace to demo;grant execute any procedure to demo;grant update any table to demo;grant create any view to demo;
 
  1. --匯入匯出命令      
  2. ip匯出方式: exp demo/[email protected]:1521/orcl file=f:/f.dmp full=y  
  3. exp demo/[email protected] file=f:/f.dmp full=y  
  4. imp demo/[email protected] file=f:/f.dmp full=y ignore=y  

Oracle建立資料表空間和使用者

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.