tablespaces
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tablespaces [2015/07/17 13:36] – z0hpvk | tablespaces [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== Tablespaces ==== | + | ===== Tablespaces |
| - | === Changing Undo Tablespace === | + | ==== Current Tablespace Usage ==== |
| - | == Create New Undo Tablespace == | + | <code SQL>SET PAGESIZE 140 LINESIZE 200 |
| + | |||
| + | COLUMN used_pct FORMAT A11 | ||
| + | COLUMN size_mb FORMAT 999,999 | ||
| + | COLUMN free_mb FORMAT 999,999 | ||
| + | COLUMN max_size_mb FORMAT 999,999 | ||
| + | COLUMN max_free_mb FORMAT 999,999 | ||
| + | |||
| + | SELECT tablespace_name, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | FROM ( | ||
| + | SELECT a.tablespace_name, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | FROM | ||
| + | | ||
| + | FROM | ||
| + | GROUP BY tablespace_name) a, | ||
| + | | ||
| + | | ||
| + | | ||
| + | FROM | ||
| + | GROUP BY tablespace_name) b | ||
| + | WHERE a.tablespace_name(+) = b.tablespace_name | ||
| + | ) | ||
| + | ORDER BY tablespace_name; | ||
| + | </ | ||
| + | |||
| + | ==== Changing Undo Tablespace | ||
| + | === Create New Undo Tablespace | ||
| < | < | ||
| - | == Switch databases to new undo tablespace == | + | === Switch databases to new undo tablespace |
| < | < | ||
| - | == Drop old undo tablespace == | + | === Drop old undo tablespace |
| < | < | ||
| - | == Potential Issues == | + | === Potential Issues |
| When doing the "drop undo tablespace" | When doing the "drop undo tablespace" | ||
| < | < | ||
| Line 25: | Line 60: | ||
| < | < | ||
| + | |||
| + | ==== Temporary Tablespace ==== | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | If this command hangs then there are probably sessions still using the old temp tablespace. \\ | ||
| + | Use the following SQL to find the sessions ... | ||
| + | < | ||
| + | | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | To discover what the default temporary tablespace is ... | ||
| + | < | ||
| + | |||
| + | ==== Data File Management ==== | ||
| + | < | ||
| + | ALTER TABLESPACE USERS ADD DATAFILE '/ | ||
| + | ALTER DATABASE DATAFILE '/ | ||
| + | </ | ||
| + | |||
| + | ==== Default Tablespaces ==== | ||
| + | <code SQL> | ||
| + | SELECT * FROM database_properties WHERE property_name like ' | ||
| + | </ | ||
| + | |||
| + | ==== Resize Data Files ==== | ||
| + | <code SQL> | ||
| + | -- Report on which data files can be shrunk | ||
| + | set verify off pagesize 50 linesize 120 | ||
| + | column file_name format a60 word_wrapped | ||
| + | column smallest format 999,990 heading " | ||
| + | column currsize format 999,990 heading " | ||
| + | column savings | ||
| + | break on report | ||
| + | compute sum of savings on report | ||
| + | column value new_val blksize | ||
| + | select file_name, | ||
| + | ceil( (nvl(hwm, | ||
| + | ceil( blocks*&& | ||
| + | ceil( blocks*&& | ||
| + | ceil( (nvl(hwm, | ||
| + | from dba_data_files a, | ||
| + | ( select file_id, max(block_id+blocks-1) hwm | ||
| + | from dba_extents | ||
| + | group by file_id ) b | ||
| + | where a.file_id = b.file_id(+) | ||
| + | order by savings desc; | ||
| + | </ | ||
| + | |||
tablespaces.1437140207.txt.gz · Last modified: (external edit)
