Skip to main content

Posts

Showing posts from January, 2015

Dropping many tables at a time using pl/sql script

Hello all, Here i'm going to give you the script to drop more number of  tables at one go. The below script is being used in our environment to drop more number of tables at the same time whenever we receive a mail from our client. This may help you also if you are in a situation. It's a best option to save time instead of dropping tables one by one. Tomorrow also we will have an activity to drop 111 tables which occupied 105 GB of space & reclaiming physical disk space activity followed by table drop. set timing on SET SERVEROUTPUT ON begin      for X in ( select OWNER,SEGMENT_NAME from dba_segments where SEGMENT_NAME in ( 'BKP_31MAY14', 'BKP_26MAY14', 'BKP_27MAY14', 'BKP_03JUN14', 'BKP_29MAY14', 'BKP_25MAY14', 'BKP_28MAY14', 'BKP_22MAY14', 'BKP_30MAY14', 'BKP_23MAY14', 'BKP_24MAY14', 'BKP_19MAY14', 'BKP_21MAY14', 'BKP_20MAY14', 'BKP_1

Pinning execution plan for a sql_id using 'SQL Profile' to consistently reproduce a good plan

Deal all, Below post content is not my own. It is taken from MOSC document but the example shown below is taken from our environment. I got to know the below topic when we had experienced the bad SQL query performance in one of our production environment during daily batch running time. Hence we had implemented the same mentioned in the title "Pinning execution plan for a sql_id using 'SQL Profile' to consistently reproduce a good plan". Introduction The "cost-based optimizer (CBO or just optimizer) is the part of database software that determines the most efficient means of accessing the specified data (or at least what it "calculates" as the most efficient). The optimizer determines which execution plan is most efficient by considering several sources of information, including query conditions, available access paths, statistics gathered for the system, and hints. Some changes in those conditions may affect the calculations of the plan