oracle資料庫建立 刪除表空間

2021-07-22 23:48:50 字數 1395 閱讀 6799

--建立資料表空間:

create tablespace tests_data

logging

datafile 'd:\orcl\oradata\orcl\tablespace1.dbf'

size 50m

autoextend on

next 50m maxsize 20480m

extent management local;

--建立臨時表空間

create temporary tablespace temptbsp

tempfile 'd:\orcl\oradata\orcl\tablespace2.dbf'

size 200

autoextend on

next 50m maxsize 20480m

extent management local;

--在建立表時,這樣你所建立的表便在指定的空間下了

create table table_name() tablespace tablespace_name;

--刪除空的表空間,但是不包含物理檔案

drop tablespace tablespace_name;

--刪除非空表空間,但是不包含物理檔案

drop tablespace tablespace_name including contents;

--刪除空表空間,包含物理檔案

drop tablespace tablespace_name including datafiles;

--刪除非空表空間,包含物理檔案

drop tablespace tablespace_name including contents and datafiles;

--oracle查詢表空間檔案所在路徑

select * from dba_data_files;

--檢視使用者和預設表空間的關係

select username,default_tablespace from dba_users;

--檢視所有表空間大小

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

--未使用的表空間大小

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

--修改表空間大小

alter tablespace maxdata add datafile 'd:\orcl\oradata\orcl\tablespace1.dbf' size1000m;

Oracle匯出空表資料庫

經常我們在匯出資料庫進行備份的時候,會發現有些空表沒有匯出,如何匯出包含空表的完整資料庫呢?那麼請按照下面的方法進行即可。1.使用plsql工具,連線oracle資料庫 2.開啟乙個sql視窗,用以下這句查詢空表並生成執行命令 1select alter table table name alloc...

oracle資料庫建立表

實際工作中,在資料庫中建立表是經常會用到的。我們今天呢?主要給大家來分享一下在資料庫如何通過sql語句去建立表。其實,建立表很簡單,只需要把資料庫的資料型別和約束搞清楚就可以了,其他的就好說了。接下來呢,開始我的表演。首先,先使用plsql連線到oracle資料庫,先保證下面的服務是開啟的。我們本次...

Oracle建立 刪除資料庫

在我們將乙個專案資料庫移植到另外乙個計算機上的時候我們通常需要新建資料庫。它的操作步驟是 開始 所有程式 oracle oradb10 home1 配置和移植工具 database configration assistant 在這個工具中我們相應的有 建立資料庫 刪除資料庫 管理模板等等。我們選擇...