日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle入门(七)之表空间

發(fā)布時間:2023/12/3 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle入门(七)之表空间 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

表空間

????表空間是數(shù)據(jù)庫的邏輯劃分,一個表空間只能屬于一個數(shù)據(jù)庫。所有的數(shù)據(jù)庫對象都存放在指定的表空間中。但主要存放的是表, 所以稱作表空間。

????Oracle數(shù)據(jù)庫中至少存在一個表空間,即SYSTEM的表空間。

(1)創(chuàng)建表空間

語法:

create? ?tablespace? ?表空間名? ?datafile/tempfile? 文件路徑? ?[size? 文件大小]? ? [autoextend on next? 新增文件大小]? ?[maxsize? 最大文件大小];

create tablespace tptest datafile 'd:/tptest01.dbf' size 10m autoextend on next 10m maxsize 1G;

(2)調整表空間

a.添加數(shù)據(jù)文件

alter tablespace tptest add datafile 'd:/tptest02.dbf' size 10m;

b.改變數(shù)據(jù)文件大小

alter tablespace?datafile ‘*.dbf’ autoextend on next??20M maxsize 1000M;

c.刪除數(shù)據(jù)文件

alter tablespace tablespace_name drop datafile file_name;

(3)查詢表空間

a.根據(jù)默認視圖查詢

select name from v$tablespace;

b.根據(jù)數(shù)據(jù)文件查詢表空間

select? file_name,tablespace_name?from dba_data_files order by tablespace_name;

c.統(tǒng)計數(shù)據(jù)文件使用率

select b.file_name 物理文件名, b.tablespace_name 表空間, b.bytes/1024/1024 大小M, (b.bytes - sum(nvl(a.bytes,0))) / 1024 / 1024 已使用M, substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率 from dba_free_space a, dba_data_files b where a.file_id = b.file_id group by b.tablespace_name, b.file_name, b.bytes order by b.tablespace_name;

(4)刪除表空間

drop tablespace tpname including contents and datafiles;

? ? ? ? 注:oracle表空間刪除數(shù)據(jù)文件未刪除

(5)表空間只讀

alter tablespace? tpname READ ONLY

(6)表空間離線在線

alter tablespace tpname OFFLINE/ONLINE

(7)表空間文件離線刪除

alter tablespace tpname datafile 'tpname.dbf' offline drop;


總結

以上是生活随笔為你收集整理的Oracle入门(七)之表空间的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。