diagnoza spatiu: alerta pe tablespace fara autoextend + prag propriu pe disc
This commit is contained in:
@@ -20,7 +20,19 @@ cu `diag_spatiu.ps1`; **email doar la prag depasit**, tacere completa altfel. Su
|
||||
`COMUN\docs\PACK_DIAG_SPATIU.pck`.
|
||||
|
||||
Sectiunile informative (recyclebin, UNDO, TEMP, istoric statistici/scheduler, top segmente, audit
|
||||
SYS, disc) se scriu doar cand exista deja o alerta — dau context, nu alerteaza singure.
|
||||
SYS) se scriu doar cand exista deja o alerta — dau context, nu alerteaza singure.
|
||||
|
||||
`co_2026_08_20_01_DIAG_SPATIU_PACK` (20.08.2026) inchide doua gauri prin care o baza blocata putea
|
||||
sa nu alerteze niciodata:
|
||||
|
||||
- **tablespace fara autoextend**: `dba_data_files.maxbytes` e 0, iar conditia `max_bytes > 0` il
|
||||
scotea complet din verificare, oricat de plin ar fi fost. Acum plafonul e
|
||||
`GREATEST(maxbytes, bytes)`, deci pentru un datafile fix maximul e chiar spatiul alocat. In log,
|
||||
maximul 0 se scrie `fara autoextend`, nu `0MB`.
|
||||
- **disc plin sub datafile autoextensibil**: tablespace-ul arata zeci de GB "poate creste", dar
|
||||
autoextend-ul pica. Sectiunea `DISC` are prag propriu (`tnPragDiscMb`, implicit 2048 MB liberi) si
|
||||
ruleaza mereu, prima; alerta ei deschide si sectiunile informative (`Verifica` o primeste prin
|
||||
`tnAlerteInitiale`). Inainte rula doar daca exista deja o alerta, deci nu putea declansa una.
|
||||
|
||||
`co_2026_08_06_08_DIAG_SPATIU_PACK` + `sys_2026_08_06_07_DIAG_SPATIU_GRANT3` (06.08.2026) scriu la
|
||||
top segmente si **tabela/coloana din care provine segmentul** (`DetaliuSegment`: `DBA_LOBS`,
|
||||
@@ -87,6 +99,15 @@ Emailurile ajung pe `marius.mutu@romfast.ro`, cate un expeditor per client
|
||||
- **ROA_CENTRAL** (`ORA-65114`, 02.08.2026): acelasi tipar, rezolvat prin curatenie tintita in loc
|
||||
de recreare PDB; SQL-uri gata scrise in acelasi repo (`docs/curatenie-spatiu-oracle.sql`).
|
||||
- **SIGMA** (03.08.2026): `SYSTEM` plafonat la 600 MB — vezi `depanare-pack-update.md`.
|
||||
- **VADECO** (XE 11.2, 20.08.2026): actualizarea a picat cu `ORA-00604` + `ORA-01654: unable to
|
||||
extend index SYS.I_IDL_CHAR1 in tablespace SYSTEM` la un `create package body` — eroarea n-are
|
||||
legatura cu scriptul: `IDL_CHAR$` e locul unde Oracle scrie codul PL/SQL. `SYSTEM` era 600 MB
|
||||
alocat cu `maxsize` tot 600 MB (autoextend pornit, dar la plafon), din care ~207 MB doar
|
||||
`SOURCE$`/`IDL_*` si 41 MB `SYS.INFO`. Deblocare: `alter database datafile '...\SYSTEM.DBF'
|
||||
autoextend on next 50m maxsize 2048m` (pe XE plafonul de 11 GB e pe date utilizator, nu pe
|
||||
`SYSTEM`), apoi reluarea actualizarii si `sys_2026_08_08_02` pentru `SYS.INFO`. Jobul de
|
||||
diagnostic n-ar fi ajutat: batch-ul murise inainte de `co_2026_08_03_02/03/04`, deci nu era
|
||||
instalat.
|
||||
|
||||
## Capcane
|
||||
|
||||
|
||||
@@ -174,21 +174,29 @@ with ts_free as (
|
||||
sum(greatest(f.maxbytes - f.bytes, 0)) creste_bytes
|
||||
from dba_data_files f
|
||||
group by f.tablespace_name
|
||||
)
|
||||
select a.tablespace_name,
|
||||
round(a.alocat_bytes/1048576) mb_alocat,
|
||||
round(a.max_bytes/1048576) mb_max,
|
||||
round(nvl(tf.free_bytes,0)/1048576) mb_liber,
|
||||
round((nvl(tf.free_bytes,0) + a.creste_bytes)/1048576) mb_poate_creste,
|
||||
case when a.max_bytes > 0 and (nvl(tf.free_bytes,0) + a.creste_bytes) <
|
||||
greatest($PragTsMb * 1048576, a.max_bytes * $PragTsPct / 100)
|
||||
then 'ATENTIE: APROAPE FARA LOC' end stare
|
||||
), calc as (
|
||||
select a.tablespace_name, a.alocat_bytes, a.max_bytes,
|
||||
nvl(tf.free_bytes,0) free_bytes,
|
||||
nvl(tf.free_bytes,0) + a.creste_bytes creste_total_bytes,
|
||||
greatest(a.max_bytes, a.alocat_bytes) limita_bytes
|
||||
from agg a, ts_free tf
|
||||
where a.tablespace_name = tf.tablespace_name(+)
|
||||
order by a.tablespace_name;
|
||||
)
|
||||
select c.tablespace_name,
|
||||
round(c.alocat_bytes/1048576) mb_alocat,
|
||||
round(c.max_bytes/1048576) mb_max,
|
||||
round(c.free_bytes/1048576) mb_liber,
|
||||
round(c.creste_total_bytes/1048576) mb_poate_creste,
|
||||
case when c.limita_bytes > 0 and c.creste_total_bytes <
|
||||
case when c.limita_bytes <= $PragTsMb * 1048576
|
||||
then c.limita_bytes * $PragTsPct / 100
|
||||
else greatest($PragTsMb * 1048576, c.limita_bytes * $PragTsPct / 100) end
|
||||
then 'ATENTIE: APROAPE FARA LOC' end stare
|
||||
from calc c
|
||||
order by c.tablespace_name;
|
||||
exit
|
||||
"@
|
||||
Show-Section -Title '2. SPATIU TABLESPACE (detaliu pe datafile + cat mai poate creste)' -Text ('mb_poate_creste = liber curent + (maxbytes - alocat) - spatiul real disponibil inainte de ORA-01653, nu doar liberul de acum.' + "`n" + ('Prag de atentie: sub ' + $PragTsMb + ' MB ramasi sau sub ' + $PragTsPct + '% din maximul tablespace-ului.') + "`n`n" + $r2.Text)
|
||||
Show-Section -Title '2. SPATIU TABLESPACE (detaliu pe datafile + cat mai poate creste)' -Text ('mb_poate_creste = liber curent + (maxbytes - alocat) - spatiul real disponibil inainte de ORA-01653, nu doar liberul de acum.' + "`n" + ('Prag de atentie: sub ' + $PragTsMb + ' MB ramasi sau sub ' + $PragTsPct + '% din maximul tablespace-ului; pe cele cu maximul sub prag (UNDO, SYSTEM mic) doar procentul, iar la datafile fara autoextend maximul e chiar spatiul alocat.') + "`n`n" + $r2.Text)
|
||||
|
||||
# tablespace-urile care au trecut pragul de atentie - top segmente acolo
|
||||
$r2m = Invoke-Sql -Sql @"
|
||||
@@ -196,16 +204,24 @@ set pagesize 0 linesize 100 trimspool on feedback off heading off
|
||||
with ts_free as (
|
||||
select tablespace_name, sum(bytes) free_bytes from dba_free_space group by tablespace_name
|
||||
), agg as (
|
||||
select f.tablespace_name, sum(f.maxbytes) max_bytes, sum(greatest(f.maxbytes - f.bytes, 0)) creste_bytes
|
||||
select f.tablespace_name, sum(f.bytes) alocat_bytes, sum(f.maxbytes) max_bytes,
|
||||
sum(greatest(f.maxbytes - f.bytes, 0)) creste_bytes
|
||||
from dba_data_files f
|
||||
group by f.tablespace_name
|
||||
)
|
||||
select 'TS_ATENTIE|' || a.tablespace_name
|
||||
), calc as (
|
||||
select a.tablespace_name,
|
||||
nvl(tf.free_bytes,0) + a.creste_bytes creste_total_bytes,
|
||||
greatest(a.max_bytes, a.alocat_bytes) limita_bytes
|
||||
from agg a, ts_free tf
|
||||
where a.tablespace_name = tf.tablespace_name(+)
|
||||
and a.max_bytes > 0
|
||||
and (nvl(tf.free_bytes,0) + a.creste_bytes) <
|
||||
greatest($PragTsMb * 1048576, a.max_bytes * $PragTsPct / 100);
|
||||
)
|
||||
select 'TS_ATENTIE|' || c.tablespace_name
|
||||
from calc c
|
||||
where c.limita_bytes > 0
|
||||
and c.creste_total_bytes <
|
||||
case when c.limita_bytes <= $PragTsMb * 1048576
|
||||
then c.limita_bytes * $PragTsPct / 100
|
||||
else greatest($PragTsMb * 1048576, c.limita_bytes * $PragTsPct / 100) end;
|
||||
exit
|
||||
"@
|
||||
$tsProblema = @($r2m.Text -split "`r?`n" | ForEach-Object { $_.Trim() } | Where-Object { $_.StartsWith('TS_ATENTIE|') } | ForEach-Object { $_.Substring(11) } | Where-Object { $_ -match '^[A-Z0-9_]+$' })
|
||||
|
||||
Reference in New Issue
Block a user