Professional Documents
Culture Documents
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
bua
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
rt)
Rem
Rem
Rem
bmccarth
bmccarth
cmlim
cmlim
bmccarth
06/16/10
06/03/10
06/01/10
05/27/10
05/03/10
bmccarth
04/27/10 04/28/10 -
cmlim
bmccarth
cdilling
bmccarth
vmedam
bmccarth
cmlim
bmccarth
cdilling
cdilling
cdilling
cmlim
10/20/09
10/09/09
09/29/09
09/25/09
09/23/09
bmccarth
09/09/09 -
cdilling
cdilling
bmccarth
cdilling
bmccarth
cmlim
09/02/09
08/06/09
08/25/09
07/15/09
07/01/09
06/26/09
cmlim
06/12/09
bmccarth
bmccarth
cmlim
bmccarth
06/03/09
06/03/09
05/21/09
05/20/09
cmlim
cmlim
bmccarth
bmccarth
cmlim
bmccarth
cmlim
05/14/09 -
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
bmccarth
bmccarth
bmccarth
cmlim
bmccarth
cdilling
cmlim
cmlim
cdilling
cmlim
cmlim
cdilling
cdilling
cmlim
cmlim
awitkows
cdilling
*****************************************************************
Release Specific Constants
These constants must be updated for each new patch release
*****************************************************************
utlu_banner
formation Tool ';
utlu_support_ver
.0';
utlu_version
utlu_patchset
utlu_buildrev
utlu_tz_version
VARCHAR2(30) := '11.2.0.4';
VARCHAR2(3) := '.0';
VARCHAR2(3) := '001';
NUMBER := 14; -- Match with catupstr.sql
-- *****************************************************************
-- Database Information
-- *****************************************************************
db_name
db_version
db_dict_version
db_prev_version
db_compat
VARCHAR2(30);
VARCHAR2(30);
VARCHAR2(30);
VARCHAR2(30);
VARCHAR2(30);
db_platform_id NUMBER;
db_platform_name VARCHAR2(256);
db_block_size NUMBER;
db_undo
VARCHAR2(30);
db_undo_tbs
VARCHAR2(30);
db_log_mode
VARCHAR2(12);
db_tz_version NUMBER := 0;
db_vlm
VARCHAR2(30);
-- TRUE when Very Large Memory enabled
db_64
BOOLEAN := FALSE; -- TRUE when platform is 64-bit
db_readonly
BOOLEAN := FALSE;
dbv
vers
patch
tznames_dist
tznames_count
memory_target
tmp_num1
tmp_num2
tmp_num3
tmp_varchar1
tmp_varchar2
-- *****************************************************************
-- Component Information
-- *****************************************************************
TYPE comp_record_t
cid
cname
version
status
schema
def_ts
script
processed
IS RECORD (
VARCHAR2(30), -- component id
VARCHAR2(45), -- component name
VARCHAR2(30), -- version
VARCHAR2(15), -- component status
VARCHAR2(30), -- owner of component
VARCHAR2(30), -- name of default tablespace
VARCHAR2(128), -- upgrade script name
BOOLEAN,
-- TRUE IF in the registry AND is not
-- status REMOVING/REMOVED, OR
-- TRUE IF will be in the registry because
-- because cmp_info().install is TRUE
BOOLEAN, -- TRUE if component to be installed in upgrade
NUMBER, -- upgrade size needed in system tablespace
NUMBER, -- upgrade size needed in sysaux tablespace
NUMBER, -- upgrade size needed in 'other' tablespace
NUMBER, -- install size needed in system tablespace
NUMBER -- install size needed in 'other' tablespace
install
sys_kbytes
sysaux_kbytes
def_ts_kbytes
ins_sys_kbytes
ins_def_kbytes
);
TYPE comp_table_t IS TABLE of comp_record_t INDEX BY BINARY_INTEGER;
cmp_info comp_table_t;
-- Table of component information
-- index values for components (order as in upgrade script)
catalog CONSTANT BINARY_INTEGER:=1;
catproc CONSTANT BINARY_INTEGER:=2;
javavm CONSTANT BINARY_INTEGER:=3;
xml
CONSTANT BINARY_INTEGER:=4;
rac
CONSTANT BINARY_INTEGER:=5;
owm
CONSTANT BINARY_INTEGER:=6;
mgw
CONSTANT BINARY_INTEGER:=7;
aps
CONSTANT BINARY_INTEGER:=8;
amd
CONSTANT BINARY_INTEGER:=9;
ols
CONSTANT BINARY_INTEGER:=10;
dv
em
context
xdb
catjava
ordim
sdo
odm
wk
exf
rul
apex
xoq
stats
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
CONSTANT
BINARY_INTEGER:=11;
BINARY_INTEGER:=12;
BINARY_INTEGER:=13;
BINARY_INTEGER:=14;
BINARY_INTEGER:=15;
BINARY_INTEGER:=16;
BINARY_INTEGER:=17;
BINARY_INTEGER:=18;
BINARY_INTEGER:=19;
BINARY_INTEGER:=20;
BINARY_INTEGER:=21;
BINARY_INTEGER:=22;
BINARY_INTEGER:=23;
BINARY_INTEGER:=24;
-- *****************************************************************
-- Tablespace Information
-- *****************************************************************
TYPE tablespace_record_t IS RECORD (
name
VARCHAR2(30), -- tablespace name
inuse NUMBER,
-- kbytes inuse in tablespace
alloc NUMBER,
-- kbytes allocated to tbs
auto
NUMBER,
-- autoextend kbytes available
avail NUMBER,
-- total kbytes available
delta NUMBER,
-- kbytes required for upgrade
inc_by NUMBER,
-- kbytes to increase tablespace by
min
NUMBER,
-- minimum required kbytes to perform upgrade
addl
NUMBER,
-- additional space allocated during upgrade
fname VARCHAR2(513), -- filename in tablespace
fauto BOOLEAN,
-- TRUE if there is a file to increase autoextend
temporary BOOLEAN,
-- TRUE if Temporary tablespace
localmanaged BOOLEAN -- TRUE if locally managed temporary tablespace
-- FALSE if dictionary managed temp tablespace
);
TYPE tablespace_table_t IS TABLE OF tablespace_record_t
INDEX BY BINARY_INTEGER;
ts_info tablespace_table_t; -- Tablespace information
max_ts BINARY_INTEGER; -- Total number of relevant tablespaces
-- *****************************************************************
-- Rollback Segment Information
-- *****************************************************************
TYPE rollback_record_t IS RECORD (
tbs_name VARCHAR2(30), -- tablespace name
seg_name VARCHAR2(30), -- segment name
status VARCHAR(30), -- online or offline
inuse
NUMBER, -- kbytes in use
next
NUMBER, -- kbytes in NEXT
max_ext NUMBER, -- max extents
auto
NUMBER -- autoextend available for tablespace
);
-- *****************************************************************
-- Log File Information
-- *****************************************************************
TYPE log_file_record_t IS RECORD (
file_spec
VARCHAR2(513),
grp
NUMBER,
bytes
NUMBER,
status
VARCHAR2(16)
);
TYPE log_file_table_t IS TABLE of log_file_record_t
INDEX BY BINARY_INTEGER;
lf_info log_file_table_t; -- Log File Information
max_lf
BINARY_INTEGER; -- Total number of log file groups
min_log_size CONSTANT NUMBER := 4194304;
rmd_log_size CONSTANT NUMBER := 15;
-- Minimum size 4M
-- Recommended size 15M
-- *****************************************************************
-- Flashback Information (10.n and above)
-- *****************************************************************
TYPE fb_record_t IS RECORD (
active
BOOLEAN,
-- ON or OFF
file_dest
VARCHAR2(1000), -- db_recovery_file_dest
dsize
NUMBER,
-- db_recovery_file_dest_size
name
VARCHAR2(513), -- name
limit
NUMBER,
-- space limit
used
NUMBER,
-- Used
reclaimable
NUMBER,
files
NUMBER
-- number of files
);
flashback_info fb_record_t;
-- *****************************************************************
-- Initialization Parameter Information
-- *****************************************************************
TYPE obsolete_record_t IS RECORD (
name VARCHAR2(80),
version VARCHAR2(20), -- version where is was obsolete/deprecated
deprecated BOOLEAN,
-- Has become Depreciated
db_match BOOLEAN
);
TYPE obsolete_table_t IS TABLE of obsolete_record_t
INDEX BY BINARY_INTEGER;
op
obsolete_table_t;
max_op BINARY_INTEGER;
minvalue_table_t;
minvalue_table_t;
BINARY_INTEGER;
cpu
NUMBER; -- number of CPUs
cpu_threads NUMBER; -- number of threads per CPU
sesn
NUMBER; -- number of sessions
sp_idx BINARY_INTEGER;
jv_idx BINARY_INTEGER;
tg_idx BINARY_INTEGER;
cs_idx BINARY_INTEGER;
pg_idx BINARY_INTEGER;
mt_idx BINARY_INTEGER;
lp_idx BINARY_INTEGER;
str_idx BINARY_INTEGER;
---------
shared_pool_size
java_pool_size
sga_target
cache_size
pga_aggreate_target
memory_target
large_pool_size
streams_pool_size
-- *****************************************************************
-- Warning Information
-- *****************************************************************
sysaux_exists
sysaux_not_online
sysaux_not_perm
sysaux_not_local
sysaux_not_auto
dip_user_exists
ocm_user_exists
qos_user_exists
cluster_dbs
nls_al24utffss
utf8_al16utf16
owm_replication
dblinks
cdc_data
version_mismatch
connect_role
invalid_objs
ssl_users
timezone_old
timezone_new
xe_upgrade
em_exists
snapshot_refresh
recovery_files
files_backup_mode
pending_2pc_txn
sync_standby_db
ultrasearch_data
remote_redo_issue
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
BOOLEAN
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
FALSE;
------------------------------
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
when
ad
laf_format
BOOLEAN := FALSE; -- TRUE when log_archive_format is missin
g %r
imageidx_used
BOOLEAN := FALSE; -- TRUE when ordsys.ordimageindex exists
recyclebin_on
BOOLEAN := FALSE; -- TRUE if recyclebin is ON
laf_format_string VARCHAR2(4000) := ''; -- log_archive_format value from v$pa
rameter
sys_ts_default
VARCHAR2(30) := ''; -- Name of default tablespace for SYS
system_ts_default VARCHAR2(30) := ''; -- Name of default tablespace for SYST
EM
enabled_indexes_tbl BOOLEAN := FALSE; -- TRUE when sys.enabled$indexes table
exists in database
hidden_params_in_use BOOLEAN := FALSE; -- TRUE if there are hidden params
non_default_events BOOLEAN := FALSE; -- TRUE if we want to report events
dbms_ldap_dep
BOOLEAN := FALSE;
t
edition_exists
BOOLEAN := FALSE;
-- TRUE if editioning views exist but
users is not edition enabled
dmsys_recommendation BOOLEAN := FALSE; -- TRUE if recommending dropping dmsys
fga_upd_rowcnt
NUMBER; -- # of rows in fga_log$ to update during upgrade
aud_upd_rowcnt
NUMBER; -- # of rows in aud$ to update during upgrade
timed_statistics_mbt BOOLEAN := FALSE; -- TRUE if
-- TIMED_STATISTICS Must Be True
job_queue_issue BOOLEAN := FALSE;
job_queue_count NUMBER := 0;
-- *****************************************************************
-- Global Constants and Variables
-- *****************************************************************
idx
BINARY_INTEGER;
type cursor_t IS REF CURSOR;
reg_cursor cursor_t;
tmp_cursor cursor_t;
p_null
CHAR(1);
p_user
VARCHAR2(30);
p_cid
VARCHAR2(30);
p_status
VARCHAR2(30);
n_status
NUMBER;
p_version
VARCHAR2(30);
p_schema
VARCHAR2(30);
n_schema
NUMBER;
p_value
VARCHAR2(80);
p_pos
INTEGER;
p_count
INTEGER;
p_char
CHAR(1);
p_tsname
VARCHAR2(30);
p_edition
VARCHAR2(128);
sum_bytes
NUMBER;
delta_kbytes NUMBER;
delta_sysaux NUMBER;
delta_queues INTEGER;
rows_processed INTEGER;
nonsys_invalid_objs INTEGER;
wk_index
INTEGER;
wk_table
INTEGER;
wk_data
INTEGER;
recycle_objects INTEGER;
tbl_exists
INTEGER; -- does table exist? 0 is no; > 0 is yes
ev_count
INTEGER;
-- display_xml is FALSE for 'i' version, TRUE for 'x' version
display_xml BOOLEAN := FALSE;
collect_diag BOOLEAN := FALSE;
collect_diag_2 BOOLEAN := FALSE; -- more tablespace sizing diag info
rerun
BOOLEAN := FALSE;
inplace
BOOLEAN := FALSE;
SYS_todo
BOOLEAN := FALSE;
warning_5000 BOOLEAN := FALSE;
NO_SUCH_TABLE EXCEPTION;
PRAGMA exception_init(NO_SUCH_TABLE, -942);
-- *****************************************************************
-- ------------- INTERNAL FUNCTIONS AND PROCEDURES ------------------ *****************************************************************
-------------------- display_line/display_warning ----------------PROCEDURE display_line (text varchar2)
IS
BEGIN
-- Move to utl_file at some point
dbms_output.put_line (text);
END display_line;
PROCEDURE display_warning (text varchar2)
IS
BEGIN
display_line ('WARNING: --> ' || text);
END display_warning;
--------------------------- store_renamed -------------------------------PROCEDURE store_renamed (i IN OUT BINARY_INTEGER,
old VARCHAR2,
new VARCHAR2)
IS
BEGIN
i:= i+1;
rp(i).oldname:=old;
rp(i).newname:=new;
END store_renamed;
--------------------------- store_removed -------------------------------PROCEDURE store_removed (i IN OUT BINARY_INTEGER,
name
VARCHAR2,
version
VARCHAR2,
deprecated BOOLEAN)
IS
BEGIN
i:=i+1;
op(i).name:=name;
op(i).version:=version;
op(i).deprecated:=deprecated;
END store_removed;
--------------------------- store_special -------------------------------PROCEDURE store_special (i
IN OUT BINARY_INTEGER,
old VARCHAR2,
oldv VARCHAR2,
new VARCHAR2,
newv VARCHAR2)
IS
BEGIN
i:= i+1;
sp(i).oldname:=old;
sp(i).oldvalue:=oldv;
sp(i).newname:=new;
sp(i).newvalue:=newv;
END store_special;
status NUMBER)
IS
BEGIN
cmp_info(i).processed := TRUE;
IF status = 0 THEN
cmp_info(i).status := 'INVALID';
ELSIF status = 1 THEN
cmp_info(i).status := 'VALID';
ELSIF status = 2 THEN
cmp_info(i).status := 'LOADING';
ELSIF status = 3 THEN
cmp_info(i).status := 'LOADED';
ELSIF status = 4 THEN
cmp_info(i).status := 'UPGRADING';
ELSIF status = 5 THEN
cmp_info(i).status := 'UPGRADED';
ELSIF status = 6 THEN
cmp_info(i).status := 'DOWNGRADING';
ELSIF status = 7 THEN
cmp_info(i).status := 'DOWNGRADED';
ELSIF status = 8 THEN
cmp_info(i).status := 'REMOVING';
ELSIF status = 9 THEN
cmp_info(i).status := 'OPTION OFF';
ELSIF status = 10 THEN
cmp_info(i).status := 'NO SCRIPT';
ELSIF status = 99 THEN
cmp_info(i).status := 'REMOVED';
ELSE
cmp_info(i).status := NULL;
END IF;
cmp_info(i).version := version;
cmp_info(i).schema
:= schema;
EXECUTE IMMEDIATE
'SELECT default_tablespace FROM sys.dba_users WHERE username =:1'
INTO cmp_info(i).def_ts
USING schema;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END store_comp;
------------------------------ update_puiu_data --------------------PROCEDURE update_puiu_data (dtype varchar2, dname varchar2, delta number)
IS
BEGIN
IF collect_diag AND NOT db_readonly THEN
EXECUTE IMMEDIATE 'UPDATE sys.puiu$data SET puiu_delta = :delta
WHERE d_type=:dtype and d_name= :dname'
USING delta, dtype, dname;
COMMIT;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
------------------------------ insert_puiu_data --------------------PROCEDURE insert_puiu_data (dtype varchar2, dname varchar2, delta number)
IS
BEGIN
IF collect_diag AND NOT display_xml AND NOT db_readonly THEN
EXECUTE IMMEDIATE 'INSERT INTO sys.puiu$data
(d_type, d_name, puiu_delta) VALUES (:dtype, :dname, :delta)'
USING dtype, dname, delta;
COMMIT;
END IF;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN NULL;
END;
-------------------------- is_comp_tablespace ------------------------------------ returns TRUE if some existing component has the tablespace as a default
FUNCTION is_comp_tablespace (tsname VARCHAR2) RETURN BOOLEAN
IS
BEGIN
FOR i IN 1..max_components LOOP
IF cmp_info(i).processed AND
tsname = cmp_info(i).def_ts THEN
RETURN TRUE;
END IF;
END LOOP;
RETURN FALSE;
END is_comp_tablespace;
-------------------------- ts_has_queues ---------------------------------- returns TRUE if there is at least one queue in the tablespace
FUNCTION ts_has_queues (tsname VARCHAR2) RETURN BOOLEAN
IS
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.dba_tables t
WHERE EXISTS
(SELECT 1 FROM sys.dba_queues q
WHERE q.queue_table = t.table_name AND q.owner = t.owner)
AND t.tablespace_name = :1 AND rownum <= 1'
INTO p_null
USING tsname;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN RETURN FALSE;
END ts_has_queues;
-------------------------- ts_is_SYS_temporary ---------------------------------- returns TRUE if there is at least one queue in the tablespace
FUNCTION ts_is_SYS_temporary (tsname VARCHAR2) RETURN BOOLEAN
IS
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.dba_users
WHERE username = ''SYS'' AND temporary_tablespace = :1'
INTO p_null
USING tsname;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN RETURN FALSE;
END ts_is_SYS_temporary;
ELSE
display_line(
'--> The existing log files are adequate. No changes are required.');
END IF;
display_line ('.');
END IF;
END display_logfiles;
------------------------------ display_flashback ----------------------------- Display details relating to flashback setting of the database
PROCEDURE display_flashback
IS
BEGIN
IF dbv = 920 THEN
--- No flashback until 10.n
-RETURN;
END IF;
IF display_xml THEN
display_line(
'<FlashbackInfo name="' || flashback_info.name ||
'" status="' || boolval (flashback_info.active, 'ON', 'OFF') ||
'" limit="' || TO_CHAR((flashback_info.limit / (1024*1024)))
|| ' MB' ||
'" used="' || TO_CHAR( round((flashback_info.used / (1024 * 10
24)),0)) || ' MB' ||
'" size="' || TO_CHAR( (flashback_info.dsize / (1024*1024)))
|| ' MB' ||
'" reclaim="' || TO_CHAR( (flashback_info.reclaimable) / (1024
*1024)) || ' MB' ||
'" files="' || TO_CHAR(flashback_info.files) ||
'" />');
ELSE
display_banner;
display_line('Flashback: ' || boolval(flashback_info.active, 'ON', 'OFF'));
display_banner;
IF flashback_info.active THEN
display_line('FlashbackInfo:');
display_line ('--> name:
'
display_line ('--> limit:
'
1024*1024)))
|| ' MB');
display_line ('--> used:
'
d / (1024 * 1024)),0)) || ' MB');
display_line ('--> size:
'
1024*1024)))
|| ' MB');
display_line ('--> reclaim:
'
le / (1024*1024))) || ' MB');
display_line ('--> files:
'
display_warning('Flashback Recovery
k space ' ||
'
n upgrade.');
display_line ('.');
END IF;
|| flashback_info.name );
|| TO_CHAR( (flashback_info.limit / (
|| TO_CHAR( round((flashback_info.use
|| TO_CHAR( (flashback_info.dsize / (
|| TO_CHAR( (flashback_info.reclaimab
|| TO_CHAR(flashback_info.files));
Area Set. Please ensure adequate dis
in recovery areas before performing a
END IF;
END display_flashback;
----------------------- display_crs_xml ------------------------------ Display create rollback segment. Display is in xml format, only
-- for use by DBUA. Static. Note: display_line does no more than
-- 255 bytes.
PROCEDURE display_crs_xml
IS
BEGIN
display_line(
'<CreateRollbackSegments value="ODMA_RBS01" revert="true">');
display_line(
'<InNewTablespace name="ODMA_RBS" size="70" unit="MB">');
display_line(
'<Datafile name="{ORACLE_BASE}/oradata/{DB_NAME}/odma_rbs.dbf"/>');
display_line(
'<Autoextend value="ON">');
display_line(
'<Next value="10" unit="MB"/>');
display_line(
'<Maxsize value="200" unit="MB"/>');
display_line(
'</Autoextend>');
display_line(
'<Storage>');
display_line(
'<Initial value="10" unit="MB"/>');
display_line(
'<Next value="10" unit="MB"/>');
display_line(
'<MinExtents value="1"/>');
display_line(
'<MaxExtents value="30"/>');
display_line(
'</Storage>');
display_line(
'</InNewTablespace>');
display_line(
'</CreateRollbackSegments>');
END display_crs_xml;
---------------------- display_sysaux -----------------------------PROCEDURE display_sysaux
IS
BEGIN
IF display_xml THEN
display_line('<SYSAUXtbs>');
ELSE
display_banner;
display_line('SYSAUX Tablespace:');
display_line('[Create tablespace in the Oracle ' ||
'Database 11.2 environment]');
display_banner;
END IF;
IF sysaux_exists THEN
IF display_xml THEN
display_line('<SysauxTablespace present="true"/>');
display_line('<Attributes>');
display_line('<Size value="' || TO_CHAR(delta_sysaux) ||
'" unit="MB"/>');
IF sysaux_not_online THEN
display_line('<Online value="false"/>');
ELSE
display_line('<Online value="true"/>');
END IF;
IF sysaux_not_perm THEN
display_line('<Permanent value="false"/>');
ELSE
display_line('<Permanent value="true"/>');
END IF;
-- Online and Readwrite are together
IF sysaux_not_online THEN
display_line('<Readwrite value="false"/>');
ELSE
display_line('<Readwrite value="true"/>');
END IF;
IF sysaux_not_local THEN
display_line('<ExtentManagementLocal value="false"/>');
ELSE
display_line('<ExtentManagementLocal value="true"/>');
END IF;
IF sysaux_not_auto THEN
display_line(
'<SegmentSpaceManagementAuto value="false"/>');
ELSE
display_line(
'<SegmentSpaceManagementAuto value="true"/>');
END IF;
display_line('</Attributes>');
ELSE
display_line('WARNING: SYSAUX tablespace is present.');
display_line(
'.... Minimum required size for database upgrade:' ||
TO_CHAR(delta_sysaux) || ' MB');
-- Online and Readwrite are together
IF sysaux_not_online THEN
display_line('WARNING:.... OFFLINE');
ELSE
display_line('.... Online');
END IF;
IF sysaux_not_perm THEN
display_line('WARNING:.... NOT Permanent');
ELSE
display_line('.... Permanent');
END IF;
-- Online and Readwrite are together
IF sysaux_not_online THEN
display_line('WARNING:.... NOT Readwrite');
ELSE
display_line('.... Readwrite');
END IF;
IF sysaux_not_local THEN
display_line(
'.... WARNING: NOT ExtentManagementLocal');
ELSE
display_line('.... ExtentManagementLocal');
END IF;
IF sysaux_not_auto THEN
display_line(
'WARNING:.... NOT SegmentSpaceManagementAuto');
ELSE
display_line(
'.... SegmentSpaceManagementAuto');
END IF;
END IF;
ELSE -- SYSAUX tablespace does not exist
IF display_xml THEN
display_line('<SysauxTablespace present="false"/>');
display_line('<Attributes>');
display_line('<Size value="' ||
TO_CHAR(delta_sysaux) || '" unit="MB"/>');
display_line('</Attributes>');
ELSE
display_line('--> New "SYSAUX" tablespace ');
display_line(
'.... minimum required size for database upgrade: ' ||
TO_CHAR(delta_sysaux) || ' MB');
END IF;
END IF;
IF display_xml THEN
display_line('</SYSAUXtbs>');
ELSE
display_line ('.');
END IF;
END display_sysaux;
--------------------------- display_components ----------------------------PROCEDURE display_components
IS
ui VARCHAR2(10);
tmp_varchar VARCHAR2(30);
BEGIN
IF display_xml THEN
IF (cmp_info(catalog).status = 'VALID' AND cmp_info(catproc).status = 'VAL
ID') THEN
tmp_varchar := cmp_info(catalog).status;
ELSE
tmp_varchar := 'INVALID';
END IF;
display_line('');
display_line('<Components>');
--- For Server status, use Catalog status (catalog and catproc are
-- skipped in the below loop)
-display_line(
'<Component id ="Oracle Server" type="SERVER" cid="RDBMS" status="' ||
tmp_varchar || '">');
display_line(
'<CEP value="{ORACLE_HOME}/rdbms/admin/rdbmsup.sql"/>');
display_line(
TO_CHAR(ROUND(ts_info(i).addl)) ||
'" unit="MB"/>');
display_line('</DefaultTablespace>');
END IF;
END IF;
END IF;
END LOOP;
display_logfiles;
display_line('</MinFreeSpace>');
-- Display the DBUA required create rollback segment static tags
display_crs_xml;
display_line('</SystemResource>');
-- Report the SYSAUX tablespace
IF dbv NOT IN (101,102) THEN
display_sysaux;
END IF;
ELSE -- display TEXT output
display_banner;
display_line(
'Tablespaces: [make adjustments in the current environment]');
display_banner;
IF max_ts > 0 THEN
FOR i IN 1..max_ts LOOP
IF ts_info(i).inc_by = 0 THEN
display_line(
'--> ' || ts_info(i).name ||
' tablespace is adequate for the upgrade.');
IF collect_diag_2 THEN
display_line(
'.... currently allocated size: ' ||
TO_CHAR(ROUND(ts_info(i).alloc)) || ' MB');
display_line(
'.... currently used size: ' ||
TO_CHAR(ROUND(ts_info(i).inuse)) || ' MB');
END IF;
display_line(
'.... minimum required size: ' ||
TO_CHAR(ROUND(ts_info(i).min)) || ' MB');
ELSE -- need more space in tablespace
display_warning(ts_info(i).name ||
' tablespace is not large enough for the upgrade.');
display_line(
'.... currently allocated size: ' ||
TO_CHAR(ROUND(ts_info(i).alloc)) || ' MB');
IF collect_diag_2 THEN
display_line(
'.... currently used size: ' ||
TO_CHAR(ROUND(ts_info(i).inuse)) || ' MB');
END IF;
display_line(
'.... minimum required size: ' ||
TO_CHAR(ROUND(ts_info(i).min)) || ' MB');
display_line(
'.... increase current size by: ' ||
TO_CHAR(ROUND(ts_info(i).inc_by)) || ' MB');
IF ts_info(i).fauto THEN
display_line(
'.... tablespace is AUTOEXTEND ENABLED.');
ELSE
display_line(
'.... tablespace is NOT AUTOEXTEND ENABLED.');
END IF;
END IF;
END LOOP;
display_line ('.');
END IF;
END IF;
END display_tablespaces;
------------------------------ display_rollback_segs ---------------------- Display information about public rollback segments
PROCEDURE display_rollback_segs
IS
auto VARCHAR2(3);
BEGIN
IF NOT display_xml THEN
IF max_rs > 0 THEN
display_banner;
display_line('Rollback Segments: [make adjustments ' ||
'immediately prior to upgrading]');
display_banner;
-- Loop through the rs_info table
FOR i IN 1..max_rs LOOP
IF rs_info(i).auto > 0 THEN
auto:='ON';
ELSE
auto:='OFF';
END IF;
display_line(
'--> ' || rs_info(i).seg_name || ' in tablespace ' ||
rs_info(i).tbs_name || ' is ' ||
rs_info(i).status ||
'; AUTOEXTEND is ' || auto);
display_line(
'.... currently allocated: ' || rs_info(i).inuse
|| 'K');
display_line(
'.... next extent size: ' || rs_info(i).next
|| 'K; max extents: ' || rs_info(i).max_ext);
END LOOP;
display_warning('For the upgrade, use a large (minimum 70M) ' ||
'public rollback segment');
IF max_rs > 1 THEN
display_warning('Take smaller public rollback segments OFFLINE');
END IF;
display_line ('.');
END IF;
END IF;
END display_rollback_segs;
---------------------------- display_update_params_xml ------------------------
END IF;
END display_update_params_xml;
------------------------------- display_parameters_xml ------------------------- Display any renamed, obsolete, and special parameters.
PROCEDURE display_parameters_xml
IS
BEGIN
display_line('<InitParams>');
--- Update parameters
-display_line('<Update>');
IF db_64 THEN
display_update_params_xml(minvp_db64);
ELSE
display_update_params_xml(minvp_db32);
END IF;
display_line('</Update>');
-- End of Update Parameters.
-- Static tags for Migration and NonHandled go here (XML, only)
display_line('<Migration>');
-- display_line('<Parameter name="optimizer_mode" value="choose"/>');
display_line('</Migration>');
display_line('<NonHandled>');
display_line('<Parameter name="remote_listener"/>');
display_line('</NonHandled>');
-- Renamed Parameters
display_line('<Rename>');
FOR i IN 1..max_rp LOOP
IF rp(i).db_match = TRUE THEN
display_line(
'<Parameter oldName="' || rp(i).oldname ||
'" newName="' || rp(i).newname || '"/>');
END IF;
END LOOP;
-- Display parameters that have a new name and a new value
FOR i IN 1..max_sp LOOP
IF sp(i).db_match = TRUE AND
sp(i).newvalue IS NOT NULL THEN
display_line('<Parameter oldName="' || sp(i).oldname ||
'" newName="' || sp(i).newname ||
'" newValue="' || sp(i).newvalue || '"/>');
END IF;
END LOOP;
display_line('</Rename>');
-- Display Obsolete Parameters to remove
display_line('<Remove>');
display_warning('"' || minvp(i).name ||
'" needs to be increased to at least ' ||
TO_CHAR(ROUND(minvp(i).newvalue)) || tmp_varchar1);
END IF;
ELSE
-- Convert to M from bytes
IF i IN (tg_idx,pg_idx,jv_idx,sp_idx,mt_idx) THEN
display_line(
'--> "'||minvp(i).name || '" is already at ' ||
TO_CHAR(ROUND((minvp(i).oldvalue/1024)/1024)) ||
'; calculated minimum value is ' ||
TO_CHAR(ROUND((minvp(i).newvalue/1024)/1024)) || ' MB');
ELSE
display_line(
'--> "'||minvp(i).name || '" is already at ' ||
TO_CHAR(ROUND(minvp(i).oldvalue)) ||
'; calculated minimum value is ' ||
TO_CHAR(ROUND(minvp(i).newvalue)));
END IF;
END IF;
END IF; -- null oldvalue
END IF; -- not (mt_idx and mt null oldvalue)
END IF; -- not (jv_idx and not processed)
END IF; -- display
END LOOP;
-- Required values if missing
FOR i IN 1..max_reqp LOOP
IF reqp(i).db_match = TRUE THEN
changes_req := TRUE;
IF reqp(i).type = 3 THEN
display_warning('"' ||
reqp(i).name || '" is not defined and must have a value=' ||
TO_CHAR(ROUND(reqp(i).newnumbervalue)));
ELSIF reqp(i).type = 2 THEN
display_warning('"' ||
reqp(i).name || '" is not defined and must have a value=' ||
reqp(i).newstringvalue);
END IF;
END IF;
END LOOP;
IF NOT changes_req THEN
display_line(
'-- No update parameter changes are required.');
END IF;
display_line('.');
END display_update_params_text;
------------------------------- display_parameters_text ------------------------ Display any renamed, obsolete, and special parameters.
PROCEDURE display_parameters_text
IS
changes_req BOOLEAN := FALSE;
do VARCHAR2(15);
-- Used for temp output value
BEGIN
display_line('<warning name="HIDDEN_PARAMS"/>');
END IF;
IF non_default_events THEN
display_line('<warning name="NON_DEFAULT_EVENTS"/>');
END IF;
IF dmsys_recommendation THEN
display_line('<warning name="REMOVE_DMSYS"/>');
END IF;
END display_recommendations_xml;
--- Display Recommendation for text
-PROCEDURE display_recommendations
IS
BEGIN
display_banner;
display_line('Recommendations');
--- Stale Stats - we don't check any more, but dump out the info on how to
-update them
-display_banner;
display_line('Oracle recommends gathering dictionary statistics prior to');
display_line('upgrading the database.');
IF dbv = 920 THEN
display_line('To gather dictionary statistics execute the following command
s');
display_line('while connected as SYSDBA:');
OPEN tmp_cursor FOR
'SELECT name FROM sys.user$ WHERE name IN
(''SYS'', ''SYSTEM'', ''WMSYS'',''MDSYS'',''CTXSYS'',''XDB'',''WK
SYS'',''LBACSYS'',''ORDSYS'',
''ORDPLUGINS'',''SI_INFORMATION_SCHEMA'', ''OUTLN'', ''DBSNMP'')
';
LOOP
FETCH tmp_cursor INTO tmp_varchar1;
EXIT when tmp_cursor%NOTFOUND;
display_line ('
EXECUTE dbms_stats.gather_schema_stats(''' || tmp_varc
har1 ||
''',options=>''GATHER''');
display_line ('
,estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZ
E');
display_line ('
,method_opt=>''FOR ALL COLUMNS SIZE AUTO''');
display_line ('
,cascade=>TRUE);');
END LOOP;
CLOSE tmp_cursor;
ELSE
display_line('To gather dictionary statistics execute the following command
');
display_line('while connected as SYSDBA:');
display_line('');
display_line('
EXECUTE dbms_stats.gather_dictionary_stats;');
END IF;
display_line('');
END IF;
-- bug 12699712: alert if aud$/fga_log$ will be populated during db upgrade
-- from 101/102/111
IF (dbv = 101 or dbv = 102 or dbv = 111) THEN
IF (aud_upd_rowcnt > 0 or fga_upd_rowcnt > 0) THEN
display_banner;
display_line('Oracle recommends examining audit tables AUD$ and FGA_LOG$
before ');
display_line('upgrading the database.');
display_line('');
display_line('This database has ' || aud_upd_rowcnt || ' rows in AUD$ and
' || fga_upd_rowcnt || ' rows in FGA_LOG$ that ');
display_line('will be updated during the database upgrade from ' || db_v
ersion || '.');
display_line('');
display_line('During this upgrade, null DBIDs in AUD$ and FGA_LOG$ will b
e updated ');
display_line('with non-null values.');
display_line('');
display_line('The upgrade downtime could be affected if there are many ro
ws to update. ');
display_line('If downtime is a concern, the audit update could be done ma
nually prior ');
display_line('to upgrading the database. ');
display_line('');
display_line('Please refer to My Oracle Support Note 1329590.1 titled "Ho
w to ');
display_line('Pre-Process SYS.AUD$ Records Pre-Upgrade From 10.1 or Later
to 11.2".');
display_line('');
END IF;
END IF;
-- End Recommendations section with a banner.
display_banner;
END display_recommendations;
IF cluster_dbs THEN
display_line('<warning name="CLUSTER_DATABASE"/>');
END IF;
IF dip_user_exists THEN
display_line('<warning name="DIP_USER_PRESENT"/>');
END IF;
IF ocm_user_exists THEN
display_line('<warning name="OCM_USER_PRESENT"/>');
END IF;
IF qos_user_exists THEN
display_line('<warning name="APPQOSSYS_USER_PRESENT"/>');
END IF;
IF nls_al24utffss THEN
display_line(
'<warning name="DESUPPORTED_CHARSET_AL24UTFFSS"/>');
END IF;
IF utf8_al16utf16 THEN
display_line(
'<warning name="NCHAR_TYPE_NOT_SUPP"/>');
END IF;
IF owm_replication THEN
display_line('<warning name="WMSYS_REPLICATION_PRESENT"/>');
END IF;
IF dblinks THEN
display_line('<warning name="DBLINKS_WITH_PASSWORDS"/>');
END IF;
IF cdc_data THEN
display_line('<warning name="CDC_CHANGE_SOURCE"/>');
END IF;
IF connect_role THEN
display_line('<warning name="CONNECT_ROLE_IN_USE"/>');
END IF;
IF invalid_objs THEN
display_line('<warning name="INVALID_OBJECTS_EXIST"/>');
END IF;
IF ssl_users THEN
display_line('<warning name="SSL_USERS_EXIST"/>');
END IF;
IF timezone_old THEN
display_line('<warning name="OLD_TIME_ZONES_EXIST"/>');
ELSIF timezone_new THEN
display_line('<warning name="NEW_TIME_ZONES_EXIST"/>');
END IF;
IF em_exists THEN
display_line('<warning name="EM_PRESENT"/>');
END IF;
display_recommendations_xml;
display_line('</Warnings>');
ELSE
IF version_mismatch or cluster_dbs OR dip_user_exists OR
nls_al24utffss OR ssl_users OR timezone_old OR timezone_new OR
utf8_al16utf16 OR owm_replication OR dblinks OR connect_role OR
invalid_objs OR cdc_data OR ocm_user_exists OR
em_exists OR remote_redo_issue OR laf_format OR
enabled_indexes_tbl OR dbms_ldap_dep OR edition_exists
THEN
display_banner;
display_line('Miscellaneous Warnings');
display_banner;
ELSE
RETURN;
END IF;
IF version_mismatch THEN
display_warning('The database has not been patched to release ' ||
db_version || '.');
display_line('... Run catpatch.sql prior to upgrading.');
END IF;
IF cluster_dbs THEN
display_warning('The "cluster_database" parameter is currently "TRUE"')
;
display_line('.... and must be set to "FALSE" prior to running a manual
upgrade.');
END IF;
IF dip_user_exists THEN
display_warning('"DIP" user found in database.');
display_line(
'.... This is a generic account used for '||
'connecting to ');
display_line(
'.... the Database when processing DIP ' ||
'callback functions.');
display_line(
'.... Oracle may add additional privileges to this account '||
'during the upgrade.');
END IF;
IF ocm_user_exists THEN
display_warning('"ORACLE_OCM" user found in database.');
display_line(
'.... This is an internal account used by the '||
'Oracle Configuration Manger. ');
display_line(
'.... Oracle recommends dropping this user prior to '||
'upgrading.');
END IF;
IF qos_user_exists THEN
display_warning('"APPQOSSYS" user found in database.');
display_line(
'.... This is an internal account used by Oracle Application Qualit
y');
display_line(
'.... of Service Management.');
display_line(
'.... Oracle recommends dropping this user prior to upgrading.');
END IF;
IF nls_al24utffss THEN
display_warning('"nls_characterset" has ' ||
' "AL24UTFFSS" character set.');
display_line(
' * The database must be converted to a supported character ' ||
'set prior to upgrading.');
END IF;
IF utf8_al16utf16 THEN
display_warning('Your database is using an ' ||
'obsolete NCHAR character set.');
display_line(
'The NCHAR data types (NCHAR, NVARCHAR2, and NCLOB)');
display_line('are limited to the Unicode character ' ||
'set encoding UTF8 and AL16UTF16.');
END IF;
IF owm_replication THEN
display_warning('Workspace Manager replication is in use.');
display_line(
'.... Drop OWM replication support before upgrading:');
display_line(
'.... EXECUTE dbms_wm.DropReplicationSupport;');
END IF;
IF dblinks THEN
display_warning('Passwords exist in some database links.');
display_line(
'.... Passwords will be encrypted during the upgrade.');
display_line(
'.... Downgrade of database links with passwords is not supported.');
END IF;
IF cdc_data THEN
display_warning('CDC change sources exist; for full 11.2 support, alter
');
display_line(
'.... the change source on the staging database after the upgrade.');
END IF;
IF connect_role THEN
display_warning('Deprecated CONNECT role granted to some user/roles.');
display_line(
'.... CONNECT role after upgrade has only CREATE SESSION privilege.')
;
END IF;
-- bug 7193417: support time zone change in 11.2
IF timezone_old or timezone_new THEN
IF timezone_old THEN
display_warning('Database is using a timezone file older than version
' || utlu_tz_version || '.');
display_line(
''GV$SQLAREA_PLAN_HASH'',''GV$ARCHIVE_GAP'',
''V$STREAMS_APPLY_SERVER'',''DBA_DDL_LOCKS'',
''DBA_LOCK_INTERNAL'', ''V_$STREAMS_APPLY_SERVER''
,
''DBA_KGLLOCK'',''GV$LOGSTDBY_TRANSACTION'',
''GV_$DATAFILE'', ''GV_$STREAMS_APPLY_SERVER'',
''GV$STREAMS_APPLY_SERVER'', ''GV$DATAFILE'',
''GV_$LOGSTDBY_TRANSACTION'',
''GV$SYSTEM_EVENT'', ''V$SQL_MONITOR'',
''GV$WLM_PCMETRIC'',''V$WLM_PCMETRIC'',
''V$DB_OBJECT_CACHE'',''GV$LOGMNR_REGION'',
''GV$ASM_DISK_STAT'',''GV$WLM_PCMETRIC_HISTORY'',
''V$WLM_PCMETRIC_HISTORY'',''V$DNFS_CHANNELS'',
''V$HANG_INFO'',''GV$DNFS_STATS'',
''GV$SESSION_CONNECT_INFO'',''GV$SQL_MONITOR'',
''GV$ASM_OPERATION'',''V$DNFS_STATS'',
''GV$DB_OBJECT_CACHE'',''GV$ARCHIVE_PROCESSES'',
''GV$RESULT_CACHE_OBJECTS'',
''GV$ASM_DISK'',''
''V$ARCHIVE_PROCESSES'',
V$LOGMNR_REGION'',
''V$RESULT_CACHE_OBJECTS'', ''GV$ROWCACHE'',''V$ROWCACHE'',''GV$PROCESS_MEMORY_D
ETAIL'',''V$PROCESS_MEMORY_DETAIL'',''GV$DLM_MISC'',''V$DLM_MISC'',''V$DELETED_O
BJECT'',''GV$DELETED_OBJECT'',''GV$STREAMS_APPLY_COORDINATOR'',''V$STREAMS_APPLY
_COORDINATOR'')
AND referenced_type in (''VIEW'',''PACKAGE'
') OR
name = ''V_$ROLLNAME''
CONNECT BY
PRIOR name = referenced_name and
PRIOR type = referenced_type)
GROUP by owner';
LOOP
FETCH tmp_cursor INTO tmp_varchar1, tmp_num1;
EXIT WHEN tmp_cursor%NOTFOUND;
display_line('.... USER ' || tmp_varchar1 || ' has ' || tmp_num1
||
' INVALID objects.');
END LOOP;
CLOSE tmp_cursor;
END IF;
END IF;
IF ssl_users THEN
display_warning('Database contains globally authenticated users.');
display_line(
'.... Refer to the Upgrade Guide to upgrade SSL users.');
END IF;
IF em_exists THEN
display_warning('EM Database Control Repository exists in the database.
');
display_line(
'.... Direct downgrade of EM Database Control is not supported. Refer
to the');
display_line(
'.... Upgrade Guide for instructions to save the EM data prior to upg
rade.');
END IF;
IF snapshot_refresh THEN -- TRUE when outstanding snapshot refreshes
---------IF
views in their schema. The dba will need to take action to enable
editions on the users found to fix this inconsistency in their data
dictionary. There are three ways to remedy this:
1. drop these editioning views
2. editions enable the listed schemas
3. replace the editioning views with regular views
This check is only required for upgrades from 11.2.0.1 to 11.2.0.2
dbv=112 AND edition_exists THEN
-- user/schema is not edition enabled
display_warning('Database contains the following editioning views yet')
;
display_warning('the corresponding schema is not edition enabled.');
display_line('.... The upgrade process will not continue unless you');
display_line('.... drop these views OR re-create these as regular view
s');
display_line('.... OR edition enable each owner of the view(s).');
OPEN tmp_cursor FOR
'SELECT DISTINCT EV.owner,EV.view_name from SYS.DBA_EDITIONING_VIEWS EV
WHERE EXISTS
(select 1 from SYS.DBA_USERS WHERE USERNAME=EV.OWNER AND
EDITIONS_ENABLED <> ''Y'')';
LOOP
FETCH tmp_cursor INTO tmp_varchar1, tmp_varchar2;
EXIT WHEN tmp_cursor%NOTFOUND;
display_line('.... User: ' || RPAD(tmp_varchar1,32) ||
' View: ' || RPAD(tmp_varchar2,32));
END LOOP;
CLOSE tmp_cursor;
display_line('....');
END IF; -- end of editions enabled
--------IF
Bug 12807768: On upgrades from pre-10205 (e.g. 9208, 10105, 10204 but
not 10205) to 112, timed_statistics must be TRUE if statistics_level is
not BASIC. Else, db will fail to start up in the new oracle home,
throwing the following errors:
ORA-00044: timed_statistics must be TRUE when statistics_level is not
BASIC
ORA-01078: failure in processing system parameters
s too low.');
display_line ('');
display_line ('.... Starting with Oracle Database 11g Release 2 (11.2), s
etting');
display_line ('.... JOB_QUEUE_PROCESSES to 0 causes both DBMS_SCHEDULER a
nd');
display_line ('.... DBMS_JOB jobs to not run. Previously, setting JOB_QUE
UE_PROCESSES');
display_line ('.... to 0 caused DBMS_JOB jobs to not run, but DBMS_SCHEDU
LER jobs were');
display_line ('.... unaffected and would still run. This parameter must b
e updated to');
display_line ('.... a value greater than ' || to_char(cpu*cpu_threads) ||
' (default value is 1000) prior to upgrade.');
display_line ('.... Not doing so will affect the running of utlrp.sql aft
er the upgrade');
END IF;
--- This Warning is ALWAYS the last to go out in this section.
-IF db_readonly THEN
display_warning ('Database is open for READ ONLY.');
display_line (' Not all checks are being performed.');
display_line (' This Script must be run at least once on the database'
);
display_line (' when it is open for READ WRITE.');
END IF;
--- mark the end of the section
-display_line('.');
END IF;
END display_misc_warnings;
--------------------------- pvalue_to_number --------------------------------- This function converts a parameter string to a number. The function takes
-- into account that the parameter string may have a 'K' or 'M' multiplier
-- character.
FUNCTION pvalue_to_number (value_string VARCHAR2) RETURN NUMBER
IS
ilen NUMBER;
pvalue_number NUMBER;
BEGIN
-- How long is the input string?
ilen := LENGTH ( value_string );
-- Is there a 'K' or 'M' in last position?
IF SUBSTR(UPPER(value_string), ilen, 1) = 'K' THEN
RETURN (1024 * TO_NUMBER (SUBSTR (value_string, 1, ilen-1)));
ELSIF SUBSTR(UPPER(value_string), ilen, 1) = 'M' THEN
RETURN (1024 * 1024 * TO_NUMBER (SUBSTR (value_string, 1, ilen-1)));
END IF;
-- A multiplier wasn't found. Simply convert this string to a number.
RETURN (TO_NUMBER (value_string));
END pvalue_to_number;
--------------------------- store_oldval ----------------------------------PROCEDURE store_oldval (minvp IN OUT MINVALUE_TABLE_T)
IS
sps
NUMBER; -- shared_pool_size
sps_ovrhd NUMBER; -- shared_pool_size overheads
BEGIN
FOR i IN 1..max_minvp LOOP
IF i = sp_idx and dbv = 920 THEN
-- This block of code is dealing with shared_pool_size
EXECUTE IMMEDIATE 'SELECT SUM(bytes) FROM v$sgastat WHERE pool=''shared
pool'''
INTO minvp(sp_idx).oldvalue;
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name = LOWER(:1)'
INTO p_value
USING minvp(i).name;
sps := pvalue_to_number(p_value);
-- On a large database, the minimum of 144M may not be enough for shared
-- pool size, we have to factor in the number of CPU, the number of sess
ion,
-- and some new added features. So here is the formula:
-- Recommended minimum share_pool_size = minvp(sp_idx).minvalue +
-- (Num_of_CPU * 2MB) +
-- (Num_of_sessiions * 17408) +
-- (10% of the old shared_pool_size for overhead)
sps_ovrhd := sps * 0.1;
IF collect_diag THEN
display_line('DIAG-sps_min: ' || minvp(sp_idx).minvalue);
-display_line('DIAG-cpu: ' || cpu
-|| ', cpu*2097152: ' || cpu * 2097152);
display_line('DIAG-sesn: ' || sesn || ', sesn*17408: '
|| sesn * 17408);
display_line('DIAG-sps: ' || sps ||
', sps_ovrhd(10%): ' || sps_ovrhd);
minvp(sp_idx).minvalue := minvp(sp_idx).minvalue +
/* avoid CPU dependency in DIAG mode (cpu * 2097152) + */
(sesn * 17408) +
(sps_ovrhd);
ELSE
minvp(sp_idx).minvalue := minvp(sp_idx).minvalue +
(cpu * 2097152) +
(sesn * 17408) +
(sps_ovrhd);
END IF;
ELSE
BEGIN
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name =
LOWER(:1)'
INTO p_value
USING minvp(i).name;
minvp(i).oldvalue := pvalue_to_number(p_value);
minvp(mt_idx).minvalue :=
minvp(cs_idx).minvalue + minvp(jv_idx).minvalue +
minvp(sp_idx).minvalue + minvp(lp_idx).minvalue +
minvp(str_idx).minvalue + minvp(pg_idx).minvalue + extra;
-- buffer cache (cs)
IF minvp(cs_idx).oldvalue > minvp(cs_idx).minvalue THEN
minvp(cs_idx).diff := minvp(cs_idx).oldvalue - minvp(cs_idx).minvalue;
END IF;
-- java pool (jv)
IF minvp(jv_idx).oldvalue > minvp(jv_idx).minvalue THEN
minvp(jv_idx).diff := minvp(jv_idx).oldvalue - minvp(jv_idx).minvalue;
END IF;
-- shared pool (sp)
IF minvp(sp_idx).oldvalue > minvp(sp_idx).minvalue THEN
minvp(sp_idx).diff := minvp(sp_idx).oldvalue - minvp(sp_idx).minvalue;
END IF;
-- large pool (lp)
IF minvp(lp_idx).oldvalue > minvp(lp_idx).minvalue THEN
minvp(lp_idx).diff := minvp(lp_idx).oldvalue - minvp(lp_idx).minvalue;
END IF;
-- streams pool (str)
IF minvp(str_idx).oldvalue > minvp(str_idx).minvalue THEN
minvp(str_idx).diff :=
minvp(str_idx).oldvalue - minvp(str_idx).minvalue;
END IF;
-- pga_aggregate_target (pg)
IF minvp(pg_idx).oldvalue > minvp(pg_idx).minvalue THEN
minvp(pg_idx).diff :=
minvp(pg_idx).oldvalue - minvp(pg_idx).minvalue;
END IF;
-- calculate sga_target 'newvalue' (new derived minimum) based on
-- tg_idx.minvalue and user-specified pool sizes
minvp(tg_idx).newvalue :=
minvp(tg_idx).minvalue + minvp(cs_idx).diff
+ minvp(jv_idx).diff + minvp(sp_idx).diff
+ minvp(lp_idx).diff + minvp(str_idx).diff;
-- calculate memory_target 'newvalue' (new derived minimum) based on
-- mt_idx.minvalue and user-specified pool sizes
minvp(mt_idx).newvalue :=
minvp(mt_idx).minvalue + minvp(cs_idx).diff
+ minvp(jv_idx).diff + minvp(sp_idx).diff
+ minvp(lp_idx).diff + minvp(str_idx).diff + minvp(pg_idx).diff;
IF (minvp(tg_idx).oldvalue != 0) THEN -- SGA_TARGET in use
-- calculate 'newvalue' (new derived minimum) based on user-set sga_target
-- and user-set pga_aggregate_target. also add 12M to this calculation
-- for memory_target if sga_target is also set.
mtgval := minvp(tg_idx).oldvalue + minvp(pg_idx).oldvalue + 12*1024*1024;
-- set 'newvalue' to the larger of the two new derived minimums (see above)
IF (mtgval > minvp(mt_idx).newvalue) THEN
minvp(mt_idx).newvalue := mtgval;
END IF;
END IF;
-- Note: Although sga_target and memory_target values are found here, we
-- don't set DISPLAY in minvp in this procedure. This setting is done
-- in find_newval.
END find_sga_mem_values;
PROCEDURE find_newval (minvp IN OUT MINVALUE_TABLE_T,
dbbit NUMBER)
IS
extra
NUMBER;
BEGIN
IF minvp(tg_idx).oldvalue != 0 THEN -- SGA_TARGET in use
find_sga_mem_values(minvp, dbbit);
IF minvp(tg_idx).newvalue > minvp(tg_idx).oldvalue THEN
minvp(tg_idx).display := TRUE;
END IF;
-- do not set display to TRUE for these params: sga_target,
-- memory_target, db_cache_size, java_pool_size,
-- shared_pool_size, large_pool_size, and streams_pool_size
FOR i IN 1..max_minvp LOOP
IF i NOT IN (tg_idx,mt_idx,cs_idx,jv_idx,sp_idx,lp_idx,str_idx) AND
(minvp(i).oldvalue IS NULL OR
minvp(i).oldvalue < minvp(i).minvalue) THEN
minvp(i).display := TRUE;
minvp(i).newvalue := minvp(i).minvalue;
END IF;
END LOOP;
ELSE -- pool sizes included
FOR i IN 1..max_minvp LOOP
-- don't print recommendations for sga_target, memory_target,
-- large_pool_size, and streams_pool_size
IF i NOT IN (tg_idx,mt_idx,lp_idx,str_idx) AND
(minvp(i).oldvalue IS NULL OR
minvp(i).oldvalue < minvp(i).minvalue) THEN
minvp(i).display := TRUE;
minvp(i).newvalue := minvp(i).minvalue;
END IF;
END LOOP;
END IF;
---IF
INTO p_value;
cpu_threads := pvalue_to_number(p_value);
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name = ''sessions'''
INTO p_value;
sesn := pvalue_to_number(p_value);
-- get platform information
BEGIN
EXECUTE IMMEDIATE 'SELECT platform_id, platform_name
FROM v$database'
INTO db_platform_id, db_platform_name;
IF db_platform_id NOT IN (1,7,10,15,16,17) THEN
db_64 := TRUE; -- NOT 32 (solaris, windows, linux, vms, mac, sol x86)
END IF;
EXCEPTION
-- check banner for 9.2
WHEN OTHERS THEN
BEGIN
SELECT NULL INTO p_null FROM v$version
WHERE INSTR(banner,'64') > 0 AND
INSTR(UPPER(banner),'ORACLE') > 0 AND
ROWNUM = 1;
db_64 := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL; -- no 64 bit banner
END;
END;
-- Set if we are open or open readonly
EXECUTE IMMEDIATE 'SELECT open_mode FROM v$database' INTO tmp_varchar1;
IF SUBSTR(tmp_varchar1,1,9) = 'READ ONLY' THEN
db_readonly := TRUE;
ELSE
db_readonly := FALSE;
END IF;
-- determine if memory_target value is set
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM v$parameter WHERE name=''memory_target'
''
INTO p_null;
memory_target := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL; -- memory_target value not set
END;
-- get time zone region version used by server
BEGIN
EXECUTE IMMEDIATE 'SELECT version from v$timezone_file'
INTO db_tz_version;
EXCEPTION
-- no time zone version view in 9.2 (no v$timezone_file)
-- determine time zone version based on UTLTZVER.SQL
WHEN OTHERS THEN
-- Initialize db_tz_version to '' (not 0) as we don't want a record with
-- a numerical value for tz_version to be inserted into
-- registry$database if db_tz_version is not found. This tz_version
-- value and count(*) of registry$database being non-zero are critical
-- to the time zone check in catupstr.sql.
--- For this script to do what it needs to, the database must be
-- in OPEN state, if not, exit right now.
-EXECUTE IMMEDIATE 'SELECT status FROM V$INSTANCE'
INTO tmp_varchar1;
IF tmp_varchar1 NOT IN ('OPEN', 'OPEN MIGRATE') THEN
IF display_xml THEN
display_header_and_db('value="' || vers || '"');
display_line('<WARNINGS>');
display_line('<warning name="DATABASE_NOT_OPEN"/>');
display_line('</WARNINGS>');
display_line('</RDBMSUP>');
ELSE
display_header_and_db('');
display_warning ('Database not in OPEN state.');
display_line (' Database must be in OPEN state for script to execute c
orrectly.');
display_line (' Current Status: ' || tmp_varchar1 || '.');
END IF;
RETURN;
END IF;
-- Turn on diagnostic collection
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.obj$
WHERE owner#=0 AND type#=2 AND name=''PUIU$DATA'''
INTO p_null;
collect_diag := TRUE;
EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for XE database
BEGIN
EXECUTE IMMEDIATE
'SELECT edition FROM sys.registry$ WHERE cid=''CATPROC'''
INTO p_edition;
IF p_edition = 'XE' THEN
xe_upgrade := TRUE;
END IF; -- XE edition
EXCEPTION
WHEN OTHERS THEN NULL; -- no edition column
END;
-----------
BEGIN
EXECUTE IMMEDIATE
'UPDATE registry$database set tz_version = :1'
USING db_tz_version;
EXCEPTION WHEN OTHERS THEN
IF sqlcode = -904 THEN -- registry$database exists but no tz_version
EXECUTE IMMEDIATE
'ALTER TABLE registry$database ADD (tz_version NUMBER)';
EXECUTE IMMEDIATE
'UPDATE registry$database set tz_version = :1'
USING db_tz_version;
EXECUTE IMMEDIATE
'ALTER PACKAGE dbms_registry COMPILE BODY';
EXECUTE IMMEDIATE
'ALTER VIEW dba_registry_database COMPILE';
EXECUTE IMMEDIATE
'ALTER PUBLIC SYNONYM DBA_REGISTRY_DATABASE COMPILE';
END IF;
IF sqlcode = -942 THEN -- no registry$database table so create it
EXECUTE IMMEDIATE
'CREATE TABLE registry$database(
platform_id NUMBER,
platform_name VARCHAR2(101),
edition
VARCHAR2(30),
tz_version
NUMBER
)';
IF substr(db_version,1,3) != '9.2' THEN -- no v$ views for 9.2
EXECUTE IMMEDIATE
'INSERT into registry$database
(platform_id, platform_name, edition, tz_version)
VALUES ((select platform_id from v$database),
(select platform_name from v$database),
NULL,
(select version from v$timezone_file))';
ELSE
EXECUTE IMMEDIATE
'INSERT into registry$database
(platform_id, platform_name, edition, tz_version)
VALUES (NULL, NULL, NULL, :1)'
USING db_tz_version;
END IF;
END IF;
COMMIT;
END;
END IF; -- End if Readonly
-- Get log_mode
-- NOARCHIVELOG means its off
-- ARCHIVELOG means its on
-- Other values, well, we only check for those
-- and if the fetch fails, put it to the default of off.
-BEGIN
EXECUTE IMMEDIATE
'SELECT LOG_MODE FROM v$database'
INTO db_log_mode;
EXCEPTION
WHEN NO_DATA_FOUND THEN db_log_mode := 'NOARCHIVELOG';
END;
IF db_undo != 'AUTO' OR db_undo_tbs IS NULL THEN
db_undo_tbs := 'NO UNDO TBS'; -- undo tbs is not in use
END IF;
IF vers = '11.2.0' AND
patch = utlu_version THEN -- rerun or inplace
BEGIN -- rerun or inplace upgrade since instance is current version
EXECUTE IMMEDIATE 'SELECT version, prv_version FROM sys.registry$
WHERE cid = ''CATPROC'''
INTO db_dict_version, db_prev_version;
IF db_dict_version = db_version THEN -- catproc upgraded, rerun
rerun := TRUE;
vers := substr(db_prev_version,1,6); -- use prev catproc version
ELSE -- 11g patch upgrade inplace
inplace := TRUE;
vers := substr(db_dict_version,1,6); -- use CATPROC version
db_version := db_dict_version;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
rerun := TRUE; -- registry$ exists, but no CATPROC entry
END;
END IF;
IF rerun THEN
IF display_xml THEN
display_header_and_db('rerun="TRUE"');
display_line('<Components>');
IF vers IS NOT NULL THEN -- If null, then is a newly created DB
display_line(
'<Component id ="Oracle Server" type="SERVER" cid="RDBMS">');
display_line(
'<CEP value="{ORACLE_HOME}/rdbms/admin/rdbmsup.sql"/>');
display_line(
'<SupportedOracleVersions value="9.2.0, 10.1.0, 10.2.0, 11.1.0, 11.
2.0"/>');
display_line(
'<OracleVersion value ="'|| db_version || '"/>');
display_line('</Component>');
END IF;
display_line('</Components>');
display_line('</RDBMSUP>');
ELSE
display_header_and_db('');
display_line('Database already upgraded; to rerun upgrade ' ||
'use rdbms/admin/catupgrd.sql.');
END IF;
RETURN;
END IF;
IF vers = '9.2.0.' THEN
dbv := 920;
ELSIF vers = '10.1.0' THEN
dbv := 101;
ELSIF vers = '10.2.0' THEN
dbv := 102;
ELSIF vers = '11.1.0' THEN
dbv := 111;
ELSIF vers = '11.2.0' THEN
dbv := 112;
ELSE
EXECUTE IMMEDIATE 'BEGIN
RAISE_APPLICATION_ERROR (-20000,
''Version '' || db_version ||
'' not supported for upgrade to release 11.2.0''); END;';
END IF;
-- populate sys.props$ with Day Light Saving Time (DST) props
-- Only needed for releases before 11.2
IF dbv IN (920, 101, 102, 111) AND NOT db_readonly THEN
-- Only needed for releases before 11.2.
-- Populate sys.props$ with Day Light Saving Time (DST) props
-- only if the database time zone file versions match.
BEGIN
-- remove all DST entries that we will then populate
EXECUTE IMMEDIATE '
DELETE sys.props$ WHERE name IN (''DST_UPGRADE_STATE'',
''DST_PRIMARY_TT_VERSION'',
''DST_SECONDARY_TT_VERSION'')';
EXECUTE IMMEDIATE 'INSERT INTO sys.props$ (name, value$, comment$)
VALUES (''DST_UPGRADE_STATE'', ''NONE'',
''State of Day Light Saving Time Upgrade'')';
EXECUTE IMMEDIATE 'INSERT INTO sys.props$ (name, value$, comment$)
VALUES (''DST_PRIMARY_TT_VERSION'', TO_CHAR( :1, ''FM999''),
''Version of primary timezone data file'')'
USING db_tz_version;
EXECUTE IMMEDIATE 'INSERT INTO sys.props$ (name, value$, comment$)
VALUES (''DST_SECONDARY_TT_VERSION'', ''0'',
''Version of secondary timezone data file'')';
COMMIT;
END;
END IF;
-- *****************************************************************
-- START of Constant Data
-- *****************************************************************
-- *****************************************************************
-- Constant Initialization Parameter Data
-- *****************************************************************
/*
To identify new obsolete and deprecated parameters, use the
following queries and diff with the list from the prior release:
select name from v$obsolete_parameter order by name;
select name from v$parameter
where isdeprecated = 'TRUE' order by name;
*/
-- Load Obsolete and Deprecated parameters
-- Obsolete initialization parameters in release 8.0 --
idx:=0;
store_removed(idx,'checkpoint_process', '8.0', FALSE);
store_removed(idx,'fast_cache_flush', '8.0', FALSE);
store_removed(idx,'gc_db_locks', '8.0', FALSE);
store_removed(idx,'gc_freelist_groups', '8.0', FALSE);
store_removed(idx,'gc_rollback_segments', '8.0', FALSE);
store_removed(idx,'gc_save_rollback_locks', '8.0', FALSE);
store_removed(idx,'gc_segments', '8.0', FALSE);
store_removed(idx,'gc_tablespaces', '8.0', FALSE);
store_removed(idx,'io_timeout', '8.0', FALSE);
store_removed(idx,'init_sql_files', '8.0', FALSE);
store_removed(idx,'ipq_address', '8.0', FALSE);
store_removed(idx,'ipq_net', '8.0', FALSE);
store_removed(idx,'lm_domains', '8.0', FALSE);
store_removed(idx,'lm_non_fault_tolerant', '8.0', FALSE);
store_removed(idx,'mls_label_format', '8.0', FALSE);
store_removed(idx,'optimizer_parallel_pass', '8.0', FALSE);
store_removed(idx,'parallel_default_max_scans', '8.0', FALSE);
store_removed(idx,'parallel_default_scan_size', '8.0', FALSE);
store_removed(idx,'post_wait_device', '8.0', FALSE);
store_removed(idx,'sequence_cache_hash_buckets', '8.0', FALSE);
store_removed(idx,'unlimited_rollback_segments', '8.0', FALSE);
store_removed(idx,'use_readv', '8.0', FALSE);
store_removed(idx,'use_sigio', '8.0', FALSE);
store_removed(idx,'v733_plans_enabled', '8.0', FALSE);
-- Obsolete in 8.1
store_removed(idx,'allow_partial_sn_results', '8.1', FALSE);
store_removed(idx,'arch_io_slaves', '8.1', FALSE);
store_removed(idx,'b_tree_bitmap_plans', '8.1', FALSE);
store_removed(idx,'backup_disk_io_slaves', '8.1', FALSE);
store_removed(idx,'cache_size_threshold', '8.1', FALSE);
store_removed(idx,'cleanup_rollback_entries', '8.1', FALSE);
store_removed(idx,'close_cached_open_cursors', '8.1', FALSE);
store_removed(idx,'complex_view_merging', '8.1', FALSE);
store_removed(idx,'db_block_checkpoint_batch', '8.1', FALSE);
store_removed(idx,'db_block_lru_extended_statistics', '8.1', FALSE);
store_removed(idx,'db_block_lru_statistics', '8.1', FALSE);
store_removed(idx,'db_file_simultaneous_writes', '8.1', FALSE);
store_removed(idx,'delayed_logging_block_cleanouts', '8.1', FALSE);
store_removed(idx,'discrete_transactions_enabled', '8.1', FALSE);
store_removed(idx,'distributed_recovery_connection_hold_time', '8.1', FALSE);
store_removed(idx,'ent_domain_name', '8.1', FALSE);
store_removed(idx,'fast_full_scan_enabled', '8.1', FALSE);
store_removed(idx,'freeze_DB_for_fast_instance_recovery', '8.1', FALSE);
store_removed(idx,'gc_latches', '8.1', FALSE);
store_removed(idx,'gc_lck_procs', '8.1', FALSE);
store_removed(idx,'job_queue_keep_connections', '8.1', FALSE);
store_removed(idx,'large_pool_min_alloc', '8.1', FALSE);
store_removed(idx,'lgwr_io_slaves', '8.1', FALSE);
store_removed(idx,'lm_locks', '8.1', FALSE);
store_removed(idx,'lm_procs', '8.1', FALSE);
store_removed(idx,'lm_ress', '8.1', FALSE);
store_removed(idx,'lock_sga_areas', '8.1', FALSE);
store_removed(idx,'log_archive_buffer_size', '8.1', FALSE);
store_removed(idx,'log_archive_buffers', '8.1', FALSE);
store_removed(idx,'log_block_checksum', '8.1', FALSE);
store_removed(idx,'log_files', '8.1', FALSE);
store_removed(idx,'log_simultaneous_copies', '8.1', FALSE);
store_removed(idx,'log_small_entry_max_size', '8.1', FALSE);
-----
--
store_removed(idx,'mts_servers');
store_removed(idx,'mts_service', '10.1', FALSE);
-- store_removed(idx,'mts_sessions');
store_removed(idx,'optimizer_max_permutations', '10.1', FALSE);
store_removed(idx,'oracle_trace_collection_name', '10.1', FALSE);
store_removed(idx,'oracle_trace_collection_path', '10.1', FALSE);
store_removed(idx,'oracle_trace_collection_size', '10.1', FALSE);
store_removed(idx,'oracle_trace_enable', '10.1', FALSE);
store_removed(idx,'oracle_trace_facility_name', '10.1', FALSE);
store_removed(idx,'oracle_trace_facility_path', '10.1', FALSE);
store_removed(idx,'partition_view_enabled', '10.1', FALSE);
store_removed(idx,'plsql_native_c_compiler', '10.1', FALSE);
store_removed(idx,'plsql_native_linker', '10.1', FALSE);
store_removed(idx,'plsql_native_make_file_name', '10.1', FALSE);
store_removed(idx,'plsql_native_make_utility', '10.1', FALSE);
store_removed(idx,'row_locking', '10.1', FALSE);
store_removed(idx,'serializable', '10.1', FALSE);
store_removed(idx,'transaction_auditing', '10.1', FALSE);
store_removed(idx,'undo_suppress_errors', '10.1', FALSE);
-- Deprecated in 10.1, no new value
store_removed(idx,'global_context_pool_size', '10.1', TRUE);
store_removed(idx,'log_archive_start', '10.1', TRUE);
store_removed(idx,'max_enabled_roles', '10.1', TRUE);
store_removed(idx,'parallel_automatic_tuning', '10.1', TRUE);
store_removed(idx,'_average_dirties_half_life', '10.1', TRUE);
store_removed(idx,'_compatible_no_recovery', '10.1', TRUE);
store_removed(idx,'_db_no_mount_lock', '10.1', TRUE);
store_removed(idx,'_lm_direct_sends', '10.1', TRUE);
store_removed(idx,'_lm_multiple_receivers', '10.1', TRUE);
store_removed(idx,'_lm_statistics', '10.1', TRUE);
store_removed(idx,'_oracle_trace_events', '10.1', TRUE);
store_removed(idx,'_oracle_trace_facility_version', '10.1', TRUE);
store_removed(idx,'_seq_process_cache_const', '10.1', TRUE);
-- Obsolete in 10.2
store_removed(idx,'enqueue_resources', '10.2', FALSE);
-- Deprecated, but not renamed in 10.2
store_removed(idx,'logmnr_max_persistent_sessions', '10.2', TRUE);
store_removed(idx,'max_commit_propagation_delay', '10.2', TRUE);
store_removed(idx,'remote_archive_enable', '10.2', TRUE);
store_removed(idx,'serial_reuse', '10.2', TRUE);
store_removed(idx,'sql_trace', '10.2', TRUE);
-- Deprecated, but not renamed in 11.1
store_removed(idx,'commit_write', '11.1', TRUE);
store_removed(idx,'cursor_space_for_time', '11.1', TRUE);
store_removed(idx,'instance_groups', '11.1', TRUE);
store_removed(idx,'log_archive_local_first', '11.1', TRUE);
store_removed(idx,'remote_os_authent', '11.1', TRUE);
store_removed(idx,'sql_version', '11.1', TRUE);
store_removed(idx,'standby_archive_dest', '11.1', TRUE);
store_removed(idx,'plsql_v2_compatibility', '11.1', TRUE);
-- Instead a new parameter diagnostic_dest will replace two (core_dump_dest l
ives)
store_removed(idx,'background_dump_dest', '11.1', TRUE);
store_removed(idx,'user_dump_dest', '11.1', TRUE);
-- Obsolete in 11.1
store_removed(idx,'_log_archive_buffer_size', '11.1', FALSE);
store_removed(idx,'_fast_start_instance_recover_target', '11.1', FALSE);
store_removed(idx,'_lm_rcv_buffer_size', '11.1', FALSE);
store_removed(idx,'ddl_wait_for_locks', '11.1', FALSE);
store_removed(idx,'remote_archive_enable', '11.1', FALSE);
-- Deprecated in 11.2
store_removed(idx,'active_instance_count', '11.2', TRUE);
store_removed(idx,'cursor_space_for_time', '11.2', TRUE);
store_removed(idx,'fast_start_io_target', '11.2', TRUE);
store_removed(idx,'global_context_pool_size', '11.2', TRUE);
store_removed(idx,'instance_groups', '11.2', TRUE);
store_removed(idx,'lock_name_space', '11.2', TRUE);
store_removed(idx,'log_archive_local_first', '11.2', TRUE);
store_removed(idx,'max_commit_propagation_delay', '11.2', TRUE);
store_removed(idx,'parallel_automatic_tuning', '11.2', TRUE);
store_removed(idx,'parallel_io_cap_enabled', '11.2', TRUE);
store_removed(idx,'resource_manager_cpu_allocation', '11.2', TRUE);
store_removed(idx,'serial_reuse', '11.2', TRUE);
-- Obsolete in 11.2
store_removed(idx,'drs_start', '11.2', FALSE);
store_removed(idx,'gc_files_to_locks', '11.2', FALSE);
store_removed(idx,'plsql_native_library_dir', '11.2', FALSE);
store_removed(idx,'plsql_native_library_subdir_count', '11.2', FALSE);
store_removed(idx,'sql_version', '11.2', FALSE);
store_removed(idx,'cell_partition_large_extents', '11.2', FALSE);
-- Sessions removed for XE upgrade only
IF xe_upgrade THEN
store_removed(idx,'sessions', '10.1', FALSE);
END IF;
max_op := idx;
-- Load Renamed parameters
-- Initialization Parameters Renamed in Release 8.0 -idx:=0;
store_renamed(idx,'async_read','disk_asynch_io');
store_renamed(idx,'async_write','disk_asynch_io');
store_renamed(idx,'ccf_io_size','db_file_direct_io_count');
store_renamed(idx,'db_file_standby_name_convert','db_file_name_convert');
store_renamed(idx,'db_writers','dbwr_io_slaves');
store_renamed(idx,'log_file_standby_name_convert',
'log_file_name_convert');
store_renamed(idx,'snapshot_refresh_interval','job_queue_interval');
-- Initialization Parameters Renamed in Release 8.1.4 -store_renamed(idx,'mview_rewrite_enabled','query_rewrite_enabled');
store_renamed(idx,'rewrite_integrity','query_rewrite_integrity');
-- Initialization Parameters Renamed in Release 8.1.5 -store_renamed(idx,'nls_union_currency','nls_dual_currency');
store_renamed(idx,'parallel_transaction_recovery',
'fast_start_parallel_rollback');
-- Initialization Parameters Renamed in Release 9.0.1 --
store_renamed(idx,'fast_start_io_target','fast_start_mttr_target');
store_renamed(idx,'mts_circuits','circuits');
store_renamed(idx,'mts_dispatchers','dispatchers');
store_renamed(idx,'mts_max_dispatchers','max_dispatchers');
store_renamed(idx,'mts_max_servers','max_shared_servers');
store_renamed(idx,'mts_servers','shared_servers');
store_renamed(idx,'mts_sessions','shared_server_sessions');
store_renamed(idx,'parallel_server','cluster_database');
store_renamed(idx,'parallel_server_instances',
'cluster_database_instances');
-- Initialization Parameters Renamed in Release 9.2 -store_renamed(idx,'drs_start','dg_broker_start');
-- Initialization Parameters Renamed in Release 10.1 -store_renamed(idx,'lock_name_space','db_unique_name');
-- Initialization Parameters Renamed in Release 10.2 --- none as of 4/1/05
-- Initialization Parameters Renamed in Release 11.2 -store_renamed(idx,'buffer_pool_keep', 'db_keep_cache_size');
store_renamed(idx,'buffer_pool_recycle', 'db_recycle_cache_size');
store_renamed(idx,'commit_write', 'commit_logging,commit_wait');
max_rp := idx;
-- Initialize special initialization parameters
idx := 0;
store_special(idx,'rdbms_server_dn',NULL,'ldap_directory_access','SSL');
store_special(idx,'plsql_compiler_flags','INTERPRETED',
'plsql_code_type','INTERPRETED');
store_special(idx,'plsql_compiler_flags','NATIVE',
'plsql_code_type','NATIVE');
store_special(idx,'plsql_debug','TRUE','plsql_optimize_level','1');
store_special(idx,'plsql_compiler_flags','DEBUG',
'plsql_optimize_level','1');
-- Only use these special parameters for databases
-- in which Very Large Memory is not enabled
IF db_vlm = 'FALSE' THEN
store_special(idx,'db_block_buffers',NULL,
'db_cache_size',NULL);
store_special(idx,'buffer_pool_recycle',NULL,
'db_recycle_cache_size',NULL);
store_special(idx,'buffer_pool_keep',NULL,
'db_keep_cache_size',NULL);
END IF;
max_sp := idx;
-- Initialization parameters with required values if missing
--- The array is processed below (search for 'process required data')
-- The value passed to store_required is used as the
-- value that should be set
-idx := 0;
64*1024*1024); -- 64 MB
END IF;
IF i = 2 THEN -- sets values for 64-bit db
-- use larger pool sizes for 64-bit systems
IF memory_target THEN
store_minval_dbbit(64,idx,'memory_target', 844*1024*1024); -- 844 MB
END IF;
mt_idx := idx;
-- sga_target = cs + jv + sp + lp + strp + extra :
-- (12*4 + 100 + 280 + (12*2*2)*.5 + 0 + 8*2+32*2+28+20+16) -- 596M
-- (32*4 + 100 + 280 + (32*2*2)*.5 + 0 + 8*2+32*2+28+20+16) -- 716M
48*1024*1024); -- 48 MB
store_minval_dbbit(0,idx,'pga_aggregate_target', 24*1024*1024); -- 24 MB
pg_idx := idx;
-- Added large_pool_size and streams_pool_size so that we can include these
-- user-specified values (if set) for sga_target minimum caculation.
-- Note that we're not making minimum recommendations for these 2 pools at
-- at this time.
store_minval_dbbit(0,idx,'large_pool_size', 0);
lp_idx := idx;
store_minval_dbbit(0,idx,'streams_pool_size', 0);
str_idx := idx;
-- For XML output only for DBUA with EM config
-- Minimum number of processes should be 150
IF display_xml THEN
store_minval_dbbit(0, idx,'processes', 150);
END IF;
max_minvp := idx;
-- *****************************************************************
-- Store Constant Component Data
-- *****************************************************************
-- Clear all variable component data
FOR i IN 1..max_comps LOOP
cmp_info(i).sys_kbytes := 2*c_kb; -- initialize with default of 2M
-- instead of 0
cmp_info(i).sysaux_kbytes := 2*c_kb; -- initialize with 2M instead of 0
cmp_info(i).def_ts_kbytes:= 0;
cmp_info(i).ins_sys_kbytes:= 0;
cmp_info(i).ins_def_kbytes:= 0;
cmp_info(i).def_ts
:= NULL;
cmp_info(i).processed := FALSE;
cmp_info(i).install
:= FALSE;
END LOOP;
-- Load component id and name
cmp_info(catalog).cid := 'CATALOG';
cmp_info(catalog).cname := 'Oracle Catalog Views';
cmp_info(catproc).cid := 'CATPROC';
cmp_info(rul).script
cmp_info(owm).script
cmp_info(ordim).script
cmp_info(sdo).script
cmp_info(context).script
cmp_info(mgw).script
cmp_info(amd).script
cmp_info(aps).script
cmp_info(xoq).script
cmp_info(em).script
cmp_info(apex).script
cmp_info(dv).script
ELSE
cmp_info(catalog).script
cmp_info(catproc).script
cmp_info(javavm).script
cmp_info(xml).script
cmp_info(xdb).script
cmp_info(rac).script
cmp_info(ols).script
cmp_info(exf).script
cmp_info(rul).script
cmp_info(owm).script
cmp_info(odm).script
cmp_info(ordim).script
cmp_info(sdo).script
cmp_info(context).script
cmp_info(wk).script
cmp_info(mgw).script
cmp_info(amd).script
cmp_info(aps).script
cmp_info(xoq).script
cmp_info(em).script
cmp_info(apex).script
cmp_info(dv).script
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
'?/rdbms/admin/rulpatch.sql';
'?/rdbms/admin/owmpatch.sql';
'?/ord/im/admin/impatch.sql';
'?/md/admin/sdopatch.sql';
'?/ctx/admin/ctxpatch.sql';
'?/mgw/admin/mgwpatch.sql';
'?/olap/admin/amdpatch.sql';
'?/olap/admin/apspatch.sql';
'?/olap/admin/xoqpatch.sql';
'?/sysman/admin/emdrep/sql/empatch.sql';
'?/apex/apxpatch.sql';
'?/rdbms/admin/dvpatch.sql';
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
'?/rdbms/admin/catalog.sql';
'?/rdbms/admin/catproc.sql';
'?/javavm/install/jvmdbmig.sql';
'?/xdk/admin/xmldbmig.sql';
'?/rdbms/admin/xdbdbmig.sql';
'?/rdbms/admin/catclust.sql';
'?/rdbms/admin/olsdbmig.sql';
'?/rdbms/admin/exfdbmig.sql';
'?/rdbms/admin/ruldbmig.sql';
'?/rdbms/admin/owmdbmig.sql';
'?/rdbms/admin/odmdbmig.sql';
'?/ord/im/admin/imdbmig.sql';
'?/md/admin/sdodbmig.sql';
'?/ctx/admin/ctxdbmig.sql';
'?/rdbms/admin/wkremov.sql';
'?/mgw/admin/mgwdbmig.sql';
'?/olap/admin/amddbmig.sql';
'?/olap/admin/apsdbmig.sql';
'?/olap/admin/xoqdbmig.sql';
'?/sysman/admin/emdrep/sql/empatch.sql';
'?/apex/apxdbmig.sql';
'?/rdbms/admin/dvdbmig.sql';
END IF;
-- *****************************************************************
-- Store Release Dependent Data
-- *****************************************************************
-----
------
XDB itself seems to take about 10M increase in its sysaux/xdb tablespace
to upgrade.
Since many components use XDB, lets default space needed for xdb
to be 85M. And if APEX is in the db, then add 30M to xdb space.
cmp_info(xdb).def_ts_kbytes:=
85*c_kb; -- XDB
106*c_kb * 1.1;
(11+20)*c_kb * 1.1; -- catproc+catupend
100*c_kb * 1.1;
3*c_kb * 1.1;
3*c_kb * 1.1;
4*c_kb * 1.1;
10*c_kb * 1.1;
44*c_kb * 1.1;
17*c_kb * 1.1; -- saw 10M
81*c_kb * 1.1;
62*c_kb * 1.1;
0;
noise
106*c_kb * 1.1;
(2+20)*c_kb * 1.1; -- catproc+catupend
51*c_kb * 1.1;
10*c_kb * 1.1;
6*c_kb * 1.1;
16*c_kb * 1.1;
81*c_kb * 1.1;
3*c_kb * 1.1;
62*c_kb * 1.1;
0;
96*c_kb * 1.1;
2*c_kb; -- CTXSYS , default
2*c_kb; -- EXFSYS , default
265*c_kb; -- FLOWS_
11*c_kb * 1.1; -- ORDSYS
42*c_kb * 1.1; -- MDSYS
73*c_kb * 1.1; -- SYSMAN
2*c_kb; -- WMSYS
cmp_info(xdb).def_ts_kbytes:=
85*c_kb; -- XDB
cmp_info(ols).def_ts_kbytes:=
2*c_kb; -- LBACSYS , default
cmp_info(dv).def_ts_kbytes:=
2*c_kb; -- DVSYS , default
cmp_info(aps).def_ts_kbytes :=
6*c_kb * 1.1;
cmp_info(wk).def_ts_kbytes:=
0;
-- WK removed => 0 increase
cmp_info(javavm).def_ts_kbytes:=
4*c_kb * 1.1;
ELSIF dbv = 111 THEN
-- mult by 1.1 or 1.2 for experimental noise
cmp_info(catalog).sys_kbytes:= 11*c_kb * 1.1;
cmp_info(catproc).sys_kbytes:= (35+20)*c_kb * 1.1; -- catproc+catupend
cmp_info(javavm).sys_kbytes:=
9*c_kb * 1.1;
cmp_info(context).sys_kbytes:= 3*c_kb * 1.1;
cmp_info(xdb).sys_kbytes:=
2*c_kb * 1.1;
cmp_info(ordim).sys_kbytes:=
50*c_kb * 1.1;
cmp_info(sdo).sys_kbytes:=
5*c_kb * 1.1;
cmp_info(apex).sys_kbytes:=
30*c_kb * 1.1;
cmp_info(em).sys_kbytes:=
12*c_kb * 1.1;
cmp_info(wk).sys_kbytes:=
0;
cmp_info(catalog).sysaux_kbytes:=
cmp_info(catproc).sysaux_kbytes:=
cmp_info(aps).sysaux_kbytes:=
7*c_kb * 1.1;
10*c_kb * 1.1;
5*c_kb * 1.1;
2*c_kb; -- default
2*c_kb; -- default
cmp_info(catproc).def_ts_kbytes:= 2*c_kb;
cmp_info(em).def_ts_kbytes:=
4*c_kb *
cmp_info(ordim).def_ts_kbytes:=
4*c_kb
cmp_info(wk).def_ts_kbytes:=
0;
END IF;
-- misc: round up to 100M fudge for stats
-- CML: TS: estimate for utlrp later?
-- default
1.1; -- SYSMAN
* 1.1;
-- WK removed => 0 increase
cmp_info(stats).sys_kbytes:=
-- misc: round up to 25M fudge
cmp_info(stats).sysaux_kbytes:=
100*c_kb;
25*c_kb;
-- *****************************************************************
-- END of Constant Data
-- *****************************************************************
-- *****************************************************************
-- START of Collect Section
-- *****************************************************************
-- *****************************************************************
-- Collect Variable Component Information
-- *****************************************************************
BEGIN -- Get components
IF dbv = 920 THEN -- No namespace
OPEN reg_cursor FOR
'SELECT cid, status, version, schema#
FROM sys.registry$';
ELSE
OPEN reg_cursor FOR
'SELECT cid, status, version, schema#
FROM sys.registry$ WHERE namespace =''SERVER''';
END IF;
LOOP
FETCH reg_cursor INTO p_cid, n_status, p_version, n_schema;
EXIT WHEN reg_cursor%NOTFOUND;
IF n_status NOT IN (99,8) THEN -- not REMOVED or REMOVING
EXECUTE IMMEDIATE 'SELECT name FROM sys.user$
WHERE user#=:1'
INTO p_schema
USING n_schema;
FOR i IN 1..max_components LOOP
IF p_cid = cmp_info(i).cid THEN
store_comp(i, p_schema, p_version, n_status);
EXIT; -- from component search loop
END IF;
END LOOP; -- ignore if not in component list
END IF;
END LOOP;
CLOSE reg_cursor;
-- Ultra Search not in 10.1.0.2 registry so check schema
IF NOT cmp_info(wk).processed THEN
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.user$ WHERE name = ''WKSYS'''
INTO p_null;
store_comp(wk, 'WKSYS', db_version, NULL);
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
END IF;
-- Check for HTML DB in 9.2.0 and 10.1 databases
BEGIN
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM v$parameter WHERE name =
LOWER(:1) AND isdefault = ''FALSE'''
INTO p_null
USING op(i).name;
op(i).db_match := TRUE;
EXCEPTION WHEN NO_DATA_FOUND THEN
op(i).db_match := FALSE;
END;
END LOOP;
-- Find special parameters in use
FOR i IN 1..max_sp LOOP
BEGIN
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name =
LOWER(:1) AND isdefault = ''FALSE'''
INTO p_value
USING sp(i).oldname;
IF sp(i).oldvalue IS NULL OR
p_value = sp(i).oldvalue THEN
sp(i).db_match := TRUE;
-- calculate new values for cache size params (buffers x blocksize)
IF sp(i).oldname = 'db_block_buffers' THEN
sp(i).newvalue := TO_CHAR(TO_NUMBER(p_value) * db_block_size);
ELSIF sp(i).oldname = 'buffer_pool_recycle' OR
sp(i).oldname = 'buffer_pool_keep' THEN
IF INSTR(UPPER(p_value),'BUFFERS:') > 0 THEN -- has keyword
IF INSTR(SUBSTR(p_value,INSTR(UPPER(p_value),
'BUFFERS:')+8),',') > 0 THEN
-- has second keyword after BUFFERS
sp(i).newvalue := TO_CHAR(TO_NUMBER(SUBSTR(p_value,
INSTR(UPPER(p_value),'BUFFERS:')+8,
INSTR(p_value,',')-INSTR(UPPER(p_value),'BUFFERS:')-8))
* db_block_size);
ELSE -- no second keyword
sp(i).newvalue := TO_CHAR(TO_NUMBER(SUBSTR(p_value,
INSTR(UPPER(p_value),'BUFFERS:')+8)) * db_block_size);
END IF; -- second keyword
ELSIF INSTR(UPPER(p_value),',') > 0 THEN -- has keyword format
#,#
--- In the #,# Format the first number before the comma is
-- buffers second number is the lru latches. For the calculati
on
-- we parse out the the buffer number and multiply
-- by db_block_size.
-tmp_num2
:= INSTR(UPPER(p_value),',');
sp(i).newvalue := TRIM(SUBSTR(p_value, 1, tmp_num2-1));
sp(i).newvalue := TO_CHAR(TO_NUMBER(sp(i).newvalue)
* db_block_size);
ELSE -- no keywords, just number
sp(i).newvalue := TO_CHAR(TO_NUMBER(p_value) * db_block_size);
END IF; -- keywords
END IF; -- params with calculated values
ELSE
-- plsql_compiler_flags may contain two values
-- in this case we process the list of values
IF (sp(i).oldname = 'plsql_compiler_flags') AND
LOOP
FETCH tmp_cursor INTO p_tsname, tmp_varchar1, tmp_varchar2;
EXIT WHEN tmp_cursor%NOTFOUND;
IF p_tsname IN ('SYSTEM', 'SYSAUX', db_undo_tbs) OR
is_comp_tablespace(p_tsname) OR
ts_has_queues (p_tsname) OR
ts_is_SYS_temporary (p_tsname) THEN
idx:=idx+1;
ts_info(idx).name :=p_tsname;
IF tmp_varchar1 = 'TEMPORARY' THEN
ts_info(idx).temporary := TRUE;
ELSE
ts_info(idx).temporary := FALSE;
END IF;
IF tmp_varchar2 = 'LOCAL' THEN
ts_info(idx).localmanaged := TRUE;
ELSE
ts_info(idx).localmanaged := FALSE;
END IF;
-- Get number of kbytes used
IF (dbv=920) THEN
-- Need to use sys_dba_segs for 920 because of possible overflow
EXECUTE IMMEDIATE
'SELECT SUM(bytes) FROM sys.sys_dba_segs seg WHERE seg.tablespace_na
me = :1'
INTO sum_bytes
USING p_tsname;
ELSE
EXECUTE IMMEDIATE
'SELECT SUM(bytes) FROM sys.dba_segments seg WHERE seg.tablespace_na
me = :1'
INTO sum_bytes
USING p_tsname;
END IF;
IF sum_bytes IS NULL THEN
ts_info(idx).inuse:=0;
ELSIF sum_bytes <= 1024 THEN
ts_info(idx).inuse:=1;
ELSE
ts_info(idx).inuse :=ROUND(sum_bytes/1024);
END IF;
-- Get number of kbytes allocated
IF ts_info(idx).temporary AND
ts_info(idx).localmanaged THEN
EXECUTE IMMEDIATE
'SELECT SUM(bytes) FROM sys.dba_temp_files files WHERE ' ||
'files.tablespace_name = :1'
INTO sum_bytes
USING p_tsname;
ELSE
EXECUTE IMMEDIATE
'SELECT SUM(bytes) FROM sys.dba_data_files files WHERE ' ||
'files.tablespace_name = :1'
INTO sum_bytes
USING p_tsname;
END IF;
-- *****************************************************************
-- Collect Public Rollback Information
-- *****************************************************************
idx := 0;
IF db_undo != 'AUTO' THEN -- using rollback segments
OPEN tmp_cursor FOR
'SELECT segment_name, next_extent, max_extents, status FROM SYS.dba_ro
llback_segs
WHERE owner=''PUBLIC'' OR (owner=''SYS'' AND segment_name != ''SYS
TEM'')';
LOOP
FETCH tmp_cursor INTO tmp_varchar1, tmp_num1, tmp_num2, p_status;
EXIT WHEN tmp_cursor%NOTFOUND;
BEGIN
--- get sum of bytes and tablespace name
IF (dbv=920) THEN
-- Need to use sys_dba_segs for 920 because of possible overflow
EXECUTE IMMEDIATE
'SELECT tablespace_name, sum(bytes) FROM sys.sys_dba_segs
LOOP
FETCH tmp_cursor INTO tmp_varchar1, tmp_num1, p_status, tmp_num3;
EXIT WHEN tmp_cursor%NOTFOUND;
idx := idx + 1;
lf_info(idx).file_spec := tmp_varchar1;
lf_info(idx).grp
:= tmp_num3;
lf_info(idx).bytes
:= tmp_num1;
lf_info(idx).status
:= p_status;
END LOOP;
CLOSE tmp_cursor;
max_lf := idx;
-- *****************************************************************
-- Collect Flashback Information
-- *****************************************************************
flashback_info.active := FALSE;
flashback_info.name := '';
flashback_info.limit := 0;
flashback_info.used := 0;
flashback_info.reclaimable := 0;
flashback_info.files := 0;
flashback_info.file_dest := '';
flashback_info.dsize := 0;
IF substr(db_version,1,2) <> '9.' THEN
--- Flashback exists in 10n and above
--- flashback_on can have several 'on' states but only
-- one off, so check for 'no'
-EXECUTE IMMEDIATE 'SELECT count(*) from v$database WHERE
flashback_on = ''NO'''
INTO p_count;
IF p_count <= 0 THEN
--- Get the rest of the flashback settings
-flashback_info.active := TRUE;
BEGIN
EXECUTE IMMEDIATE 'SELECT rfd.name, rfd.space_limit, rfd.space_used,
rfd.space_reclaimable, rfd.number_of_files,
vp1.value, vp2.value
FROM v$recovery_file_dest rfd, v$parameter vp1, v$parameter vp2
WHERE UPPER(vp1.name) = ''DB_RECOVERY_FILE_DEST'' AND
UPPER(vp2.name) = ''DB_RECOVERY_FILE_DEST_SIZE'''
INTO flashback_info.name, flashback_info.limit, flashback_info.used,
flashback_info.reclaimable, flashback_info.files,
flashback_info.file_dest, flashback_info.dsize;
EXCEPTION
WHEN NO_DATA_FOUND THEN
flashback_info.active := FALSE;
END;
END IF;
END IF;
-- *****************************************************************
-- Collect Misc Information for Warnings
-- *****************************************************************
-- Check for patch applied in DBs with registry
BEGIN
IF dbv IN (920,101) THEN -- starting in 10.2, can't happen
EXECUTE IMMEDIATE
'SELECT NULL FROM sys.registry$
WHERE cid = ''CATPROC'' AND version != :inst_version'
INTO p_null USING db_version;
version_mismatch := TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for RAC
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM v$parameter
WHERE name = ''cluster_database'' AND value = ''TRUE'''
INTO p_null;
cluster_dbs := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for pre-existing DIP user in pre-10.1 databases
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.user$ WHERE name=''DIP'''
INTO p_null;
IF dbv = 920 THEN
dip_user_exists:=TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for ORACLE_OCM user and no OCM packages
IF dbv != 112 THEN
BEGIN
EXECUTE IMMEDIATE 'SELECT user# FROM sys.user$ WHERE name=''ORACLE_OCM'''
INTO tmp_num1;
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM sys.obj$ WHERE owner# = :1 AND
name =''MGMT_DB_LL_METRICS'' AND type# = 9'
INTO p_null
USING tmp_num1;
EXCEPTION
WHEN NO_DATA_FOUND THEN ocm_user_exists := TRUE;
END;
EXCEPTION
WHEN NO_DATA_FOUND THEN ocm_user_exists := FALSE;
END;
END IF;
-- Check for APPQOSSYS user without WLM_METRICS_STREAM table
IF dbv != 112 THEN
BEGIN
owm_replication := TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
END IF;
-- Check for database links
BEGIN
IF dbv IN (920,101) THEN
EXECUTE IMMEDIATE
'SELECT NULL FROM sys.link$ WHERE (password IS NOT NULL OR
authpwd IS NOT NULL) AND rownum <=1'
INTO p_null;
dblinks := TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for CDC streams
BEGIN
IF dbv IN (920, 101) THEN
EXECUTE IMMEDIATE 'SELECT NULL
FROM sys.dba_capture cap, sys.dba_queues q, sys.dba_queue_tables qt
WHERE substr(cap.capture_name,4) = substr(q.name,4) AND
substr(q.name,4) = substr(qt.queue_table,4) AND
cap.queue_owner = q.owner AND
cap.queue_name = q.name AND
q.owner = qt.owner AND
q.queue_table = qt.queue_table AND
rownum <= 1'
INTO p_null;
cdc_data := TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- Check for CONNECT role
BEGIN
IF dbv IN (920,101) THEN
EXECUTE IMMEDIATE
'SELECT NULL FROM sys.dba_role_privs WHERE granted_role = ''CONNECT''
AND
grantee NOT IN (
''SYS'', ''OUTLN'', ''SYSTEM'', ''CTXSYS'', ''DBSNMP'',
''LOGSTDBY_ADMINISTRATOR'', ''ORDSYS'', ''ORDPLUGINS'',
''OEM_MONITOR'', ''WKSYS'', ''WKPROXY'', ''WK_TEST'',
''WKUSER'', ''MDSYS'', ''LBACSYS'', ''DMSYS'', ''WMSYS'',
''OLAPDBA'', ''OLAPSVR'', ''OLAP_USER'', ''OLAPSYS'', ''EXFSYS''
,
''SYSMAN'', ''MDDATA'', ''SI_INFORMTN_SCHEMA'',''XDB'', ''ODM'')
AND rownum <= 1';
connect_role := TRUE;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
DBA_DML_LOCKS'',
''V$FLASHBACK_DATABASE_LOGFILE'',''GV$HM_RECOMMEND
ATION'',
''V$SQL_SHARED_CURSOR'',''GV$PERSISTENT_QUEUES'','
'GV$FILE_HISTOGRAM'',
''DBA_WAITERS'',''GV$SUBSCR_REGISTRATION_STATS'',
''GV$SQLAREA_PLAN_HASH'',''GV$ARCHIVE_GAP'',
''V$STREAMS_APPLY_SERVER'',''DBA_DDL_LOCKS'',
''DBA_LOCK_INTERNAL'', ''V_$STREAMS_APPLY_SERVER''
,
''DBA_KGLLOCK'',''GV$LOGSTDBY_TRANSACTION'',
''GV_$DATAFILE'', ''GV_$STREAMS_APPLY_SERVER'',
''GV$STREAMS_APPLY_SERVER'', ''GV$DATAFILE'',
''GV_$LOGSTDBY_TRANSACTION'',
''GV$SYSTEM_EVENT'', ''V$SQL_MONITOR'',
''GV$WLM_PCMETRIC'',''V$WLM_PCMETRIC'',
''V$DB_OBJECT_CACHE'',''GV$LOGMNR_REGION'',
''GV$ASM_DISK_STAT'',''GV$WLM_PCMETRIC_HISTORY'',
''V$WLM_PCMETRIC_HISTORY'',''V$DNFS_CHANNELS'',
''V$HANG_INFO'',''GV$DNFS_STATS'',
''GV$SESSION_CONNECT_INFO'',''GV$SQL_MONITOR'',
''GV$ASM_OPERATION'',''V$DNFS_STATS'',
''GV$DB_OBJECT_CACHE'',''GV$ARCHIVE_PROCESSES'',
''GV$RESULT_CACHE_OBJECTS'',
''GV$ASM_DISK'',''
''V$ARCHIVE_PROCESSES'',
V$LOGMNR_REGION'',
''V$RESULT_CACHE_OBJECTS'', ''GV$ROWCACHE'',''V$ROWCACHE'',''GV$PROCESS_MEMORY_D
ETAIL'',''V$PROCESS_MEMORY_DETAIL'',''GV$DLM_MISC'',''V$DLM_MISC'',''V$DELETED_O
BJECT'',''GV$DELETED_OBJECT'',''GV$STREAMS_APPLY_COORDINATOR'',''V$STREAMS_APPLY
_COORDINATOR'')
AND referenced_type in (''VIEW'',''PACKAGE'
') OR
name = ''V_$ROLLNAME''
CONNECT BY
PRIOR name = referenced_name and
PRIOR type = referenced_type)'
INTO p_null;
END IF;
invalid_objs := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- create a table to store invalid objects (create it if necessary)
IF NOT db_readonly THEN
tbl_exists := 0;
EXECUTE IMMEDIATE
'SELECT count(*) FROM dba_tables
WHERE table_name = upper(''registry$sys_inv_objs'')'
into tbl_exists;
IF tbl_exists != 0 -- if registry$sys_inv_objs table exists
THEN
-- Truncate table first
EXECUTE IMMEDIATE 'TRUNCATE TABLE registry$sys_inv_objs';
-- Insert into table next
EXECUTE IMMEDIATE
'INSERT INTO registry$sys_inv_objs
SELECT owner,object_name,object_type
FROM sys.dba_objects
WHERE status !=''VALID'' AND owner in (''SYS'',''SYSTEM'')
ORDER BY owner';
ELSE -- if table does not exist
-- Create invalid objects table and populate with all SYS and SYSTEM
-- invalid objects
EXECUTE IMMEDIATE
'CREATE TABLE registry$sys_inv_objs
AS
SELECT owner,object_name,object_type
FROM sys.dba_objects
WHERE status !=''VALID'' AND owner in (''SYS'',''SYSTEM'')
ORDER BY owner';
END IF; -- IF/ELSE registry$sys_inv_objs exists
-- If there are less than 5000 non-sys invalid objects then create
-- another table with non-SYS/SYSTEM owned objects.
-- If there are more than 5000 total then that is too many
-- for utluiobj.sql to handle so output a message.
EXECUTE IMMEDIATE 'SELECT count(*) FROM sys.dba_objects
WHERE status !=''VALID'' AND owner NOT in (''SYS'',''SYSTEM'')'
INTO nonsys_invalid_objs;
IF nonsys_invalid_objs > 5000 THEN
warning_5000 := TRUE;
ELSE
tbl_exists := 0;
EXECUTE IMMEDIATE
'SELECT count(*) FROM dba_tables
WHERE table_name = upper(''registry$nonsys_inv_objs'')'
into tbl_exists;
IF tbl_exists != 0 -- if registry$nonsys_inv_objs table exists
THEN
-- Truncate table first
EXECUTE IMMEDIATE 'TRUNCATE TABLE registry$nonsys_inv_objs';
-- Insert into table next
EXECUTE IMMEDIATE
'INSERT INTO registry$nonsys_inv_objs
SELECT owner,object_name,object_type
FROM sys.dba_objects
WHERE status !=''VALID'' AND owner NOT in (''SYS'',''SYSTEM'')
ORDER BY owner';
ELSE -- if table does not exist
-- Create invalid objects table and populate with non-SYS and
-- non-SYSTEM invalid objects
EXECUTE IMMEDIATE
'CREATE TABLE registry$nonsys_inv_objs
AS
SELECT owner,object_name,object_type
FROM sys.dba_objects
WHERE status !=''VALID'' AND owner NOT in (''SYS'',''SYSTEM'')
ORDER BY owner';
END IF; -- IF/ELSE registry$nonsys_inv_objs exists
END IF; -- IF/ELSE nonsys_invalid_objs > 5000
COMMIT;
END IF; -- db NOT readonly
-- Check for externally authenticated SSL users
BEGIN
mat'''
INTO laf_format_string, tmp_varchar1;
EXCEPTION WHEN OTHERS THEN NULL;
END;
IF (tmp_varchar1 = 'FALSE') AND
(instr (LOWER(laf_format_string), '%r') = 0) THEN
--- no %[r|R] and we are not defaulted by the system - we have to report som
ething...
-laf_format := TRUE;
END IF;
--- See if OrdImageIndex is being used
--- The upgrade will remove them, so the misc warning section will
-- let them know.
-BEGIN
EXECUTE IMMEDIATE
'SELECT COUNT(*) FROM sys.dba_indexes WHERE index_type = ''DOMAIN''
and ityp_name = ''ORDIMAGEINDEX'''
INTO p_count;
EXCEPTION
WHEN OTHERS THEN NULL;
END;
IF (p_count > 0) THEN
imageidx_used := TRUE;
END IF;
--- check for recycle bin usage
--- We report if its on, and also if its off and not empty.
-IF NOT (dbv=920) THEN
-- Recycle bin didn't exist in 9.2
IF (dbv=101) THEN
-- for 10.1 its _recyclebin and TRUE/FALSE
BEGIN
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name = ''_recycl
ebin'''
INTO p_value;
EXCEPTION WHEN NO_DATA_FOUND THEN p_value := '';
END;
IF UPPER(p_value) = 'TRUE' THEN
recyclebin_on := TRUE;
END IF;
ELSE
-- for 10.2 and above its recyclebin and on/off
BEGIN
EXECUTE IMMEDIATE 'SELECT value FROM v$parameter WHERE name = ''recycle
bin'''
INTO p_value;
EXCEPTION WHEN NO_DATA_FOUND THEN p_value := '';
END;
IF UPPER(p_value) = 'ON' THEN
recyclebin_on := TRUE;
END IF;
END IF;
-- Now get the number of objects in the recycle
-- bin (even if its off, used for reporting).
-- Optimizer will attempt to execute some statements
-- even inside of an 'if' and since recyclebin does not
-- exist in 9.2, play it safe and wrap it with execute immediate
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM sys.recyclebin$'
INTO recycle_objects;
END IF;
--- Check for pre-existing temporary table sys.enabled$indexes.
-- If it exists, then warn the user to DROP SYS.ENABLED$INDEXES.
-BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM sys.enabled$indexes'
INTO tbl_exists;
IF (tbl_exists >= 0) THEN
enabled_indexes_tbl := TRUE;
END IF;
EXCEPTION
WHEN NO_SUCH_TABLE THEN NULL;
END;
-- Check for schemas with objects dependent on DBMS_LDAP package
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM dba_dependencies
WHERE referenced_name IN (''DBMS_LDAP'')
AND owner NOT IN (''SYS'',''PUBLIC'',''ORD_PLUGINS'')
AND rownum <= 1'
INTO p_null;
dbms_ldap_dep := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-----------IF
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- local extent management
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM SYS.DBA_TABLESPACES
WHERE tablespace_name = ''SYSAUX'' AND
extent_management != ''LOCAL'''
INTO p_null;
sysaux_not_local := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
-- auto segment space management
BEGIN
EXECUTE IMMEDIATE 'SELECT NULL FROM SYS.DBA_TABLESPACES
WHERE tablespace_name = ''SYSAUX'' AND
segment_space_management != ''AUTO'''
INTO p_null;
sysaux_not_auto := TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
EXCEPTION -- No SYSAUX tablespace
WHEN NO_DATA_FOUND THEN NULL;
END;
END IF; -- dbv 920
-- Store away the default tablespaces for SYS and SYSTEM
EXECUTE IMMEDIATE 'SELECT default_tablespace FROM sys.dba_users WHERE usernam
e = ''SYS'''
INTO sys_ts_default;
EXECUTE IMMEDIATE 'SELECT default_tablespace FROM sys.dba_users WHERE usernam
e = ''SYSTEM'''
INTO system_ts_default;
-- Set flag if any _ params are in place. The recommendations section will o
utput
-- the command needed to view them.
-- Only output for interactive, dbua does their own thing.
BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM sys.v$parameter WHERE name LIKE ''\
_%'' ESCAPE ''\'''
INTO n_status;
IF (n_status >= 1) THEN
hidden_params_in_use := TRUE;
END IF;
EXCEPTION
WHEN OTHERS THEN NULL;
END;
-- Set flag if any non-default events are present. The recommendations secti
on will output
-- the commands needed to view them.
-- Only output for interactive, dbua does their own thing.
BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM sys.v$parameter2 WHERE UPPER(name)
= ''EVENT''
-- *****************************************************************
-- *****************************************************************
-- Calculate Tablespace Requirements
-- *****************************************************************
-- Look at all relevant tablespaces
-- TS: loop per tablespace (ts_info(t).name)
FOR t IN 1..max_ts LOOP
delta_kbytes:=0; -- initialize calculated tablespace delta
IF ts_info(t).name = 'SYSTEM' THEN -- sum the component SYS kbytes
FOR i IN 1..max_comps LOOP
IF collect_diag_2 THEN
IF cmp_info(i).processed = TRUE THEN
dbms_output.put_line('... ' || cmp_info(i).cid || ' Processed.
' || ' Default Tblspace ' || cmp_info(i).def_ts || '.');
ELSE
dbms_output.put_line('... ' || cmp_info(i).cid || ' NOT Proces
sed.');
END IF;
END IF;
IF cmp_info(i).processed THEN
IF cmp_info(i).install THEN -- if component will be installed
delta_kbytes := delta_kbytes + cmp_info(i).ins_sys_kbytes;
IF collect_diag THEN
display_line('DIAG-CMPTS: SYSTEM ' ||
LPAD(cmp_info(i).cid, 10) ||
LPAD(cmp_info(i).ins_sys_kbytes/1024,10) || 'Mb');
ELSIF collect_diag_2 THEN
display_line('DIAG-CMPTS: SYSTEM ' ||
LPAD(cmp_info(i).cid, 10) || ' ToBeInstalled ' ||
LPAD(cmp_info(i).ins_sys_kbytes/1024,10) || 'Mb');
END IF;
ELSE -- if component is already in the registry
delta_kbytes := delta_kbytes + cmp_info(i).sys_kbytes;
IF collect_diag THEN
display_line('DIAG-CMPTS: SYSTEM ' ||
LPAD(cmp_info(i).cid, 10) ||
LPAD(cmp_info(i).sys_kbytes/1024,10) || 'Mb');
ELSIF collect_diag_2 THEN
display_line('DIAG-CMPTS: SYSTEM ' ||
LPAD(cmp_info(i).cid, 10) || ' IsInRegistry ' ||
LPAD(cmp_info(i).sys_kbytes/1024,10) || 'Mb');
END IF;
END IF;
END IF; -- nothing to add if component is or will not be in
-- the registry
END LOOP;
END IF; -- end of special SYSTEM tablespace processing
-- TS: delta after looping through components in SYSTEM
IF ts_info(t).name = 'SYSAUX' THEN -- sum the component SYSAUX kbytes
FOR i IN 1..max_comps LOOP
IF cmp_info(i).processed AND
(cmp_info(i).def_ts = 'SYSAUX' OR
cmp_info(i).def_ts = 'SYSTEM') THEN
IF cmp_info(i).sysaux_kbytes >= cmp_info(i).def_ts_kbytes THEN
delta_kbytes := delta_kbytes + cmp_info(i).sysaux_kbytes;
IF collect_diag THEN
IF ts_is_SYS_temporary(ts_info(t).name) THEN
delta_kbytes := delta_kbytes + 50*1024; -- Add 50M for TEMP
END IF;
-- See if this is the UNDO tablespace - be sure at least 400M available
IF ts_info(t).name = db_undo_tbs THEN
ts_info(t).min := 400 * 1024;
IF ts_info(t).alloc < ts_info(t).min THEN
delta_kbytes := ts_info(t).min - ts_info(t).inuse;
ELSE
delta_kbytes := 0;
END IF;
END IF; -- end of if this is the undo tablespace
-- If DBUA output, then add in EM install if not in database
IF display_XML THEN
IF NOT cmp_info(em).processed THEN
IF ts_info(t).name = 'SYSTEM' THEN
delta_kbytes := delta_kbytes + cmp_info(em).ins_sys_kbytes;
ELSIF ts_info(t).name = 'SYSAUX' THEN
delta_kbytes := delta_kbytes + cmp_info(em).ins_def_kbytes;
END IF;
END IF;
END IF;
-- Put a 20% safety factor on DELTA and round it off
delta_kbytes := ROUND(delta_kbytes*1.20);
-- Finally, save DELTA value
ts_info(t).delta := delta_kbytes;
----IF
ts_info(t).avail := ROUND((ts_info(t).avail-512)/1024);
ts_info(t).inuse := ROUND((ts_info(t).inuse)/1024);
-- Determine amount of additional space needed
-- independent of autoextend on/off
IF ts_info(t).min > ts_info(t).alloc THEN
ts_info(t).addl := ts_info(t).min - ts_info(t).alloc;
ELSE
ts_info(t).addl := 0;
END IF;
-- Do we have enough space in the existing tablespace?
IF ts_info(t).min < ts_info(t).avail THEN
ts_info(t).inc_by := 0;
ELSE
-- need to add space
ts_info(t).inc_by := ts_info(t).min - ts_info(t).avail;
END IF;
----IF
-- *****************************************************************
-- Calculate SYSAUX Requirements for pre-10.1 databases
-- *****************************************************************
delta_sysaux := 0;
IF dbv = 920 THEN
-- sum the component SYSAUX usage for earlier releases
FOR i IN 1..max_comps LOOP
IF cmp_info(i).processed THEN -- add upgrade amount
-- TS: looks like if cmp_info(i).cid is installed, PROCESSED
-- is also TRUE. cmp_info(i).sysaux_kbytes is for upgrades.
delta_sysaux := delta_sysaux + cmp_info(i).sysaux_kbytes;
IF collect_diag THEN
display_line('DIAG-CMPTS: SYSAUX ' ||
LPAD(cmp_info(i).cid, 10) || ' ' ||
LPAD(cmp_info(i).sysaux_kbytes,10));
END IF;
END IF;
-- TS: set delta_sysaux as sum of ins_def_kbytes for sysaux
IF cmp_info(i).install AND
cmp_info(i).def_ts = 'SYSAUX' THEN -- add def_ts install amount als
o
delta_sysaux := delta_sysaux + cmp_info(i).ins_def_kbytes;
IF collect_diag THEN
display_line('DIAG-CMPTS: SYSAUX ' ||
LPAD(cmp_info(i).cid, 10) || ' ' ||
LPAD(cmp_info(i).ins_def_kbytes,10));
END IF;
END IF;
END LOOP;
-- Add a base of 62000 bytes to our calculation
delta_sysaux := delta_sysaux + 62000;
IF collect_diag THEN
display_line('DIAG-TS: SYSAUX' ||
' total req=' || LPAD(delta_sysaux,10));
END IF;
-- Put a 500MB (512000KB) floor on delta_sysaux
IF delta_sysaux < 512000 THEN
delta_sysaux := 512000;
END IF;
ELSE -- SYSAUX handled as existing tablespace
delta_sysaux := 0;
-- TS: delta_sysaux is for if sysaux does not exist; else
-ts_info(sysaux_tsinfo_idx).min
END IF;
delta_sysaux := ROUND(delta_sysaux/1024); -- convert to MB
-- *****************************************************************
-- END of Calculate Section
-- *****************************************************************
-- *****************************************************************
-- START of Display Section
-- *****************************************************************
IF display_xml THEN
display_header_and_db('value="' || vers || '"');
display_flashback;
display_parameters_xml;
display_components;
display_tablespaces;
display_misc_warnings;
-display_recommendations_xml called from display_misc_warnings
display_line('</RDBMSUP>');
ELSE
display_header_and_db('');
IF dbv = 920 THEN -- database not upgraded yet
display_logfiles;
END IF;
display_tablespaces;
display_rollback_segs;
display_flashback;
display_parameters_text;
display_components;
display_misc_warnings;
display_recommendations;
IF dbv = 920 THEN
display_sysaux;
END IF;
END IF;
-- *****************************************************************
-- END of Display Section
-- *****************************************************************
END;
/
SET SERVEROUTPUT OFF
-- *****************************************************************
-- END utlu112i.sql
-- *****************************************************************