Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to tune performance issue of a sql query

Yogendra SinghDec 28 2020

issue_query.txt (5.24 KB)Hi,
I have a sql query which is causing performance issue for a specific customer. I am using standard oracle tables only to fetch the data. Can anybody please help in tuning attached query or else let me know if this could be something related to data issues for a specific customer.
For example: When i am providing cust_account_id as 328627 in attached query, it is retrieving 9987 rows in approx 16 sec while for cust_account_id as 1462371, it is retriving 8853 rows in approx 160 sec.

(Note: I am using SQL Developer to run attached query.)

Comments

OrionNet
Api,

You can simply create new temporary tablespace in new location and set it as default temporarty tablespace. And similar you can do that with undo tablespace
sqlplus '/as sysdba'


SQL>CREATE TEMPORARY TABLESPACE temp2   TEMPFILE '/new_location/temp2_01.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 28 MAXSIZE unlimited;

SQL>ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2

#drop old temp tablespace
SQL>DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;


#undo tablespace

SQL>create undo tablespace undotbs2 datafile '/new_location/newundo02.dbf' size 2000m;

#Set new tablespace as undo tablespace
SQL> alter system set undo_tablespace= undotbs2 ;

#Drop old undotbs tablespace
SQL> drop tablespace undotbs including contents;
Regards
sb92075
I want to move my undo and temporary tablespace to new path because of space issue.
I am using Oracle 10g release 2 and working on production server can't take shutdown without prior permission.
Create new UNDO & TEMP tablespaces, switch to new TS, & then drop old ones.
Surachart Opun
About create/change/drop

UNDO:

SQL>show parameter undo

NAME TYPE VALUE
------------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1

SQL> CREATE UNDO TABLESPACE undotbs2 DATAFILE '+DATA_NEWPATH' SIZE 100M AUTOEXTEND ON;

http://www.oracle-base.com/articles/9i/AutomaticUndoManagement.php

SQL> alter system set undo_tablespace=undotbs2;

*** after that can drop UNDOTBS1

TEMP:
SQL> CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA_NEWPATH' SIZE 500M AUTOEXTEND ON NEXT 100M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_3.shtml

SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;


*** after that can drop old temp tablespace -> DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES
708725
Ya thanks a lot for the answer but I have one more query...

Mine is the production server and I can't shutdown so may I do all this operation when database is open?

How do I know that users are accessing the old Undo tablespace or temporary tablespace or not, because after checking that no one is using the old ones, I can drop it. So when can I drop old undo and temp tablespaces?
oradba11
If you are trying to drop these tablespace ..which is being use by some transactions ..oracle will not allow to do that..
Read some documents on google ..thay will clear you doubts also..

enjoy
1 - 5

Post Details

Added on Dec 28 2020
6 comments
303 views