posts - 0, comments - 77, trackbacks - 0, articles - 356
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          oracle 10g表空間操作

          Posted on 2008-02-24 17:28 semovy 閱讀(1686) 評論(0)  編輯  收藏 所屬分類: Oracle數據庫方面

          ---------------------------------------------- -表空間的操作----------------------------------------------------

          1.創建表空間:

          create tablespace tablespace_name datafile 'filepath' size filesize autoextend on next autosize maxsize filemaxsize [unlimited]

          eg:

          create tablespace sales datafile 'c:\1.txt' size 10m autoextend on next 1m maxsize 100m

          2.為表空間增加數據文件:

          alter tablespace tablespace_name add datafile 'filepath' size filesize autoextend on next autosize maxsize filemaxsize[unlimited]

          eg:

          alter tablespace sales datafile 'c:\2.txt' size 10m autoextend on next 1m maxsize unlimited

          3.調整表空間:

          alter database datafile 'filepath' resize filesize--重置表空間的大小

          eg:

          alter database datafile 'c:\2.txt' resize 10m

          4.關閉表空間的自動擴展屬性:

          alter database datafile 'filepath' autoextend off

          eg:

          alter database datafile 'c:\2.txt' autoextend off

          5.打開表空間的自動擴展屬性:

          alter database datafile 'filepath' autoextend on

          eg:

          alter database datafile 'c:\2.txt' autoextend on

          6.使表空間脫機:

          alter tablespace tablespace_name offline

          7.使表空間聯機:

          alter tablespace tablespace_name online

          8.設置表空間為只讀:

          alter tablespace tablespace_name read only

          9.設置表空間為讀寫:

          alter tablespace tablespace_name read write

          11.刪除表空間:

          drop tablespace tablespace_name

          12.刪除表空間的同時,刪除數據文件

          drop tablespace tablespace_name including contents and datefiles

          13.查看每個表空間占用空間的大小:

          select tablespace_name,sum(bytes)/1024/1024 from dba_segments group by tablespace_name

          10.移動表空間數據文件步驟:

          a.使表空間脫機:alter tablespace tablespace_name offline

          b.物理移動數據文件到目的地(可以是表空間的部分數據文件或者是修改數據文件的名稱)

          c.邏輯移動:alter tablespace tablespace_name rename datafile '源文件地址'to '目的文件地址'--注意可以將多個源文件轉移到同一個目的文件地址(多個源文件地址用逗號分隔)

          d.將表空間聯機:alter tablespace tablespace_name online

          11.查詢表空間的信息:

          select tablespace_name,bytes/1024/1024  file_size_mb,file_name from DBA_DATE_FILES--注意書籍庫中的實體都是以大寫表示

          12.當數據文件被刪除的時候,如果對該數據文件操作的時候,oracle會報不能找到該數據文件的錯誤。如何處理。

          1shutdown—關閉oracle實例

          2startup  --開啟oracle實例并打開數據庫

          3alter database datafile ‘datafile_name’ offline drop;

          4alter database open

          ------------------------------------------------------------------------------------------------------------------

          主站蜘蛛池模板: 安岳县| 荣成市| 万荣县| 安化县| 滕州市| 若羌县| 依安县| 合肥市| 信宜市| 永川市| 霍城县| 吉木萨尔县| 封丘县| 治多县| 天祝| 迁安市| 潞城市| 金湖县| 台安县| 运城市| 前郭尔| 库车县| 岳池县| 临安市| 酉阳| 平果县| 固镇县| 临泽县| 武城县| 榆林市| 乐陵市| 务川| 冷水江市| 灵丘县| 信丰县| 盐边县| 凯里市| 安龙县| 文山县| 陆良县| 玛多县|