oracle有關表空間的基本操作

2021-05-25 13:30:25 字數 1396 閱讀 8800

建立表空間

create tablespace students_managent

datafile 'e:\oracle\product\10.2.0\da913047\data\da91304701_students_management.dbf' size 50m,

'e:\oracle\product\10.2.0\da913047\data\da91304702_students_management.dbf' size 50m

autoextend on 

next 2m

online;

建立還原表空間 create undo tablespace students_managent

建立臨時表空間 create temp tablespace students_managent

設定預設臨時表空間 alter database default temporary tablespace students_managent;

修改表空間為唯讀

alter tablespace students_managent read only;

修改表空間為正常狀態

alter tablespace students_managent read write;

重置表空間的大小

alter database datafile 'e:\oracle\product\10.2.0\oradata\oracle\students_managent.dbf' autoextend on next 5m;

手工重置資料檔案的大小

alter tablespace students_managent add datafile 'e:\oracle\product\10.2.0\oradata\oracle\students_managent.dbf' size 100m

或者alter database 'e:\oracle\product\10.2.0\oradata\oracle\students_managent.dbf' resize 200m;

資料字典和本地管理表空間的轉換

execute dbms_space_admin.tablespace_migrate_to_local('students_managent');//轉換為本地管理

execute dbms_space_admin.tablespace_migrate_from_local('students_managent');//轉換為資料字典管理

刪除表空間 

drop tablespace students_managent//只刪除了控制檔案中指向資料檔案的指標,沒有刪除資料檔案本身。

drop tablespace students_managent include contents and datafiles;//資料檔案被刪除。

oracle基本表空間

表空間1 管理表空間 表空間結構 sql desc dba tablespaces select from dba tablespaces 查詢表空間管理型別是否是本地管理 select tablespace name,extent management,allocation type from d...

oracle中的表空間以及和表空間有關的操作

oracle中表空間 表空間是oracle對物理資料庫上相關資料檔案的邏輯對映。乙個資料庫邏輯上被劃分成乙個或若干個表空間,每個表空間包含了在邏輯上相關聯的一組結構。每個資料庫至少有乙個表空間 system表空間 每個表空間由同一磁碟上的乙個或者多個檔案組成,這些檔案就是資料檔案。乙個資料檔案只能屬...

Oracle 表空間基本操作

1.查詢資料庫現在的表空間 select tablespace name,file name,sum bytes 1024 1024 table size from dba data files group by tablespace name,file name 2.建立表空間 create ta...