Wednesday, July 6, 2016

Oracle Time Zone upgrade from 14 to 18

oracle support doc 1358166.1 for detailed information on timezone upgrade. It’s recommended to go through this document to understand the affects of below commands and any deviation from below steps if slight change in versions involved in this upgrade.

Download oracle Time zone patch  p13417321_112040_Linux-x86-64

SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  2  FROM DATABASE_PROPERTIES
  3  WHERE PROPERTY_NAME LIKE 'DST_%'
  4  ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         14
DST_SECONDARY_TT_VERSION       0
DST_UPGRADE_STATE              NONE

SQL> purge dba_recyclebin;

DBA Recyclebin purged.

SQL> alter session set "_with_subquery"=materialize;

Session altered.

SQL> alter session set "_simple_view_merging"=TRUE;

Session altered.

SQL>  EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('upg_tzv');

PL/SQL procedure successfully completed.

SQL> EXEC DBMS_DST.BEGIN_PREPARE(18);

PL/SQL procedure successfully completed.

SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value 
  2  FROM DATABASE_PROPERTIES
  3  WHERE PROPERTY_NAME LIKE 'DST_%'
  4  ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         14
DST_SECONDARY_TT_VERSION       18
DST_UPGRADE_STATE              PREPARE

SQL> TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;

Table truncated.

SQL> TRUNCATE TABLE sys.dst$affected_tables;

Table truncated.

SQL> TRUNCATE TABLE sys.dst$error_table;

Table truncated.

SQL> set serveroutput on
SQL>  BEGIN
  2  DBMS_DST.FIND_AFFECTED_TABLES
  3  (affected_tables => 'sys.dst$affected_tables',
  4  log_errors => TRUE,
  5  log_errors_table => 'sys.dst$error_table');
  6  END;
  7  /

PL/SQL procedure successfully completed.

SQL> SELECT * FROM sys.dst$affected_tables;

no rows selected

SQL>  SELECT * FROM sys.dst$error_table;

no rows selected

SQL> SELECT * FROM sys.dst$error_table where ERROR_NUMBER= '1883';

no rows selected

SQL> SELECT * FROM sys.dst$error_table where ERROR_NUMBER= '1878';

no rows selected

SQL> SELECT * FROM sys.dst$error_table where ERROR_NUMBER not in ('1878','1883');

no rows selected

SQL> EXEC DBMS_DST.END_PREPARE;
A prepare window has been successfully ended.

PL/SQL procedure successfully completed.

SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  2   FROM DATABASE_PROPERTIES
  3   WHERE PROPERTY_NAME LIKE 'DST_%'
  4   ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         14
DST_SECONDARY_TT_VERSION       0
DST_UPGRADE_STATE              NONE

SQL> select name from v$database;

NAME
---------
SID

SQL>  shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup upgrade
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2260088 bytes
Variable Size             444597128 bytes
Database Buffers          608174080 bytes
Redo Buffers               13905920 bytes
Database mounted.
Database opened.
SQL> set serveroutput on
SQL>  set timing on
SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  2  FROM DATABASE_PROPERTIES
  3  WHERE PROPERTY_NAME LIKE 'DST_%'
  4  ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         14
DST_SECONDARY_TT_VERSION       0
DST_UPGRADE_STATE              NONE

Elapsed: 00:00:00.02
SQL> purge dba_recyclebin;

DBA Recyclebin purged.

Elapsed: 00:00:00.01
SQL>  TRUNCATE TABLE SYS.DST$TRIGGER_TABLE;

Table truncated.

Elapsed: 00:00:00.02
SQL> TRUNCATE TABLE sys.dst$affected_tables;

Table truncated.

Elapsed: 00:00:00.01
SQL> TRUNCATE TABLE sys.dst$error_table;

Table truncated.

Elapsed: 00:00:00.02
SQL>  alter session set "_with_subquery"=materialize;

Session altered.

Elapsed: 00:00:00.00
SQL> alter session set "_simple_view_merging"=TRUE;

Session altered.

Elapsed: 00:00:00.00
SQL>  EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('upg_tzv');

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
SQL>  EXEC DBMS_DST.BEGIN_UPGRADE(18);
An upgrade window has been successfully started.

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.61
SQL> SELECT * FROM sys.dst$error_table;

no rows selected

Elapsed: 00:00:00.00
SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  2  FROM DATABASE_PROPERTIES
  3  WHERE PROPERTY_NAME LIKE 'DST_%'
  4  ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         18
DST_SECONDARY_TT_VERSION       14
DST_UPGRADE_STATE              UPGRADE

