Wednesday, December 18, 2019

Things to Know when you do 19c upgrade


-> autoupgrade.jar recommended way to upgrade
-> dictionary stats have been gathered the last time

column OPERATION format a40
set linesize 200
select to_char(max(END_TIME),'DD-MON-YY hh24:mi') LATEST, OPERATION from DBA_OPTSTAT_OPERATIONS where OPERATION in ('gather_dictionary_stats','gather_fixed_objects_stats') group by operation;


-> stats on clustered indexes ( In case you are not using autoupgrade.jar)

exec dbms_stats.gather_schema_stats('SYS');
exec dbms_stats.gather_index_stats('SYS','I_OBJ#');
exec dbms_stats.gather_index_stats('SYS','I_FILE#_BLOCK#');
exec dbms_stats.gather_index_stats('SYS','I_TS#');
exec dbms_stats.gather_index_stats('SYS','I_USER#');
exec dbms_stats.gather_index_stats('SYS','I_TOID_VERSION#');
exec dbms_stats.gather_index_stats('SYS','I_MLOG#');
exec dbms_stats.gather_index_stats('SYS','I_RG#');

-> Things to do right after upgrade -> 
exec DBMS_STATS.ALTER_STATS_HISTORY_RETENTION(14);
_cursor_obsolete_threshold=1024
deferred_segment_creation=false
_sql_plan_directive_mgmt_control=0
Set optimizer_adaptive_statistics=FALSE explicitly in your SPFILE

-> Comptable (features) and optimiser_features_enable (use latest)  - Keep the latest

-> Collect execution plan before upgrade (cursor cache and AWR) [how to ?] [sql tunning sets]

-> compare AWR snapshots (AWRDDRPT.sql), You can export AWR data using the awrexp script in rdbms/admin

-> capture STS -> load STS (SQL performance analyser)

-> SPM  ( 53 week default - dbms_spm.configure('plan retention week',5) , (space_budget_percent',5)
   Baseline Capture -> optimiser_capture_sql_plan_baselines= TRUE (start recording ) 
   selection -> optimise_use_sql_plan_baselines= TRUE,OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES=FALSE
   evolution -> dbms_spm.report_auto_evolve_task,  DBMS_SPM.CREATE_EVOLVE_TASK

-> SQL Tuning Advisor

-> export/import STS to new DB  

-> DBMS_SPM.LOAD_PLANS_FROM_SQLSET

-> capture workload, reply workload (compare)

-> SPA is Real Application Testing.SPM is a free feature

-> AUTOMATIC SPM - Exadata 19C 

Tuesday, December 3, 2019

How to upgrade DB from 12.1 to 19.3

1. Install oracle software for the database on Oracle Home 19.3.0
2. Remove obsoleted init parameters and others
3. Stop the listener
4. Gather stats for dictionary and fixed objects
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
5. Empty recycle bin - purge dba_recyclebin;
6. Check whether we are using the right Time zone file. Need to update the latest time zone file.
7. Run Pre-Upgrade Information Tool
(12.1 Home)/jdk/bin/java -jar (19.3 Home)/rdbms/admin/preupgrade.jar FILE TEXT DIR /home/oracle/upgrade
execute preupgrade_fixups.sql
8. Stop 2nd RAC instance and Disable cluster and stop 1st instance
9. set the env variable for 19C
10. Start DB in upgrade mode - startup upgrade
11. invoke DB upgrade - (19.3 Home)/bin/dbupgrade