Recently my oracle datafiles are getting scarce,
so that I've added large size of datafiles to table space.
Then, some index became unused out of sudden...
And the program-performance got worse.
Does anybody know such case that Adding datafile affect index-usage?
No. Data file operations and index operations are completely separate. Likely the two occurrences are coincidental, but unrelated.
Related
We have oracle 12c database. We will be migrating to 19c soon. Generally we follow rule to compress table(advanced OLTP compression) and keep indexes uncompressed. Now we are facing situation where depending upon number of columns we have some indexes with 800GB and its corresponding table is of 200GB(compressed)
Can someone help me with understanding of below-
Does tables compression have impact on query performance/table loading
Should we compress index? Will it impact performance of loading or querying?
If table is partitioned can we selectively compress local indexex partition by partition.
Are there any best practices or dos or donts for Oracle compression?
Re 1:
Table compression can have an impact on performance, mostly a positive one. However, it is nearly impossible to predict, as it depends on the data, and on the order the data is inserted into the table, the number of updates, etc.
I'd normally check firstly the potential compression ratio of a table, either with dbms_compression.get_compression_ratio or by simply creating a compressed and an uncompressed copy of the table (or a subset of the rows if too big).
Re 2:
Index compression eliminates leading values in multicolumn indexes, so the answer is the same as for 1.
Re 3:
Yes. According to the partitioning guide, you can use
CREATE INDEX i_cost1 ON costs_demo (prod_id) COMPRESS LOCAL (
PARTITION costs_old, PARTITION costs_q1_2003,
PARTITION costs_q2_2003, PARTITION costs_recent NOCOMPRESS);
What potential problems can occur in Oracle DB, when using too large temporary table space, except as unreasonably large consumption of disk space?
A large temporary tablespace will not cause any performance issues. I've tuned SQL on databases with more than a terabyte of temporary tablespace and never seen any issues caused by that space.
When we have created some indexes as part of performance tuning,
CREATE INDEX index_emp ON emp(eid);
The index created in a default tablespace say myTS_D1. When I checked, some of the indexes are having their tablespace value
myTs_I1. And I understood that we should specify the tablespace name at the time of creating the index.
What is the impact ? Is this creates any issue, since some of them are in one tablespace and others in a different one.
The idea of having separate tablespaces is that you can put them on separate physical disks.
Maybe you have a fast SSD that you want to use for some frequently accessed indexes for example. Or maybe you want to distribute disk I/O across multiple controllers to maximize throughput.
Aside from any performance or operational impact this tablespace placement has, there is no difference. For a database user (who only sees the logical schema) it looks the same.
Using separate tablespaces for indexes and data does not improve performance, it only creates more complexity which leads to more problems later. The more tablespaces and datafiles your DBAs have to manage the more likely something will go wrong.
High Water Mark (HWM) for a table in an Oracle Database is the line between blocks that have been used and ones that have never been. Truncating a table resets the HWM to zero.
Now, if I have a partitioned table, I'd like to know if the following is true:
Does each partition maintain its own HWM?
If not, does alter table ... drop partition ... affect table's HWM?
The idea is I'd like to populate partition's tables with insert /*+ append */ (direct path insert), but it only writes data beyond the HWM, so will the space be reused if I recreate the partition? I failed to find information on this specific aspect.
Each partition is a separate segment, so each would have its own HWM. I presume that truncating the whole table would reset the HWM for all partitions. You can truncate individual partitions as well, which certainly would reset the HWM for the partition.
In addition to Dave Costa's answer, response to second question: If you truncate the partition, the HWM will be at zero, so the space will be regained for direct path insert(space will be used). If you drop the partition, the space will be free for any other segment to be used. In particular, for your new partition.
So, in fewer words:
if you truncate the partition, space will be available for this
partition.
if you drop the partition, the space will be free and
usable for every segment in the tablespace.
Also, another trick to use if you want to reuse the space is to do an
alter table move partition. This will "recreate" the partition, without loosing the data.
There are more details, but this is your question about.
The tablespace in Oracle 10g is almost 100% used.
Size (MB) = 571,768.0
Used (MB) = 571,534.0
I just deleted (and committed) thousands of records in a table that belongs to a schema associated with that tablespace. Surprisingly, no space was freed up according to the Tablespaces page on Enterprise Manager.
Question: is there anything that I need to do to force Oracle to release the space corresponding to the deleted records?
The space you are seeing is for SEGMENTS on tablespace.
A Tablespace contains Segments. Each Segment is associated to an Index or a Table. Segments contains extends, and extends contains blocks. An for a table, a block contains rows.
When you delete rows on a table you are freeing the space ocuppied by rows but the space for new segments remains equal.
To free this space you can try to:
ALTER TABLESPACE xxx COALESCE;
or
ALTER TABLE xxx MOVE;
The first one, will "combine all contiguous free extents into larger contiguous extents". Depending on your configuracion, this can be executed by Oracle automatically. Also, may be it does not free to much because the location of data relative to the highwatermark on segment.
The second one "lets you relocate data of a nonpartitioned table or of a partition of a partitioned table into a new segment, optionally in a different tablespace, and optionally modify any of its storage attributes.". Be carefull with this because you need free space to achieve this, execute it against another tablespace or add more datafiles.
If you are using oracle 10g or greater, you can purge the recycle bin using command
purge recylebin
or even purge the contents related to the tablespace using
purge tablespace
This should free up the space which is deleted but not yet available , please note this would be made available automatically when the space stress occurs for the given tablespace.
In addition,
You can use the segment advisor to find all the segments that you can "shrink", and easily reclaim your space.
Read more at
Segment Shrink
And the last one you can use with locally managed tablespaces
Alter Tablespace tablespace_name shrink space
This would free as much space as possible while maintaining other attributes.
Rebuild your indexes.