Elapsed: 00:00:00.01
SQL> select OWNER, TABLE_NAME, UPGRADE_IN_PROGRESS from ALL_TSTZ_TABLES where UPGRADE_IN_PROGRESS='YES';

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
APPLSYS                        AQ$_FND_CP_GSM_IPC_AQTBL_S     YES
APPLSYS                        AQ$_FND_CP_GSM_IPC_AQTBL_L     YES
APPLSYS                        AQ$_FND_CP_TM_AQTBL_S          YES
APPLSYS                        AQ$_FND_CP_TM_RET_AQTBL_S      YES
APPLSYS                        AQ$_FND_CP_TM_AQTBL_L          YES
APPLSYS                        AQ$_FND_CP_TM_RET_AQTBL_L      YES
APPLSYS                        AQ$_FND_CP_GSM_OPP_AQTBL_S     YES
APPLSYS                        AQ$_FND_CP_GSM_OPP_AQTBL_L     YES
ASO                            AQ$_ASO_ORDER_FEEDBACK_T_S     YES
OKC                            AQ$_OKC_AQ_EV_TAB_S            YES
AR                             AQ$_AR_REV_REC_QT_S            YES

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
XNP                            AQ$_XNP_OUT_MSG_QTAB_S         YES
CS                             AQ$_CS_SERVICE_REQUEST_IQT_S   YES
CS                             AQ$_CS_SERVICE_REQUEST_OQT_S   YES
APPLSYS                        AQ$_WF_DEFERRED_TABLE_M_S      YES
APPLSYS                        AQ$_WF_DEFERRED_S              YES
APPLSYS                        AQ$_WF_REPLAY_IN_S             YES
APPLSYS                        AQ$_WF_ERROR_S                 YES
APPLSYS                        AQ$_WF_OUT_S                   YES
APPLSYS                        AQ$_WF_REPLAY_OUT_S            YES
APPLSYS                        AQ$_WF_IN_S                    YES
APPLSYS                        AQ$_WF_JMS_IN_S                YES

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
APPLSYS                        AQ$_WF_JMS_OUT_S               YES
APPLSYS                        AQ$_WF_NOTIFICATION_IN_S       YES
APPLSYS                        AQ$_WF_JAVA_DEFERRED_S         YES
APPLSYS                        AQ$_WF_WS_JMS_IN_S             YES
APPLSYS                        AQ$_WF_WS_JMS_OUT_S            YES
APPLSYS                        AQ$_WF_JAVA_ERROR_S            YES
APPLSYS                        AQ$_WF_JMS_JMS_OUT_S           YES
APPLSYS                        AQ$_WF_WS_SAMPLE_S             YES
APPLSYS                        AQ$_WF_CONTROL_S               YES
APPLSYS                        AQ$_WF_CONTROL_L               YES
APPLSYS                        AQ$_WF_NOTIFICATION_OUT_S      YES

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
APPLSYS                        AQ$_WF_NOTIFICATION_OUT_L      YES
ASO                            AQ$_ASO_ORDER_FEEDBACK_T_L     YES
XNP                            AQ$_XNP_OUT_MSG_QTAB_L         YES
APPLSYS                        AQ$_WF_OUT_L                   YES
APPLSYS                        AQ$_WF_ERROR_L                 YES
APPLSYS                        AQ$_WF_REPLAY_IN_L             YES
APPLSYS                        AQ$_WF_DEFERRED_L              YES
APPLSYS                        AQ$_WF_DEFERRED_TABLE_M_L      YES
CS                             AQ$_CS_SERVICE_REQUEST_OQT_L   YES
CS                             AQ$_CS_SERVICE_REQUEST_IQT_L   YES
APPLSYS                        AQ$_WF_NOTIFICATION_IN_L       YES

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
APPLSYS                        AQ$_WF_JMS_OUT_L               YES
APPLSYS                        AQ$_WF_JMS_IN_L                YES
APPLSYS                        AQ$_WF_IN_L                    YES
APPLSYS                        AQ$_WF_REPLAY_OUT_L            YES
APPLSYS                        AQ$_WF_WS_SAMPLE_L             YES
APPLSYS                        AQ$_WF_JMS_JMS_OUT_L           YES
APPLSYS                        AQ$_WF_JAVA_ERROR_L            YES
APPLSYS                        AQ$_WF_WS_JMS_OUT_L            YES
APPLSYS                        AQ$_WF_JAVA_DEFERRED_L         YES
APPLSYS                        AQ$_WF_WS_JMS_IN_L             YES
AR                             AQ$_AR_REV_REC_QT_L            YES

OWNER                          TABLE_NAME                     UPG
------------------------------ ------------------------------ ---
OKC                            AQ$_OKC_AQ_EV_TAB_L            YES

56 rows selected.

Elapsed: 00:00:00.46
SQL>; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>;  startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2260088 bytes
Variable Size             444597128 bytes
Database Buffers          608174080 bytes
Redo Buffers               13905920 bytes
Database mounted.
Database opened.
SQL> alter session set "_with_subquery"=materialize;

Session altered.

Elapsed: 00:00:00.02
SQL> alter session set "_simple_view_merging"=TRUE;

Session altered.

Elapsed: 00:00:00.00
SQL>; EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('upg_tzv');

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
SQL>;  VAR numfail number
SQL>;  BEGIN
  2      DBMS_DST.UPGRADE_DATABASE(:numfail,
  3      parallel => TRUE,
  4      log_errors => TRUE,
  5      log_errors_table => 'SYS.DST$ERROR_TABLE',
  6      log_triggers_table => 'SYS.DST$TRIGGER_TABLE',
  7      error_on_overlap_time => FALSE,
  8      error_on_nonexisting_time => FALSE);
  9      DBMS_OUTPUT.PUT_LINE('Failures:'|| :numfail);
 10     END;
 11  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:18.91
SQL> SELECT * FROM sys.dst$error_table;

no rows selected

Elapsed: 00:00:00.00
SQL>; VAR fail number
SQL>; BEGIN
  2  DBMS_DST.END_UPGRADE(:fail);
  3  DBMS_OUTPUT.PUT_LINE('Failures:'|| :fail);
  4  END;
  5  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.45
SQL> SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
  2  FROM DATABASE_PROPERTIES
  3  WHERE PROPERTY_NAME LIKE 'DST_%'
  4  ORDER BY PROPERTY_NAME;

PROPERTY_NAME                  VALUE
------------------------------ ------------------------------
DST_PRIMARY_TT_VERSION         18
DST_SECONDARY_TT_VERSION       0
DST_UPGRADE_STATE              NONE

Elapsed: 00:00:00.00
SQL> SELECT * FROM v$timezone_file;

FILENAME                VERSION
-------------------- ----------
timezlrg_18.dat              18

Elapsed: 00:00:00.00
SQL> 


No comments: