undoファイルの拡張・縮小

(8.0.22)
https://dev.mysql.com/doc/refman/8.0/ja/innodb-undo-tablespaces.html

 

undoファイルの拡張・縮小はできない

undo表領域の追加、削除は可能

SELECT * FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE LIKE 'UNDO LOG'\G


CREATE UNDO TABLESPACE undo_003 ADD DATAFILE 'undo_003.ibu';

ALTER UNDO TABLESPACE undo_003 SET INACTIVE;

SELECT NAME, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
WHERE NAME LIKE 'undo%';

DROP UNDO TABLESPACE undo_003;

(19c)

drop tablespace undo2 including contents and datafiles;
create undo tablespace undo2 datafile '/u01/app/oracle/oradata/ORCL/pdb1/undo2.dbf' size 10M autoextend off;

show parameter undo

alter system set undo_tablespace='UNDO2' scope=both;


select
d.tablespace_name,
d.mbytes "total[MB]",
NVL(f.mbytes,0) "free[MB]",
d.mbytes - NVL(f.mbytes,0) "used[MB]",
(1 - (NVL(f.mbytes,0)/d.mbytes))*100 "used_percent"
from
(SELECT tablespace_name, (SUM(bytes)/(1024*1024)) mbytes
FROM dba_data_files GROUP BY tablespace_name) d
left outer join
(SELECT tablespace_name, (SUM(bytes)/(1024*1024)) mbytes
FROM dba_free_space GROUP BY tablespace_name) f
on d.tablespace_name=f.tablespace_name
;


サイズ指定の拡張
alter database datafile '/u01/app/oracle/oradata/ORCL/pdb1/undo2.dbf' resize 11M;


サイズ指定の縮小
alter database datafile '/u01/app/oracle/oradata/ORCL/pdb1/undo2.dbf' resize 10M;

格納されているデータ サイズ以下に縮小はできない


ファイル追加
alter tablespace undo2 add datafile '/u01/app/oracle/oradata/ORCL/pdb1/undo22.dbf' size 10M autoextend off;

ファイル削除
alter tablespace undo2 drop datafile '/u01/app/oracle/oradata/ORCL/pdb1/undo22.dbf';

 

(13)
undoファイルなし

 

(2019)
https://support.microsoft.com/ja-jp/topic/sql-server-%E3%81%A7-tempdb-%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9%E3%82%92%E5%9C%A7%E7%B8%AE%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95-ea0a95c2-eff8-7075-9ee2-2ee42226ca1c

select database_id,name,file_id,physical_name,size * 8/1024 mbyte
from sys.master_files
;
exec sp_spaceused


サイズ指定の拡張

use tempdb
alter database tempdb modify file (name = tempdev , SIZE = 16MB);

サイズ指定の縮小

use tempdb
dbcc shrinkfile('tempdev' , 8)

※target_sizeはMB単位
格納されているデータ サイズ以下に、ファイルを圧縮することはできません。


tempファイルの追加

alter database tempdb add file
(name = tempdev2 ,filename = 'C:\test\tempdev2.ndf', SIZE = 8MB , FILEGROWTH = 64MB
)
;

ユーザ定義ファイルグループはtempdbでは許可されません

tempファイルの削除

alter database tempdb remove file tempdev2;

ファイルが空でない場合は削除できません
→シングルユーザモードで起動して削除できた