Search code examples
oracle12ctablespace

How to check history of tablespace autoextend status in oracle


I am new to oracle. I work on oracle database 12c version. I have to find out if the tablespace autoextend status was disabled for previous week.But i can able to view current autoextend status for a tablespace. Is there any direct approach to find the tablespace autoextend status using database views?

Below output shows the current tablespace autoextensible status.

Sample output:

SQL> select TABLESPACE_NAME,AUTOEXTENSIBLE from dba_data_files;

TABLESPACE_NAME                AUT
------------------------------ ---
SYSTEM                         NO
SYSTEM                         YES
SYSAUX                         YES
UNDOTBS1                       YES
USERS                          NO
USERS                          NO
USERS                          YES
EXAMPLE                        YES

Expected

Autoextensible status - yes or no for previous week


Solution

  • If you're lucky, you can use a Flashback query to find historical values for your data files. To use flashback on the data dictionary you will need to be logged on as a privileged user like SYS:

    SYS@orclpdb> select tablespace_name,autoextensible from dba_data_files as of timestamp timestamp '2021-05-20 00:00:00';
    
    TABLESPACE_NAME                AUT
    ------------------------------ ---
    SYSTEM                         YES
    SYSAUX                         YES
    UNDOTBS1                       YES
    USERS                          YES
    

    Unfortunately, a week is a long time for the historical (UNDO) data to be available. Your query is likely to fail with an error like "ORA-08180: no snapshot found based on specified time". But it doesn't hurt to try.

    If flashback doesn't work, you'll need to follow Justin's advice and do something like create a scheduler job to periodically write the data into a table.