Oracle表空間增加資料檔案

2021-08-20 14:41:32 字數 1876 閱讀 6018

快速解決:

可以登入pl/sql developer工具,選單上選擇表空間管理,佔用率排序,找到那個占用滿了的表空間,然後增加資料檔案即可

和alter tablespace users add datafile 『/ora/oracle/oradata/datafile.dbf』 size 2048這句的效果是一樣的。

表空間操作

//表空間查詢

select tablespace_name,sum(bytes/1024/1024) from dba_free_space where tablespace_name = 『system』 group by tablespace_name

//表空間剩餘容量

select * from dba_free_space where tablespace_name =』ts_mdsp_data 『;

//表空間的位置

select * from dba_data_files

//查詢表空間剩餘容量和總容量相當於在管理工具中檢視表空間管理

select ef.tablespace_name, round(ef.used_space/(1024*1024)) used_space, round(fs.total_space/(1024*1024)) total_space, round(ef.used_space/fs.total_space*100,2) used_rate, round((fs.total_space-ef.used_space)/fs.total_space*100,2) free_rate from (select cf.tablespace_name,sum(df.bytes – cf.free_bytes) used_space from(select tablespace_name, file_id, sum(bytes) free_bytes from dba_free_space group by tablespace_name, file_id ) cf,dba_data_files df where cf.tablespace_name = df.tablespace_name and cf.file_id = df.file_id group by cf.tablespace_name) ef,( select tablespace_name, sum(case when autoextensible=』yes』 then maxbytes else bytes end) total_space from dba_data_files group by tablespace_name) fs where ef.tablespace_name = fs.tablespace_name;

-**************************************-

select round(4194303*value/(1024*1024*1024),2) maxfilesizegbyte from v$parameter where name=』db_block_size』

select round(4194303*value/(1024*1024*1024),2) maxfilesizegbyte from v$parameter where name=』db_block_size』

—增加資料檔案

alter tablespace users add datafile 『/ora/oracle/oradata/datafile.dbf』 size 2048

—擴大資料檔案

alter tablespace datafile 『/ora/oracle/oradata/datafile.dbf』 resize 2048m

表空間相關操作內容**:

表空間,建立使用者,授權,表空間增加資料檔案

表空間 表空間 create tablespace ry ts datafile c ts ry.dbf size 3000m autoextend on next 100m 建立使用者 建立使用者 create user ry 使用者 identified by ry 密碼 default tab...

為ORACLE表空間或臨時表空間增加資料檔案

背景 當通過oracle中的create table as select 語句建立一張新錶時,新錶的資料量為比較大,如10億,這時sql plus很可能就會提示 ora 01653 錯誤資訊。這個錯誤資訊暗示表空間大小不夠,需要為表空間增加資料檔案。分析 1.查詢表空間剩餘位元組大小 select ...

增加資料庫表內容

背景 當前資料庫中已有部分資料,因需用到更多資料,因此要對資料庫表增加 拷貝 一行內容。步驟 1.新新增乙個表,和已有game起相似的名字,如game1,即為 create table game1 as select from game 2.在新錶中更新欄位的資料 自增id 即 update gam...