ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling
complimentary technical Workshops on Database Security for the first 30
Oracle Database customers located anywhere in North America, EMEA, LATAM, or
APAC that send an email to
asra_us@oracle.com. Request a Workshop for
your organization today.
Purpose
These routines allow the user to apply Daylight Saving Time (DST) patch to TIMESTAMP WITH TIME ZONE (TSTZ) data type
SELECT ora_dst_convert(SYSTIMESTAMP, 0, 0)
FROM dual;
SELECT ora_dst_convert(SYSTIMESTAMP, 0, 0)
*
ERROR at line 1:
ORA-30092: function not allowed at this stage of DST upgrade process
Creates a table that holds a list of affected tables
dbms_dst.create_affected_table(table_name IN VARCHAR2);
exec dbms_dst.create_affected_table('UW_CAT');
"SYS"."UW_CAT" has been successfully created.
PL/SQL procedure successfully completed.
desc uw_cat
Name Null? Type
----------------------------- -------- --------------------
TABLE_OWNER NOT NULL VARCHAR2(128)
TABLE_NAME NOT NULL VARCHAR2(128)
COLUMN_NAME NOT NULL VARCHAR2(4000)
ROW_COUNT NUMBER
ERROR_COUNT NUMBER
dbms_dst.create_error_table(table_name IN VARCHAR2);
exec dbms_dst.create_affected_table('UW_CET');
"SYS"."UW_CET" has been successfully created.
PL/SQL procedure successfully completed.
desc uw_cet
Name Null? Type
----------------------------- -------- --------------------
TABLE_OWNER NOT NULL VARCHAR2(128)
TABLE_NAME NOT NULL VARCHAR2(128)
COLUMN_NAME NOT NULL VARCHAR2(4000)
ROW_COUNT NUMBER
ERROR_COUNT NUMBER
Creates a table used to record active triggers which are disabled before performing an upgrade on the table, but not re-enabled due to a fatal failure during the upgrade process
dbms_dst.create_trigger_table(table_name IN VARCHAR2);
exec dbms_dst.create_affected_table('UW_CTT');
"SYS"."UW_CTT" has been successfully created.
PL/SQL procedure successfully completed.
desc uw_ctt
Name Null? Type
----------------------------- -------- --------------------
TABLE_OWNER NOT NULL VARCHAR2(128)
TABLE_NAME NOT NULL VARCHAR2(128)
COLUMN_NAME NOT NULL VARCHAR2(4000)
ROW_COUNT NUMBER
ERROR_COUNT NUMBER
Upgrades all tables in the database, which have column(s) defined on TSTZ type or ADT type containing TSTZ type
dbms_dst.upgrade_database(
num_of_failures OUT BINARY_INTEGER,
upgrade_data IN BOOLEAN := TRUE,
parallel IN BOOLEAN := FALSE,
continue_after_errors IN BOOLEAN := TRUE,
log_errors IN BOOLEAN := FALSE,
log_errors_table IN VARCHAR2 := 'sys.dst$error_table',
error_on_overlap_time IN BOOLEAN := FALSE,
error_on_nonexisting_time IN BOOLEAN := FALSE,
log_triggers_table IN VARCHAR2 := 'sys.dst$trigger_table');
Upgrades tables in given list of schemas, which have column(s) defined on TSTZ type or ADT containing TSTZ type
dbms_dst.upgrade_schema(
num_of_failures OUT BINARY_INTEGER,
schema_list IN VARCHAR2,
upgrade_data IN BOOLEAN := TRUE,
parallel IN BOOLEAN := FALSE,
continue_after_errors IN BOOLEAN := TRUE,
log_errors IN BOOLEAN := FALSE,
log_errors_table IN VARCHAR2 := 'sys.dst$error_table',
error_on_overlap_time IN BOOLEAN := FALSE,
error_on_nonexisting_time IN BOOLEAN := FALSE,
log_triggers_table IN VARCHAR2 := 'sys.dst$trigger_table');
set serveroutput on
DECLARE
numfail PLS_INTEGER;
x NATURAL;
BEGIN
dbms_dst.begin_prepare(31);
dbms_dst.find_affected_tables;
dbms_dst.end_prepare;
SELECT COUNT(*)
INTO x
FROM dst$affected_tables;
IF x = 0 THEN
dbms_dst.begin_upgrade(31);
dbms_dst.upgrade_schema(numfail, 'OE');
dbms_output.put_line(numfail);
dbms_dst.end_upgrade(numfail);
dbms_output.put_line(numfail);
END IF;
END;
/
Upgrades a given list of tables, which have column(s) defined on TSTZ type or ADT containing TSTZ type
dbms_dst.upgrade_table(
num_of_failures OUT BINARY_INTEGER,
table_list IN VARCHAR2,
upgrade_data IN BOOLEAN := TRUE,
parallel IN BOOLEAN := FALSE,
continue_after_errors IN BOOLEAN := TRUE,
log_errors IN BOOLEAN := FALSE,
log_errors_table IN VARCHAR2 := 'sys.dst$error_table',
error_on_overlap_time IN BOOLEAN := FALSE,
error_on_nonexisting_time IN BOOLEAN := FALSE,
log_triggers_table IN VARCHAR2 := 'sys.dst$trigger_table',
atomic_upgrade
IN BOOLEAN := FALSE,
from_tz_version IN BINARY_INTEGER := 0);
conn oe/oe@pdbdev
set serveroutput on
DECLARE
numfail PLS_INTEGER;
x NATURAL;
BEGIN
dbms_dst.begin_prepare(31);
dbms_dst.find_affected_tables;
dbms_dst.end_prepare;
SELECT COUNT(*)
INTO x
FROM dst$affected_tables;
IF x = 0 THEN
dbms_dst.begin_upgrade(31);
dbms_dst.upgrade_table(numfail, 'ORDERS');
dbms_output.put_line(numfail);
dbms_dst.end_upgrade(numfail);
dbms_output.put_line(numfail);
END IF;
END;
/
Related Queries
View timezone related properties
col value$ format a30
col comment$ format a50
SELECT name, value$, comment$
FROM props$
WHERE comment$ LIKE '%timezone%';