資料表空間,什麼是資料表空間

來源:互聯網
上載者:User

資料表空間,什麼是資料表空間

1.查看某個使用者對應的資料表空間和datafile
    select t1.username,t2.tablespace_name,t2.file_name,t1.temporary_tablespace ,t3.file_name
    from dba_users t1
    left join
         dba_data_files t2
    on    t1.default_tablespace = t2.tablespace_name
    left join
         dba_temp_files t3
    on   t1.temporary_tablespace = t3.tablespace_name
    where
      lower(t1.username) in  
     ('lbi_sys_ptcl','lbi_ods_ptcl','lbi_ods_ptcl','lbi_edm_ptcl','lbi_ls_ptcl','lbi_dm_ptcl','lbi_dim_ptcl')

2.產看錶空間資訊:
     (1)一般資料表空間查詢
        select * from dba_data_files t where t.tablespace_name in (
        'TBS_DIM_PTCL','TBS_LS_PTCL', 'TBS_ODS_PTCL', 'TBS_DM_PTCL',  'TBS_EDM_PTCL', 'TBS_SYS_PTCL'  );
      (2)暫存資料表空間查詢
       select * from dba_temp_files t where t.tablespace_name in ('TBS_TEMP_PTCL');

3.建立資料表空間
     (1)一般資料表空間
        create tablespace "TBS_DW_YM"
        nologging
        datafile '/opt/oracle/oradata/YM_tbs/TBS_DW_YM.dbf' size 50m
        extent management local segment space management  auto;
        --extent management:區管理
        --local segment space management :本地段空間管理
        --auto 自動管理,一般預設情況就是,如果想改為手動管理:manual
     (2)暫存資料表空間
        create
        temporary tablespace "TBS_YM_TEMP"
        tempfile '/opt/oracle/oradata/YM_tbs/TBS_YM_TEMP.dbf' size 50m
        reuse autoextend on next 640k maxsize 1000M;
        --reuse :重新運用,可以加可以不加
   


oracle怎建立資料表空間

用企業管理器(EM)或者sqlplus都可以,EM是圖形介面不說了。
如果用sqlplus,如下:
sqlplus / as sysdba
SQL>create tablespace tbsname datafile '檔案路徑及檔案名稱' size 500m;
 
oracle怎建立資料表空間

用企業管理器(EM)或者sqlplus都可以,EM是圖形介面不說了。
如果用sqlplus,如下:
sqlplus / as sysdba
SQL>create tablespace tbsname datafile '檔案路徑及檔案名稱' size 500m;
 

相關文章

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.