表空间

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 :又一次运用,能够加能够不加
   

posted @ 2016-03-22 10:36  yxwkaifa  阅读(221)  评论(0编辑  收藏  举报