Return-Path: <oracle-l-bounce@freelists.org>
X-Original-To: oracle-l@orafaq.com
Delivered-To: oracle-l@orafaq.com
Received: from turing.freelists.org (turing.freelists.org [206.53.239.180])
 by malta2546.startdedicated.com (Postfix) with ESMTPS id 995FA10031450E
 for <oracle-l@orafaq.com>; Tue,  5 May 2020 21:36:15 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 6E200236FD;
 Tue,  5 May 2020 15:36:14 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1588707374;
 bh=hs0Kzt5IlPlCUi0WGTDt1McsAbedgHKBAPwVJr5cho4=;
 h=From:Sender:Sender:From;
 b=lGSlCt0A+KGsTg0y43jfIFT3yqPZIdgCBMv14e0eqjxnijJD0rx5Aw9UqWhshJI0K
	 vHztu/+s/TBij85rCTzLotc2UxF41v5V0TaIYXZ1+0qWVucImd0yRLNEqU/wBjjjkg
	 upFZDrK8RjmnK40A258Cs+9RscXPq6/aOCZXsbOQ=
X-Virus-Scanned: Debian amavisd-new at turing.freelists.org
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id rq1CHKCYhqBP; Tue,  5 May 2020 15:36:13 -0400 (EDT)
Received: from turing.freelists.org (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 883AA22CF5;
 Tue,  5 May 2020 15:35:24 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org;
 s=turing; t=1588707368;
 bh=hs0Kzt5IlPlCUi0WGTDt1McsAbedgHKBAPwVJr5cho4=;
 h=From:Sender:Sender:From;
 b=cSy1mImAf7dKBV5Dq74QQkCsTSEkTriB2iJ51Iohb8TFDcJyCDmjGZ2yCOffVC0ZF
	 6H5vQXPdZ4oXEniigsk5VKY41rl0HTLq1V9tEZcwTMv2X/ZS0Kfgb9H+nNr36kkpIM
	 0XKVQb4YdpCeeNcMj7BwUF5x65C0OS9AngHCrLXs=
Received: with ECARTIS (v1.0.0; list oracle-l); Tue, 05 May 2020 15:34:39 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 5A6BF2240E
 for <oracle-l@freelists.org>; Tue,  5 May 2020 15:34:39 -0400 (EDT)
Authentication-Results: turing.freelists.org;
 dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rkbeJyeb";
 dkim-atps=neutral
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id yab-zLMToerQ for <oracle-l@freelists.org>;
 Tue,  5 May 2020 15:34:39 -0400 (EDT)
Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 1D2A12277C
 for <oracle-l@freelists.org>; Tue,  5 May 2020 15:34:39 -0400 (EDT)
Received: by mail-qk1-f175.google.com with SMTP id s9so3617423qkm.6
        for <oracle-l@freelists.org>; Tue, 05 May 2020 12:34:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to;
        bh=H6vYmDVsZzRgJqeIf3JcCdYadB77CAvb97E9wHLCtSc=;
        b=cezqIeyFFSz+4mAgJgfqoFfrHsj/Gmd5SHoz40KdEJyxHQgk12xQedF0XPSNXgF+3J
         82m5w9DDeWrhLLPBdlIMR/4WANPePiBR25k+8SfRsHFuVZzbxvrYO+pDVxUkUFcKCPoO
         qygQ77mrKCAxBiBWVqm2WvR0J5YZHmwjDIrWXVmMxrt8is6Hb/Ku728COVTQyzJOdMLd
         uXB9MQZ6vSfKh+6T85UBAzsxraAbt1SOUaFoP5DozJwc9u0TVlrBBGBIt0WVFHzl0m6R
         8y8eF/W6dJrRyJkZ/a1bBHocm9PHwgqkBYOBfIXR0R8Q3CS3A/tCe5TMLyI8JSQ94RoQ
         nlqA==
X-Gm-Message-State: AGi0PuYLWz20zbNjIgR8Mt7Xv4mwtP/VGeHHDaPmI7fLv/iF/djaKtX8
 x3fN7J005budOZCbrYayQ1DI/MpiFGBg47FALymx1Ja6NL8=
X-Google-Smtp-Source: APiQypIKfpbmxpQLuM8/0XFPA4iSDm4qIsv7uC+GI0GXvvU3bBYsQT2k4zqLaPuJKg4KViRNjjUEl3NBMK1gIVhcOKA=
X-Received: by 2002:a05:620a:16b0:: with SMTP id s16mr5293993qkj.204.1588707278064;
 Tue, 05 May 2020 12:34:38 -0700 (PDT)
MIME-Version: 1.0
References: <CAHSa0M3D1GTdwajgBu3MNPRSgxwLtjhtq0vgNVFi8OB7EU4ccg@mail.gmail.com>
 <eface1e6f5917d8100e832231c4dc39578116877.camel@gmail.com> <CAHSa0M0PFSq=v0mu6_SS-W=Gbdrup4QGc_-TDVthyq9pvHny2Q@mail.gmail.com>
In-Reply-To: <CAHSa0M0PFSq=v0mu6_SS-W=Gbdrup4QGc_-TDVthyq9pvHny2Q@mail.gmail.com>
From: Jonathan Lewis <jlewisoracle@gmail.com>
Date: Tue, 5 May 2020 20:34:26 +0100
Message-ID: <CAGtsp8=k+2FuLiXC0UFXNnHwOPWxKch8XBr=o0jgdysYXQi41g@mail.gmail.com>
Subject: Re: Space explanation
To: ORACLE-L <oracle-l@freelists.org>
Content-Type: multipart/alternative; boundary="000000000000f60e0505a4ebbc09"
X-archive-position: 76850
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: jlewisoracle@gmail.com
Precedence: normal
Reply-To: jlewisoracle@gmail.com
List-Help: <mailto:ecartis@freelists.org?Subject=help>
List-Unsubscribe: <mailto:oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-Subscribe: <mailto:oracle-l-request@freelists.org?Subject=subscribe>
List-Owner: <mailto:>
List-post: <mailto:oracle-l@freelists.org>
List-Archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l
--000000000000f60e0505a4ebbc09
Content-Type: text/plain; charset="UTF-8"

truncate doesn't reset the stats to zero.

QL> select blocks, num_rows from user_tables;

    BLOCKS   NUM_ROWS
---------- ----------
      1251      61768

1 row selected.

SQL> truncate table t1;

Table truncated.

SQL> select blocks, num_rows from user_tables;

    BLOCKS   NUM_ROWS
---------- ----------
      1251      61768

1 row selected.

SQL> execute dbms_stats.gather_table_stats(user,'t1')

PL/SQL procedure successfully completed.

SQL> select blocks, num_rows from user_tables;

    BLOCKS   NUM_ROWS
---------- ----------
         0          0

1 row selected.


Did you collect stats between truncating and querying the stats the second
time ?

Regards
Jonathan Lewis


On Tue, May 5, 2020 at 8:17 PM Ram Raman <veeeraman@gmail.com> wrote:

>
> Thanks all. TRUNCATE did not do it. Dropped and renamed it, we are good
> now. I am surprised I had to make a copy of the table, drop original and
> rename the copy.
>
>   1*  select owner, table_name, blocks, num_rows from dba_tables where
> tablespace_name = 'DBA'
> 14:09:19 SQL> /
>
> TABLE_NAME                   BLOCKS             NUM_ROWS
> ------------------------ ---------- --------------------
> ....
> WVCE                        3444463                    0
>
> Elapsed: 00:00:00.02
> 14:09:19 SQL>
> 14:09:20 SQL>  truncate table WVCE ;
>
> Table truncated.
>
> Elapsed: 00:00:00.03
> 14:09:29 SQL>  select owner, table_name, blocks, num_rows from dba_tables
> where tablespace_name = 'DBA';
>
>
> TABLE_NAME                   BLOCKS             NUM_ROWS
> ------------------------ ---------- --------------------
> ...
> WVCE                        3444463                    0
>
>
> On Tue, May 5, 2020 at 1:26 PM Mladen Gogala <gogala.mladen@gmail.com>
> wrote:
>
>> Delete or rollback do not free space. There are ways to free space:
>>
>>    - truncate
>>    - alter table compact
>>    - alter table move
>>    - drop table
>>    - mkfs
>>
>> It is perfectly possible to have 32GB table consuming the entire
>> tablespace. That is known as "agile methodology" because it forces the DBA
>> to be agile and keep checking space.
>> Regards
>>
>> On Tue, 2020-05-05 at 11:21 -0500, Ram Raman wrote:
>>
>> Hi
>>
>> I created a table for testing and inserting rows into it when the insert
>> process failed as the tablespace reached maximum limit of 32G - that
>> happened couple of days ago. However, there are no rows in the table, but
>> space occupied shows as real high with the tablespace itself full. Does
>> anyone have an idea? There are couple of other tables in the tablespace but
>> they occupy just few 100 blocks. 12c
>>
>>   1  select table_name, NUM_ROWS, last_analyzed, blocks from dba_tables
>>   2* where table_name = upper('wvce')
>> 11:14:17 SQL> /
>>
>> TABLE_NAME                           NUM_ROWS LAST_ANAL     BLOCKS
>> ------------------------ -------------------- --------- ----------
>> WVCE                                        0 03-MAY-20    3444463
>>
>> Elapsed: 00:00:00.09
>> 11:14:17 SQL>
>> 11:14:28 SQL> select count(*) from WVCE ;
>>
>>             COUNT(*)
>> --------------------
>>                    0
>>
>> Elapsed: 00:00:00.00
>> 11:14:35 SQL>
>> --
>>
>> Thanks
>> Ram
>>
>> --
>>
>> Mladen Gogala
>> Database Consultant
>> Tel: (347) 321-1217
>> Email:gogala.mladen@gmail.com
>>
>
>
> --
>
>
>

--000000000000f60e0505a4ebbc09
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div>truncate doesn&#39;t reset the stats t=
o zero.</div><div><br></div><div>QL&gt; select blocks, num_rows from user_t=
ables;<br><br>=C2=A0 =C2=A0 BLOCKS =C2=A0 NUM_ROWS<br>---------- ----------=
<br>=C2=A0 =C2=A0 =C2=A0 1251 =C2=A0 =C2=A0 =C2=A061768<br><br>1 row select=
ed.<br><br>SQL&gt; truncate table t1;<br><br>Table truncated.<br><br>SQL&gt=
; select blocks, num_rows from user_tables;<br><br>=C2=A0 =C2=A0 BLOCKS =C2=
=A0 NUM_ROWS<br>---------- ----------<br>=C2=A0 =C2=A0 =C2=A0 1251 =C2=A0 =
=C2=A0 =C2=A061768<br><br>1 row selected.<br><br>SQL&gt; execute dbms_stats=
.gather_table_stats(user,&#39;t1&#39;)<br><br>PL/SQL procedure successfully=
 completed.<br><br>SQL&gt; select blocks, num_rows from user_tables;<br><br=
>=C2=A0 =C2=A0 BLOCKS =C2=A0 NUM_ROWS<br>---------- ----------<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00<br><br>1 r=
ow selected.</div><div><br></div><div><br></div><div>Did you collect stats =
between truncating and querying the stats the second time ?</div><div><br><=
/div><div>Regards</div><div>Jonathan Lewis</div><div><br></div></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, May =
5, 2020 at 8:17 PM Ram Raman &lt;<a href=3D"mailto:veeeraman@gmail.com">vee=
eraman@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex"><div dir=3D"ltr"><div><br></div>Thanks all. TRUNCATE did no=
t do it. Dropped and renamed it,=C2=A0we are good now. I am surprised I had=
 to make a copy of the table, drop original and rename the copy.<div><br></=
div><div>=C2=A0 1* =C2=A0select owner, table_name, blocks, num_rows from db=
a_tables where tablespace_name =3D &#39;DBA&#39;<br>14:09:19 SQL&gt; /<br><=
br>TABLE_NAME =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 BLOCKS =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NUM_ROWS<br>----------=
-------------- ---------- --------------------<br>....<br>WVCE =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A034=
44463 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
0<br><br>Elapsed: 00:00:00.02<br>14:09:19 SQL&gt;<br>14:09:20 SQL&gt; =C2=
=A0truncate table WVCE ;<br><br>Table truncated.<br><br>Elapsed: 00:00:00.0=
3<br>14:09:29 SQL&gt; =C2=A0select owner, table_name, blocks, num_rows from=
 dba_tables where tablespace_name =3D &#39;DBA&#39;;<br><br><br>TABLE_NAME =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BLOCKS =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NUM_ROWS<br>------------------------=
 ---------- --------------------<br>...<br>WVCE =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03444463 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00<br><br></div><=
/div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">O=
n Tue, May 5, 2020 at 1:26 PM Mladen Gogala &lt;<a href=3D"mailto:gogala.ml=
aden@gmail.com" target=3D"_blank">gogala.mladen@gmail.com</a>&gt; wrote:<br=
></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style=3D"text=
-align:left;direction:ltr" bgcolor=3D"#fcfcfc"><div>Delete or rollback do n=
ot free space. There are ways to free space:</div><ul><li>truncate</li><li>=
alter table compact</li><li>alter table move</li><li>drop table</li><li>mkf=
s</li></ul><div>It is perfectly possible to have 32GB  table consuming the =
entire tablespace. That is known as &quot;agile methodology&quot; because i=
t forces the DBA to be agile and keep checking space.</div><div>Regards</di=
v><div><br></div><div>On Tue, 2020-05-05 at 11:21 -0500, Ram Raman wrote:</=
div><blockquote type=3D"cite" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:2px solid rgb(114,159,207);padding-left:1ex"><div dir=3D"ltr"><div>Hi</div=
><div><br></div><div>I created a table for testing and inserting rows into =
it when the insert process failed as the tablespace reached maximum limit o=
f 32G - that happened couple of days ago. However, there are no rows in the=
 table, but space occupied shows as real high with the tablespace itself fu=
ll. Does anyone have an idea? There are couple of other tables in the table=
space but they occupy just few 100 blocks. 12c</div><div><br></div><div>=C2=
=A0 1 =C2=A0select table_name, NUM_ROWS, last_analyzed, blocks from dba_tab=
les<br>=C2=A0 2* where table_name =3D upper(&#39;wvce&#39;)<br>11:14:17 SQL=
&gt; /<br><br>TABLE_NAME =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NUM_ROWS LAST_ANAL =C2=A0 =C2=A0 =
BLOCKS<br>------------------------ -------------------- --------- ---------=
-<br>WVCE =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A00 03-MAY-20 =C2=A0 =C2=A03444463<br><br>Elapsed: 00:00:00.09<br>11:14:17=
 SQL&gt;<br>11:14:28 SQL&gt; select count(*) from WVCE ;<br><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 COUNT(*)<br>--------------------<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00<br><br>Elap=
sed: 00:00:00.00<br>11:14:35 SQL&gt;<br></div>-- <br><div dir=3D"ltr"><div =
dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div>=C2=A0<=
/div><div>Thanks</div><div>Ram</div></div></div></div></div></div></div>
</blockquote><div><span><pre>-- <br></pre><div>Mladen Gogala</div><div>Data=
base Consultant</div><div>Tel: (347) 321-1217</div><div><a href=3D"mailto:E=
mail%3Agogala.mladen@gmail.com" target=3D"_blank">Email:gogala.mladen@gmail=
.com</a></div><div></div></span></div></div>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=
=3D"ltr"><div>=C2=A0</div><div><br></div></div></div></div></div></div></di=
v></div></div>
</blockquote></div>

--000000000000f60e0505a4ebbc09--
--
http://www.freelists.org/webpage/oracle-l


