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

          日歷

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          隨筆分類

          隨筆檔案(1)

          收藏夾(18)

          搜索

          •  

          最新評論

          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

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

          主站蜘蛛池模板: 灵石县| 池州市| 建瓯市| 雅江县| 京山县| 二连浩特市| 登封市| 中卫市| 镇平县| 旬阳县| 北辰区| 舒兰市| 灵宝市| 亚东县| 万山特区| 天镇县| 东阿县| 宜黄县| 大埔县| 孟津县| 泰顺县| 萍乡市| 平陆县| 湘阴县| 福州市| 定州市| 千阳县| 德化县| 岚皋县| 本溪市| 织金县| 临汾市| 武夷山市| 镇康县| 娱乐| 鸡东县| 丽江市| 房产| 佳木斯市| 黄梅县| 台山市|