I. 사전 조사
echo $ORACLE_HOME <19c ORACLE_HOME 경로>/jdk/bin/java -jar <19c ORACLE_HOME 경로>/rdbms/admin/preupgrade.jar TERMINAL TEXT
[oracle@orcl ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@orcl ~]$ $ORACLE_BASE/product/19c/db_1/jdk/bin/java -jar $ORACLE_BASE/product/19c/db_1/rdbms/admin/preupgrade.jar TERMINAL TEXT
Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2020-03-05T10:31:31
Upgrade-To version: 19.0.0.0.0
=======================================
Status of the database prior to upgrade
=======================================
Database Name: ORCL
Container Name: Not Applicable in Pre-12.1 database
Container ID: Not Applicable in Pre-12.1 database
Version: 11.2.0.4.0
DB Patch Level: No Patch Bundle applied
Compatible: 11.2.0.4.0
Blocksize: 8192
Platform: Linux x86 64-bit
Timezone File: 14
Database log mode: NOARCHIVELOG
Readonly: FALSE
Edition: EE
Oracle Component Upgrade Action Current Status
---------------- -------------- --------------
Oracle Server [to be upgraded] VALID
JServer JAVA Virtual Machine [to be upgraded] VALID
Oracle XDK for Java [to be upgraded] VALID
Oracle Workspace Manager [to be upgraded] VALID
OLAP Analytic Workspace [to be upgraded] VALID
Oracle Enterprise Manager Repository [to be upgraded] VALID
Oracle Text [to be upgraded] VALID
Oracle XML Database [to be upgraded] VALID
Oracle Java Packages [to be upgraded] VALID
Oracle Multimedia [to be upgraded] VALID
Oracle Spatial [to be upgraded] VALID
Expression Filter [to be upgraded] VALID
Rule Manager [to be upgraded] VALID
Oracle OLAP API [to be upgraded] VALID
==============
BEFORE UPGRADE
==============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
1. Update NUMERIC INITIALIZATION PARAMETERS to meet estimated minimums.
This action may be done now or when starting the database in upgrade mode
using the 19 ORACLE HOME.
Parameter Currently 19 minimum
--------- --------- ------------------
processes 150 300
The database upgrade process requires certain initialization parameters
to meet minimum values. The Oracle upgrade process itself has minimum
values which may be higher and are marked with an asterisk. After
upgrading, those asterisked parameter values may be reset if needed.
2. Remove the EM repository.
- Copy the $ORACLE_HOME/rdbms/admin/emremove.sql script from the target
19 ORACLE_HOME into the source 11.2.0.4.0 ORACLE_HOME.
Step 1: If database control is configured, stop EM Database Control,
using the following command
$> emctl stop dbconsole
Step 2: Connect to the database using the SYS account AS SYSDBA
SET ECHO ON;
SET SERVEROUTPUT ON;
@emremove.sql
Without the set echo and serveroutput commands, you will not be able to
follow the progress of the script.
The database has an Enterprise Manager Database Control repository.
Starting with Oracle Database 12c, the local Enterprise Manager Database
Control does not exist anymore. The repository will be removed from your
database during the upgrade. This step can be manually performed before
the upgrade to reduce downtime.
3. Remove OLAP Catalog by running the 11.2.0.4.0 SQL script
$ORACLE_HOME/olap/admin/catnoamd.sql script.
The OLAP Catalog component, AMD, exists in the database.
Starting with Oracle Database 12c, the OLAP Catalog (OLAP AMD) is
desupported and will be automatically marked as OPTION OFF during the
database upgrade if present. Oracle recommends removing OLAP Catalog
(OLAP AMD) before database upgrade. This step can be manually performed
before the upgrade to reduce downtime.
4. Upgrade Oracle Application Express (APEX) manually before the database
upgrade.
The database contains APEX version 3.2.1.00.12. Upgrade APEX to at least
version 18.2.0.00.12.
Starting with Oracle Database Release 18, APEX is not upgraded
automatically as part of the database upgrade. Refer to My Oracle Support
Note 1088970.1 for information about APEX installation and upgrades.
5. Please make sure that all the MVs are refreshed and sys.sumdelta$ becomes
empty before doing upgrade, unless you have strong business reasons not
to do so. You can use dbms_mview.refresh() to refresh the MVs except
those stale ones to be kept due to business need. If there are any stale
MVs depending on changes in sys.sumdelta$, do not truncate it, because
doing so will cause wrong results after refresh. Please refer to the
Materialized View section in MOS Note 2380601.1 for more details.
There are one or more materialized views in either stale or invalid
state, or which are currently being refreshed.
Oracle recommends that all materialized views (MV's) are refreshed before
upgrading the database because this will clear the MV logs and the
sumdelta$ table and may reduce the upgrade time. If you choose to not
refresh some MVs, the change data for those MV's will be carried through
the UPGRADE process. After UPGRADE, you can refresh the MV's and MV
incremental refresh should work in normal cases.
6. (AUTOFIXUP) Gather stale data dictionary statistics prior to database
upgrade in off-peak time using:
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
Dictionary statistics do not exist or are stale (not up-to-date).
Dictionary statistics help the Oracle optimizer find efficient SQL
execution plans and are essential for proper upgrade timing. Oracle
recommends gathering dictionary statistics in the last 24 hours before
database upgrade.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
7. (AUTOFIXUP) Directly grant ADMINISTER DATABASE TRIGGER privilege to the
owner of the trigger or drop and re-create the trigger with a user that
was granted directly with such. You can list those triggers using: SELECT
OWNER, TRIGGER_NAME FROM DBA_TRIGGERS WHERE
TRIM(BASE_OBJECT_TYPE)='DATABASE' AND OWNER NOT IN (SELECT GRANTEE FROM
DBA_SYS_PRIVS WHERE PRIVILEGE='ADMINISTER DATABASE TRIGGER').
There is one or more database triggers whose owner does not have the
right privilege on the database.
The creation of database triggers must be done by users granted with
ADMINISTER DATABASE TRIGGER privilege. Privilege must have been granted
directly.
8. (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.
None of the fixed object tables have had stats collected.
Gathering statistics on fixed objects, if none have been gathered yet, is
recommended prior to upgrading.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
INFORMATION ONLY
================
9. To help you keep track of your tablespace allocations, the following
AUTOEXTEND tablespaces are expected to successfully EXTEND during the
upgrade process.
Min Size
Tablespace Size For Upgrade
---------- ---------- -----------
SYSAUX 520 MB 762 MB
SYSTEM 750 MB 1180 MB
TEMP 29 MB 150 MB
UNDOTBS1 110 MB 446 MB
Minimum tablespace sizes for upgrade are estimates.
10. Run $ORACLE_HOME/rdbms/admin/catnoexf.sql located in the new Oracle
Database Oracle home to remove both EXF and RUL.
Expression Filter (EXF) or Rules Manager (RUL) exist in the database.
Starting with Oracle Database release 12.1, the Expression Filter (EXF)
and Database Rules Manager (RUL) features are desupported, and are
removed during the upgrade process. This step can be manually performed
before the upgrade to reduce downtime.
11. Check the Oracle Backup and Recovery User's Guide for information on how
to manage an RMAN recovery catalog schema.
If you are using a version of the recovery catalog schema that is older
than that required by the RMAN client version, then you must upgrade the
catalog schema.
It is good practice to have the catalog schema the same or higher version
than the RMAN client version you are using.
ORACLE GENERATED FIXUP SCRIPT
=============================
All of the issues in database ORCL
which are identified above as BEFORE UPGRADE "(AUTOFIXUP)" can be resolved by
executing the following
SQL>@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
=============
AFTER UPGRADE
=============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
12. (AUTOFIXUP) If you use the -T option for the database upgrade, then run
$ORACLE_HOME/rdbms/admin/utluptabdata.sql after the upgrade is complete,
to VALIDATE and UPGRADE any user tables affected by changes to
Oracle-Maintained types.
There are user tables dependent on Oracle-Maintained object types.
If the -T option is used to set user tablespaces to READ ONLY during the
upgrade, user tables in those tablespaces, that are dependent on
Oracle-Maintained types, will not be automatically upgraded. If a type is
evolved during the upgrade, any dependent tables need to be re-validated
and upgraded to the latest type version AFTER the database upgrade
completes.
13. Upgrade the database time zone file using the DBMS_DST package.
The database is using time zone file version 14 and the target 19 release
ships with time zone file version 32.
Oracle recommends upgrading to the desired (latest) version of the time
zone file. For more information, refer to "Upgrading the Time Zone File
and Timestamp with Time Zone Data" in the 19 Oracle Database
Globalization Support Guide.
14. Recreate directory objects to remove any symbolic links from directory
paths. To identify paths that contain symbolic links before upgrading,
use OS commands like UNIX file or WINDOWS dir. After upgrading, run
$ORACLE_HOME/rdbms/admin/utldirsymlink.sql to identify directory objects
with symbolic links in the path.
Found 5 user directory objects to be checked: DATA_FILE_DIR,
LOG_FILE_DIR, MEDIA_DIR, SS_OE_XMLDIR, SUBDIR.
Starting in Release 18c, symbolic links are not allowed in directory
object paths used with BFILE data types, the UTL_FILE package, or
external tables.
15. (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
command:
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
Oracle recommends gathering dictionary statistics after upgrade.
Dictionary statistics provide essential information to the Oracle
optimizer to help it find efficient SQL execution plans. After a database
upgrade, statistics need to be re-gathered as there can now be tables
that have significantly changed during the upgrade or new tables that do
not have statistics gathered yet.
16. Gather statistics on fixed objects after the upgrade and when there is a
representative workload on the system using the command:
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
This recommendation is given for all preupgrade runs.
Fixed object statistics provide essential information to the Oracle
optimizer to help it find efficient SQL execution plans. Those
statistics are specific to the Oracle Database release that generates
them, and can be stale upon database upgrade.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
INFORMATION ONLY
================
17. Check the Oracle documentation for the identified components for their
specific upgrade procedure.
The database upgrade script will not upgrade the following Oracle
components: OLAP Catalog,OWB
The Oracle database upgrade script upgrades most, but not all Oracle
Database components that may be installed. Some components that are not
upgraded may have their own upgrade scripts, or they may be deprecated or
obsolete.
ORACLE GENERATED FIXUP SCRIPT
=============================
All of the issues in database ORCL
which are identified above as AFTER UPGRADE "(AUTOFIXUP)" can be resolved by
executing the following
SQL>@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
==================
PREUPGRADE SUMMARY
==================
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade.log
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
Execute fixup scripts as indicated below:
Before upgrade:
Log into the database and execute the preupgrade fixups
@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
After the upgrade:
Log into the database and execute the postupgrade fixups
@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
Preupgrade complete: 2020-03-05T10:31:32
{}
데이터베이스 업그레이드를 위한 사전 조사(preupgrade.jar)를 수행합니다.
메시지를 충분히 검토하여 작업에 실패하지 않도록 주의해야 합니다.
자동으로 처리되지 않는 항목은 DBA의 수동 작업이 필요합니다.
II. 업그레이드 준비 작업
1. 파라미터 변경
select NAME, VALUE from V$PARAMETER where NAME = 'processes'; alter system set processes=300 scope=spfile; shutdown immediate; startup
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:33:08 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> col NAME form a15
SQL> col VALUE form a10
SQL> select NAME, VALUE from V$PARAMETER where NAME = 'processes';
NAME VALUE
--------------- ----------
processes 150
SQL> alter system set processes=300;
alter system set processes=300
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set processes=300 scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size 2254824 bytes
Variable Size 1291847704 bytes
Database Buffers 788529152 bytes
Redo Buffers 5148672 bytes
Database mounted.
Database opened.
SQL> col NAME form a15
SQL> col VALUE form a10
SQL> select NAME, VALUE from V$PARAMETER where NAME = 'processes';
NAME VALUE
--------------- ----------
processes 300
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
초기화 파라미터 중에 프로세스 값이 300 이상이어야 정상적인 패치 진행이 가능합니다.
해당 파라미터는 동적으로 변경이 불가능하므로, 파라미터 파일에 먼저 적용한 후에 데이터베이스를 재기동해야만 합니다.
2. EM Repository 제거
cp <19c ORACLE_HOME 경로>/rdbms/admin/emremove.sql <11g ORACLE_HOME 경로>/rdbms/admin/ emctl stop dbconsole
[oracle@orcl ~]$ echo $ORACLE_HOME /u01/app/oracle/product/11.2.0/db_1 [oracle@orcl ~]$ cp /u01/app/oracle/product/19c/db_1/rdbms/admin/emremove.sql /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/ [oracle@orcl ~]$ emctl stop dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0 Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved. https://dbup:1158/em/console/aboutApplication Stopping Oracle Enterprise Manager 11g Database Control ... ... Stopped.
12c 이후부터 데이터베이스 내의 EMDC은 지원하지 않으므로 Repository를 삭제해야 합니다.
먼저 19c 경로에 있는 삭제 스크립트를 11g 경로로 복제합니다.
SET ECHO ON; SET SERVEROUTPUT ON; @?/rdbms/admin/emremove.sql
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:40:43 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SET ECHO ON;
SQL> SET SERVEROUTPUT ON;
SQL> @?/rdbms/admin/emremove.sql
SQL> Rem
SQL> Rem $Header: rdbms/admin/emremove.sql /main/5 2017/05/28 22:46:05 stanaya Exp $
SQL> Rem
SQL> Rem emremove.sql
SQL> Rem
SQL> Rem Copyright (c) 2012, 2017, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem
SQL> Rem NAME
SQL> Rem emremove.sql - This script removes EM Schema from RDBMS
SQL> Rem
SQL> Rem DESCRIPTION
SQL> Rem This script will drop the Oracle Enterprise Manager related schemas and objects.
SQL> Rem This script might take few minutes to complete; it has 6 phases to complete the process.
SQL> Rem The script may take longer if you have SYSMAN and related sessions are active
SQL> Rem from Oracle Enterprise Manager(OEM) application.
SQL> Rem
SQL> Rem NOTES
SQL> Rem Please do following two steps before running this script
SQL> Rem set serveroutput on
SQL> Rem set echo on
SQL> Rem
SQL> Rem
SQL> Rem
SQL> Rem RECOMMENDATIONS
SQL> Rem
SQL> Rem You are recommended to shutdown DB Control application immediately before running this
SQL> Rem OEM repository removal script.
SQL> Rem To shutdown DB Control application, you need to run emctl stop dbconsole
SQL> Rem
SQL> Rem
SQL> Rem Steps to be performed manually (after this script is run)
SQL> Rem
SQL> Rem
SQL> Rem Please note that you need to remove the DB Control Configuration Files
SQL> Rem manually to remove DB Control completly; remove the following
SQL> Rem directories from your filesystem
SQL> Rem <ORACLE_HOME>/<hostname_sid>
SQL> Rem <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
SQL> Rem
SQL> Rem If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to 10.2.0.4,
SQL> Rem then the following directory also needs to be removed from the file system.
SQL> Rem <ORACLE_HOME>/<hostname_sid>.upgrade
SQL> Rem <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade
SQL> Rem
SQL> Rem On Microsoft platforms, also delete the DB Console service, generally with name
SQL> Rem OracleDBConsole<sid>
SQL> Rem
SQL> Rem #############################################################################################
SQL> Rem
SQL> Rem
SQL> Rem BEGIN SQL_FILE_METADATA
SQL> Rem SQL_SOURCE_FILE: rdbms/admin/emremove.sql
SQL> Rem SQL_SHIPPED_FILE: rdbms/admin/emremove.sql
SQL> Rem SQL_PHASE: UTILITY
SQL> Rem SQL_STARTUP_MODE: NORMAL
SQL> Rem SQL_IGNORABLE_ERRORS: NONE
SQL> Rem END SQL_FILE_METADATA
SQL> Rem
SQL> Rem MODIFIED (MM/DD/YY)
SQL> Rem spramani 01/17/17 - fix for 24518751
SQL> Rem spramani 08/03/16 - fix # 24330891
SQL> Rem spramani 07/20/12 - more fix
SQL> Rem spramani 12/21/11 - Created
SQL> Rem
SQL>
SQL>
SQL> DEFINE EM_REPOS_USER ="SYSMAN"
SQL> DEFINE LOGGING = "VERBOSE"
SQL>
SQL> declare
2
3 l_username dba_role_privs.grantee%type;
4 l_user_name dba_role_privs.grantee%type;
5 l_sql varchar2(1024);
6 l_sysman_user number;
7 l_mgmt_users_src number;
8 l_sid number;
9 l_serial number;
10 err number;
11 err_msg varchar2(128);
12 c number;
13 l_removejobs varchar2(1024);
14 l_set_context varchar2(1024);
15 l_client varchar2(16) := ' ';
16 l_context integer := 5;
17 l_verbose boolean := FALSE;
18 l_msg varchar2(1024);
19 l_open_acc number := 0;
20
21 TYPE SESSION_REC IS RECORD
22 (sid v$session.sid%type,
23 serial_no v$session.serial#%type);
24 TYPE SESSION_TYPE IS TABLE OF SESSION_REC;
25 l_sessions SESSION_TYPE;
26
27
28
29 l_job_process_count NUMBER ;
30 TYPE TBSP_ARRAY IS TABLE OF varchar2(64) INDEX BY BINARY_INTEGER ;
31 l_tablespaces TBSP_ARRAY;
32
33 PROCEDURE set_job_process_count(p_count IN NUMBER)
34 IS
35 BEGIN
36 --scope=memory so it will be reset on instance startup
37 -- SID=* to take care of RAC
38 IF p_count >=0
39 THEN
40 EXECUTE IMMEDIATE 'ALTER SYSTEM SET job_queue_processes='
41 ||p_count||' SID=''*'' scope=memory' ;
42 END IF ;
43 EXCEPTION WHEN OTHERS THEN NULL ;
44 END set_job_process_count ;
45
46 PROCEDURE LOG_MESSAGE (verbose boolean, message varchar2)
47 IS
48 BEGIN
49 IF (verbose = TRUE)
50 THEN
51 DBMS_OUTPUT.PUT_LINE(message);
52 END IF;
53 END LOG_MESSAGE;
54
55 FUNCTION get_job_process_count
56 RETURN NUMBER
57 IS
58 l_value NUMBER ;
59 BEGIN
60 SELECT value
61 INTO l_value
62 FROM v$parameter
63 WHERE name = 'job_queue_processes' ;
64 RETURN(l_value) ;
65 EXCEPTION
66 WHEN OTHERS THEN
67 RETURN(10) ;
68 END get_job_process_count ;
69 begin
70 IF (upper('&LOGGING') = 'VERBOSE')
71 THEN
72 l_verbose := TRUE;
73 END IF;
74
75 LOG_MESSAGE(l_verbose,' This script will drop the Oracle Enterprise Manager related schemas and objects.');
76 LOG_MESSAGE(l_verbose, ' This script might take few minutes to complete; it has 6 phases to complete the process.');
77 LOG_MESSAGE(l_verbose,' The script may take longer if you have SYSMAN and related sessions are active');
78 LOG_MESSAGE(l_verbose,' from Oracle Enterprise Manager(OEM) application.');
79 LOG_MESSAGE(l_verbose,' ');
80 LOG_MESSAGE(l_verbose,' ');
81 LOG_MESSAGE(l_verbose,' Recommendations:');
82 LOG_MESSAGE(l_verbose,' ');
83 LOG_MESSAGE(l_verbose,' ');
84 LOG_MESSAGE(l_verbose,' You are recommended to shutdown DB Control application immediately before running this');
85 LOG_MESSAGE(l_verbose,' OEM repository removal script.');
86 LOG_MESSAGE(l_verbose,' To shutdown DB Control application, you need to run: emctl stop dbconsole');
87 LOG_MESSAGE(l_verbose,' ');
88 LOG_MESSAGE(l_verbose,' ');
89 LOG_MESSAGE(l_verbose,' Steps to be performed manually (after this script is run):');
90 LOG_MESSAGE(l_verbose,' ');
91 LOG_MESSAGE(l_verbose,' ');
92 LOG_MESSAGE(l_verbose,' Please note that you need to remove the DB Control Configuration Files');
93 LOG_MESSAGE(l_verbose,' manually to remove DB Control completly; remove the following');
94 LOG_MESSAGE(l_verbose,' directories from your filesystem:');
95 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/<hostname_sid>');
96 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>');
97 LOG_MESSAGE(l_verbose,' ');
98 LOG_MESSAGE(l_verbose,' If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to 10.2.0.4,');
99 LOG_MESSAGE(l_verbose,' then the following directory also needs to be removed from the file system.');
100 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/<hostname_sid>.upgrade');
101 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade');
102 LOG_MESSAGE(l_verbose,' ');
103 LOG_MESSAGE(l_verbose,' On Microsoft platforms, also delete the DB Console service, generally with name');
104 LOG_MESSAGE(l_verbose,' OracleDBConsole<sid>');
105
106
107 LOG_MESSAGE(l_verbose,'Starting phase 1 : Dropping AQ related objests, EM jobs and all Oracle Enterprise Manager related schemas; except SYSMAN ...');
108
109 c := 0;
110 BEGIN
111 select count(1) into l_sysman_user from all_users where username='SYSMAN';
112 IF (l_sysman_user > 0 ) THEN
113 BEGIN
114
115 BEGIN
116 LOG_MESSAGE(l_verbose,'dropping AQ related objests from SYSMAN ...');
117
118 DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);
119 EXCEPTION
120 WHEN OTHERS THEN
121 err := SQLCODE;
122 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: AQ related objects are dropped already or not found');
123 END;
124
125 BEGIN
126 -- reduce job_queue_processes to zero
127 l_job_process_count := get_job_process_count ;
128 set_job_process_count(0) ;
129 LOG_MESSAGE(l_verbose,'saved job_queue_process=' || l_job_process_count || ', set to 0, now removing Oracle EM jobs ...');
130 l_removejobs := 'BEGIN ' || 'SYSMAN' || '.emd_maintenance.remove_em_dbms_jobs; END;';
131 execute immediate l_removejobs;
132 EXCEPTION
133 WHEN OTHERS THEN
134 err := SQLCODE;
135 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: EM jobs are dropped already or not found');
136 END;
137
138 END;
139 END IF;
140 END;
141
142 -- First, drop all users, except SYSMAN who have MGMT_USER role and
143 -- are created by EM. All users created by EM will have a record
144 -- in MGMT_CREATED_USERS table
145 --
146
147 BEGIN
148 select count(1) into l_sysman_user from all_users where username='SYSMAN';
149 IF (l_sysman_user > 0 ) THEN
150 BEGIN
151
152 LOOP -- part 1 main loop
153 -- handle SYSMAN is partially dropped
154 select count(1) into l_mgmt_users_src from all_objects where object_name='MGMT_CREATED_USERS' and owner='SYSMAN';
155 IF(l_mgmt_users_src = 0 ) THEN
156 EXIT;
157 END IF;
158 BEGIN
159 LOG_MESSAGE(l_verbose,'finding users who needs to be dropped ...');
160 l_username := '';
161 BEGIN
162 execute immediate 'select grantee
163 from sys.dba_role_privs
164 where granted_role ='||DBMS_ASSERT.ENQUOTE_LITERAL('MGMT_USER')||
165 ' AND grantee IN (SELECT user_name
166 FROM SYSMAN.MGMT_CREATED_USERS
167 WHERE SYSTEM_USER=0)
168 AND ROWNUM=1'
169 into l_user_name;
170 LOG_MESSAGE(l_verbose,'found user name: ' || l_user_name);
171 l_username := DBMS_ASSERT.ENQUOTE_NAME(l_user_name, FALSE);
172
173 EXECUTE IMMEDIATE 'ALTER USER '||l_username||' ACCOUNT LOCK' ;
174 EXCEPTION
175 WHEN NO_DATA_FOUND THEN
176 LOG_MESSAGE(l_verbose,l_username || ' IS ALREADY DROPPED');
177 EXIT; -- THEN RETURN ;
178 END ;
179
180
181 FOR cnt in 1 .. 150 LOOP -- session kill loop
182
183 BEGIN
184 -- FOR crec in (SELECT sid, serial#
185 -- FROM v$session
186 -- WHERE username=l_username
187 -- AND status NOT IN('KILLED'))
188
189 l_sql := 'SELECT sid, serial#
190 FROM v$session
191 WHERE username='|| DBMS_ASSERT.ENQUOTE_LITERAL(l_user_name)||'
192 AND status NOT IN(''KILLED'')';
193 execute immediate l_sql BULK COLLECT INTO l_sessions;
194
195 FOR i in 1..l_sessions.COUNT
196 LOOP -- cursor loop
197 BEGIN
198 LOG_MESSAGE(l_verbose,'killing related sessions : sid= ' || l_sessions(i).sid || ' serial#= ' || l_sessions(i).serial_no || ' ...');
199 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ' || DBMS_ASSERT.ENQUOTE_LITERAL(l_sessions(i).sid || ',' || l_sessions(i).serial_no)||' IMMEDIATE';
200 EXCEPTION
201 WHEN OTHERS THEN
202 err := SQLCODE;
203 IF err != -30 THEN
204 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no session found; or already killed.');
205 EXIT;
206 END IF;
207 END;
208 COMMIT;
209 END LOOP; -- end cursor loop
210
211 EXCEPTION
212 WHEN OTHERS THEN
213 err := SQLCODE;
214 IF err != -30 THEN
215 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no session found; or already killed.');
216 EXIT;
217 END IF;
218 END;
219
220 IF SQL%NOTFOUND THEN
221 LOG_MESSAGE(l_verbose,'found [sql%notfound]: no session found; or already killed.');
222 EXIT;
223 END IF;
224
225 COMMIT;
226
227 END LOOP; -- end session killing loop
228 LOG_MESSAGE(l_verbose,' Dropping user : ' || l_username || '...');
229
230 EXECUTE IMMEDIATE 'drop user ' || l_username || ' cascade';
231 exit;
232 EXCEPTION
233 WHEN NO_DATA_FOUND THEN
234 LOG_MESSAGE(l_verbose,'found [no_data_found]: no user/corresponding sessions found related to DB Control');
235 EXIT;
236 WHEN OTHERS THEN
237 err := SQLCODE;
238 IF err = -1918 THEN
239 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no DB Control user/corresponding sessions found related to DB Control');
240 EXIT;
241 ELSE
242 IF err = -1940 THEN
243 NULL;
244 ELSE
245 -- keep count of try to drop EM related user and sessions
246 -- give up after 50 try
247
248 c := c+1;
249 IF c > 50 THEN
250 RAISE;
251 END IF;
252 END IF;
253 END IF;
254 END;
255 END LOOP; -- end part main loop
256 END;
257 ELSE
258 LOG_MESSAGE(l_verbose,'SYSMAN IS ALREADY DROPPED');
259 END IF;
260 END;
261
262 BEGIN
263 -- Now, drop the SYSMAN user
264 LOG_MESSAGE(l_verbose,'Finished phase 1');
265 LOG_MESSAGE(l_verbose,'Starting phase 2 : Dropping SYSMAN schema ...');
266
267 c := 0;
268 -- validate user exists
269 select count(1) into l_sysman_user from all_users where username='SYSMAN';
270 IF (l_sysman_user > 0 ) THEN
271 BEGIN
272
273 BEGIN
274 -- SELECT username
275 -- INTO l_username
276 -- FROM dba_users
277 -- WHERE username = 'SYSMAN';
278 -- l_user_name := 'SYSMAN';
279 -- l_username = DBMS_ASSERT.ENQUOTE_NAME(l_user_name);
280 EXECUTE IMMEDIATE 'ALTER USER SYSMAN ACCOUNT LOCK' ;
281 EXCEPTION
282 WHEN NO_DATA_FOUND THEN
283 LOG_MESSAGE(l_verbose,'SYSMAN IS ALREADY DROPPED');
284 -- THEN RETURN ;
285 END ;
286
287
288 BEGIN
289 LOOP -- main loop
290 BEGIN
291 FOR cnt in 1 .. 150 LOOP -- session kill loop
292 BEGIN
293 FOR crec in (SELECT sid, serial#
294 FROM gv$session
295 WHERE (username='SYSMAN' OR
296 schemaname='SYSMAN')
297 AND status != 'KILLED')
298 LOOP --cursor loop
299 BEGIN
300 LOG_MESSAGE(l_verbose,'killing related sessions : sid= ' || crec.sid || ' serial#= ' || crec.serial# || ' ...');
301 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ' ||
302 DBMS_ASSERT.ENQUOTE_LITERAL(crec.sid || ',' || crec.serial#)|| ' IMMEDIATE';
303 EXCEPTION
304 WHEN OTHERS THEN
305 err := SQLCODE;
306 IF err != -30 THEN
307 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: SYSMAN related sessions are already killed; no session found');
308 EXIT;
309 END IF;
310 END;
311 COMMIT;
312 END LOOP; -- cursor loop ends
313 EXCEPTION
314 WHEN OTHERS THEN
315 err := SQLCODE;
316 IF err != -30 THEN
317 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: SYSMAN related sessions are already killed; no session found');
318 EXIT;
319 END IF;
320 END;
321 IF SQL%NOTFOUND THEN
322 LOG_MESSAGE(l_verbose,'found [sql%notfound]: SYSMAN related sessions are already killed; no session found');
323 EXIT;
324 END IF;
325 COMMIT;
326 END LOOP; -- end of session kill loop
327
328 -- END;
329 LOG_MESSAGE(l_verbose,'dropping user : ' || l_user_name || '...');
330 execute immediate 'drop user SYSMAN cascade';
331 set_job_process_count(l_job_process_count) ;
332 exit;
333
334 -- >> START - Dropping the Tablespaces
335 LOG_MESSAGE(l_verbose,'Finished phase 2');
336 LOG_MESSAGE(l_verbose,'Starting phase 3 : Dropping Oracle Enterprise Manager related tablespaces ...');
337
338 LOG_MESSAGE(l_verbose,'No seperate TABLESPACES Exist for EM; all in SYSAUX; no action taken');
339 -- >> END - Dropping the Tablespaces
340
341 EXCEPTION
342 WHEN NO_DATA_FOUND THEN
343 LOG_MESSAGE(l_verbose,'found [ no_data_found]: no sysman/corresponding sessions');
344 EXIT;
345 WHEN OTHERS THEN
346 err := SQLCODE;
347 IF err = -1918 THEN
348 LOG_MESSAGE(l_verbose,'found [sqlcode:1918]: no sysman/corresponding sessions');
349 EXIT;
350 ELSIF err = -1940 THEN
351 NULL;
352 ELSE
353 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no sysman/corresponding sessions');
354 c := c+1;
355 IF c > 50 THEN
356 RAISE;
357 END IF;
358 END IF;
359 END;
360 END LOOP; -- end of main loop
361 END;
362 LOG_MESSAGE(l_verbose,'SYSMAN dropped');
363 commit;
364 END;
365 ELSE
366 LOG_MESSAGE(l_verbose,'SYSMAN is already dropped');
367 END IF;
368 EXCEPTION
369 WHEN OTHERS THEN
370 set_job_process_count(l_job_process_count) ;
371 RAISE ;
372 END;
373
374 BEGIN
375
376 -- Drop basic roles.
377 LOG_MESSAGE(l_verbose,'Finished phase 3');
378 LOG_MESSAGE(l_verbose,'Starting phase 4 : Dropping Oracle Enterprise Manager related MGMT_USER role ...');
379
380 BEGIN
381 execute immediate 'drop role MGMT_USER';
382 EXCEPTION
383 WHEN OTHERS THEN
384 LOG_MESSAGE(l_verbose,'Role MGMT_USER already dropped');
385 END;
386 --
387 -- Drop the following synonyms related to REPOS Schema
388 --
389 LOG_MESSAGE(l_verbose,'Finished phase 4');
390 LOG_MESSAGE(l_verbose,'Starting phase 5 : Dropping Oracle Enterprise Manager related public synonyms ...');
391
392
393 BEGIN
394 FOR crec in (SELECT synonym_name,table_owner,table_name
395 FROM dba_synonyms
396 WHERE owner = 'PUBLIC'
397 AND table_owner = 'SYSMAN')
398 LOOP
399 BEGIN
400 LOG_MESSAGE(l_verbose,'Dropping synonym : ' || crec.synonym_name || ' ... ');
401 EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM ' || DBMS_ASSERT.SIMPLE_SQL_NAME(crec.synonym_name);
402
403 EXCEPTION
404 when others then
405 LOG_MESSAGE(l_verbose,'Public synonym ' || crec.synonym_name ||
406 ' cannot be dropped');
407 -- continue dropping other synonyms.
408 END;
409 END LOOP;
410 END;
411
412 BEGIN
413 LOG_MESSAGE(l_verbose,'Finished phase 5');
414 LOG_MESSAGE(l_verbose,'Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ...');
415 FOR crec in (select role from sys.dba_roles where role like 'MGMT_%')
416 LOOP
417 LOG_MESSAGE(l_verbose,'Dropping role: ' || crec.role ||' ...');
418 execute immediate 'drop role ' || DBMS_ASSERT.SIMPLE_SQL_NAME(crec.role);
419 commit;
420 END LOOP;
421 EXCEPTION
422 when NO_DATA_FOUND THEN
423 LOG_MESSAGE(l_verbose,'Roles like MGMT% do not exist');
424 WHEN OTHERS THEN
425 err := SQLCODE;
426 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: no MGMT% roles to drop');
427 END;
428
429 -- lock DBSNMP user
430 BEGIN
431 BEGIN
432 LOG_MESSAGE(l_verbose,'Process DBSNMP user');
433 select count(1) into l_open_acc from DBA_USERS where USERNAME ='DBSNMP' and ACCOUNT_STATUS='OPEN';
434 EXCEPTION
435 when NO_DATA_FOUND THEN
436 LOG_MESSAGE(l_verbose,'User DBSNMP does not exist');
437 WHEN OTHERS THEN
438 err := SQLCODE;
439 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while checking DBSNMP user status');
440
441 END;
442
443 IF (l_open_acc > 0 ) THEN
444 BEGIN
445 execute immediate 'ALTER USER DBSNMP PASSWORD EXPIRE';
446 LOG_MESSAGE(l_verbose,'DBSNMP user password is made expired');
447 EXCEPTION
448 WHEN OTHERS THEN
449 err := SQLCODE;
450 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while expiring DBSNMP user password');
451 END;
452
453 BEGIN
454 execute immediate 'ALTER USER DBSNMP ACCOUNT LOCK';
455 LOG_MESSAGE(l_verbose,'User DBSNMP is locked');
456 EXCEPTION
457 WHEN OTHERS THEN
458 err := SQLCODE;
459 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while locking DBSNMP user');
460 END;
461
462 END IF;
463 LOG_MESSAGE(l_verbose,'Done processing DBSNMP user');
464 END;
465
466 LOG_MESSAGE(l_verbose,'Finished phase 6');
467 LOG_MESSAGE(l_verbose,'The Oracle Enterprise Manager related schemas and objects are dropped.');
468 LOG_MESSAGE(l_verbose,'Do the manual steps to studown the DB Control if not done before running this script and then delete the DB Control configuration files');
469 commit;
470 END;
471 END;
472 /
old 70: IF (upper('&LOGGING') = 'VERBOSE')
new 70: IF (upper('VERBOSE') = 'VERBOSE')
This script will drop the Oracle Enterprise Manager related schemas and objects.
This script might take few minutes to complete; it has 6 phases to complete the
process.
The script may take longer if you have SYSMAN and related sessions are active
from Oracle Enterprise Manager(OEM) application.
Recommendations:
You are recommended to shutdown DB Control application immediately before
running this
OEM repository removal script.
To shutdown DB Control application, you need to run: emctl stop dbconsole
Steps to be performed manually (after this script is run):
Please note that you need to remove the DB Control Configuration Files
manually to remove DB Control completly; remove the following
directories from your filesystem:
<ORACLE_HOME>/<hostname_sid>
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to
10.2.0.4,
then the following directory also needs to be removed from the file system.
<ORACLE_HOME>/<hostname_sid>.upgrade
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade
On Microsoft platforms, also delete the DB Console service, generally with name
OracleDBConsole<sid>
Starting phase 1 : Dropping AQ related objests, EM jobs and all Oracle
Enterprise Manager related schemas; except SYSMAN ...
dropping AQ related objests from SYSMAN ...
saved job_queue_process=1000, set to 0, now removing Oracle EM jobs ...
finding users who needs to be dropped ...
found user name: MGMT_VIEW
found [sql%notfound]: no session found; or already killed.
Dropping user : "MGMT_VIEW"...
Finished phase 1
Starting phase 2 : Dropping SYSMAN schema ...
found [sql%notfound]: SYSMAN related sessions are already killed; no session
found
dropping user : MGMT_VIEW...
SYSMAN dropped
Finished phase 3
Starting phase 4 : Dropping Oracle Enterprise Manager related MGMT_USER role ...
Finished phase 4
Starting phase 5 : Dropping Oracle Enterprise Manager related public synonyms
...
Dropping synonym : ECM_UTIL ...
... << 중략 >> ...
Dropping synonym : SMP_EMD_TARGET_OBJ_ARRAY ...
Finished phase 5
Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ...
Process DBSNMP user
DBSNMP user password is made expired
User DBSNMP is locked
Done processing DBSNMP user
Finished phase 6
The Oracle Enterprise Manager related schemas and objects are dropped.
Do the manual steps to studown the DB Control if not done before running this
script and then delete the DB Control configuration files
PL/SQL procedure successfully completed.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
'SET ECHO ON'과 'SET SERVEROUTPUT ON'을 반드시 설정하고 삭제 스크립트를 수행해야 정상적으로 Repository 삭제가 수행됩니다.
3. OLAP Catalog 제거
@?/olap/admin/catnoamd.sql purge dba_recyclebin;
[oracle@orcl ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:42:11 2020 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> @?/olap/admin/catnoamd.sql Synonym dropped. ... << 중략 >> ... Type dropped. PL/SQL procedure successfully completed. Role dropped. PL/SQL procedure successfully completed. 1 row deleted. SQL> purge dba_recyclebin; DBA Recyclebin purged. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
12c 이후로 데이터베이스 내의 OLAP Catalog는 desupport 되었으며, 오라클은 업그레이드를 하기 전에 삭제하는 것을 권고하고 있습니다.
4. Oracle Application Express 업그레이드
cd <19c ORACLE_HOME 경로>/apex
[oracle@orcl ~]$ echo $ORACLE_HOME /u01/app/oracle/product/11.2.0/db_1 [oracle@orcl ~]$ cd /u01/app/oracle/product/19c/db_1/apex
19c에서 지원하는 APEX 버전은 18.2.0.00.12 이상이며, 수동으로 삭제하거나 새 버전을 설치해야 합니다.
19c 설치 경로로 이동하여 작업을 진행합니다.
select COMP_NAME, STATUS, VERSION from DBA_REGISTRY where COMP_NAME='Oracle Application Express'; @apexins SYSAUX SYSAUX TEMP /i/
[oracle@orcl apex]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:45:31 2020 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> col COMP_NAME form a35 SQL> col STATUS form a12 SQL> select COMP_NAME, STATUS, VERSION from DBA_REGISTRY where COMP_NAME='Oracle Application Express'; COMP_NAME STATUS VERSION ----------------------------------- ------------ ------------------------------ Oracle Application Express VALID 3.2.1.00.12 SQL> @apexins SYSAUX SYSAUX TEMP /i/ ...set_appun.sql ... << 중략 >> ... timing for: Complete Installation Elapsed: 00:08:44.81 PL/SQL procedure successfully completed. 1 row selected. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
새 버전의 설치 스크립트를 실행합니다.
@?/rdbms/admin/utlrp.sql select COMP_NAME, STATUS, VERSION from DBA_REGISTRY where COMP_NAME='Oracle Application Express';
[oracle@orcl apex]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 11:09:33 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @?/rdbms/admin/utlrp.sql
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2020-03-05 11:10:12
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2020-03-05 11:10:23
DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
...(11:10:25) Starting validate_apex for APEX_180200
...(11:10:26) Checking missing sys privileges
...(11:10:26) Re-generating APEX_180200.wwv_flow_db_version
... wwv_flow_db_version is up to date
...(11:10:26) Key object existence check
...(11:10:26) Setting DBMS Registry for APEX to valid
...(11:10:26) Exiting validate_apex
PL/SQL procedure successfully completed.
SQL> col COMP_NAME form a35
SQL> col STATUS form a12
SQL> select COMP_NAME, STATUS, VERSION from DBA_REGISTRY where COMP_NAME='Oracle Application Express';
COMP_NAME STATUS VERSION
----------------------------------- ------------ ------------------------------
Oracle Application Express VALID 18.2.0.00.12
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
설치 과정 중에 invalid된 객체를 재 컴파일하여, 새 버전의 APEX를 사용할 수 있도록 utlrp 스크립트를 실행합니다.
5. Refresh Materialized View
declare list_failures integer(3) :=0; begin DBMS_MVIEW.REFRESH_ALL_MVIEWS(list_failures,'C','', TRUE, FALSE); end; /
[oracle@orcl ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 11:11:42 2020 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> declare 2 list_failures integer(3) :=0; 3 begin 4 DBMS_MVIEW.REFRESH_ALL_MVIEWS(list_failures,'C','', TRUE, FALSE); 5 end; 6 / PL/SQL procedure successfully completed. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
Mview를 refresh하여 sys.sumdelta$를 모두 비우도록 합니다.
6. 2차 조사 (옵션)
echo $ORACLE_HOME <19c ORACLE_HOME 경로>/jdk/bin/java -jar <19c ORACLE_HOME 경로>/rdbms/admin/preupgrade.jar TERMINAL TEXT
[oracle@orcl ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@orcl ~]$ $ORACLE_BASE/product/19c/db_1/jdk/bin/java -jar $ORACLE_BASE/product/19c/db_1/rdbms/admin/preupgrade.jar TERMINAL TEXT
Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2020-03-05T11:13:39
Upgrade-To version: 19.0.0.0.0
=======================================
Status of the database prior to upgrade
=======================================
Database Name: ORCL
Container Name: Not Applicable in Pre-12.1 database
Container ID: Not Applicable in Pre-12.1 database
Version: 11.2.0.4.0
DB Patch Level: No Patch Bundle applied
Compatible: 11.2.0.4.0
Blocksize: 8192
Platform: Linux x86 64-bit
Timezone File: 14
Database log mode: NOARCHIVELOG
Readonly: FALSE
Edition: EE
Oracle Component Upgrade Action Current Status
---------------- -------------- --------------
Oracle Server [to be upgraded] VALID
JServer JAVA Virtual Machine [to be upgraded] VALID
Oracle XDK for Java [to be upgraded] VALID
Oracle Workspace Manager [to be upgraded] VALID
OLAP Analytic Workspace [to be upgraded] VALID
Oracle Text [to be upgraded] VALID
Oracle XML Database [to be upgraded] VALID
Oracle Java Packages [to be upgraded] VALID
Oracle Multimedia [to be upgraded] VALID
Oracle Spatial [to be upgraded] VALID
Expression Filter [to be upgraded] VALID
Rule Manager [to be upgraded] VALID
Oracle OLAP API [to be upgraded] VALID
==============
BEFORE UPGRADE
==============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
1. (AUTOFIXUP) Gather stale data dictionary statistics prior to database
upgrade in off-peak time using:
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
Dictionary statistics do not exist or are stale (not up-to-date).
Dictionary statistics help the Oracle optimizer find efficient SQL
execution plans and are essential for proper upgrade timing. Oracle
recommends gathering dictionary statistics in the last 24 hours before
database upgrade.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
2. (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.
None of the fixed object tables have had stats collected.
Gathering statistics on fixed objects, if none have been gathered yet, is
recommended prior to upgrading.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
INFORMATION ONLY
================
3. To help you keep track of your tablespace allocations, the following
AUTOEXTEND tablespaces are expected to successfully EXTEND during the
upgrade process.
Min Size
Tablespace Size For Upgrade
---------- ---------- -----------
SYSAUX 670 MB 892 MB
SYSTEM 790 MB 1219 MB
TEMP 29 MB 150 MB
UNDOTBS1 410 MB 446 MB
Minimum tablespace sizes for upgrade are estimates.
4. Run $ORACLE_HOME/rdbms/admin/catnoexf.sql located in the new Oracle
Database Oracle home to remove both EXF and RUL.
Expression Filter (EXF) or Rules Manager (RUL) exist in the database.
Starting with Oracle Database release 12.1, the Expression Filter (EXF)
and Database Rules Manager (RUL) features are desupported, and are
removed during the upgrade process. This step can be manually performed
before the upgrade to reduce downtime.
5. Check the Oracle Backup and Recovery User's Guide for information on how
to manage an RMAN recovery catalog schema.
If you are using a version of the recovery catalog schema that is older
than that required by the RMAN client version, then you must upgrade the
catalog schema.
It is good practice to have the catalog schema the same or higher version
than the RMAN client version you are using.
ORACLE GENERATED FIXUP SCRIPT
=============================
All of the issues in database ORCL
which are identified above as BEFORE UPGRADE "(AUTOFIXUP)" can be resolved by
executing the following
SQL>@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
=============
AFTER UPGRADE
=============
REQUIRED ACTIONS
================
None
RECOMMENDED ACTIONS
===================
6. (AUTOFIXUP) If you use the -T option for the database upgrade, then run
$ORACLE_HOME/rdbms/admin/utluptabdata.sql after the upgrade is complete,
to VALIDATE and UPGRADE any user tables affected by changes to
Oracle-Maintained types.
There are user tables dependent on Oracle-Maintained object types.
If the -T option is used to set user tablespaces to READ ONLY during the
upgrade, user tables in those tablespaces, that are dependent on
Oracle-Maintained types, will not be automatically upgraded. If a type is
evolved during the upgrade, any dependent tables need to be re-validated
and upgraded to the latest type version AFTER the database upgrade
completes.
7. Upgrade the database time zone file using the DBMS_DST package.
The database is using time zone file version 14 and the target 19 release
ships with time zone file version 32.
Oracle recommends upgrading to the desired (latest) version of the time
zone file. For more information, refer to "Upgrading the Time Zone File
and Timestamp with Time Zone Data" in the 19 Oracle Database
Globalization Support Guide.
8. Recreate directory objects to remove any symbolic links from directory
paths. To identify paths that contain symbolic links before upgrading,
use OS commands like UNIX file or WINDOWS dir. After upgrading, run
$ORACLE_HOME/rdbms/admin/utldirsymlink.sql to identify directory objects
with symbolic links in the path.
Found 5 user directory objects to be checked: DATA_FILE_DIR,
LOG_FILE_DIR, MEDIA_DIR, SS_OE_XMLDIR, SUBDIR.
Starting in Release 18c, symbolic links are not allowed in directory
object paths used with BFILE data types, the UTL_FILE package, or
external tables.
9. (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
command:
EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;
Oracle recommends gathering dictionary statistics after upgrade.
Dictionary statistics provide essential information to the Oracle
optimizer to help it find efficient SQL execution plans. After a database
upgrade, statistics need to be re-gathered as there can now be tables
that have significantly changed during the upgrade or new tables that do
not have statistics gathered yet.
10. Gather statistics on fixed objects after the upgrade and when there is a
representative workload on the system using the command:
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
This recommendation is given for all preupgrade runs.
Fixed object statistics provide essential information to the Oracle
optimizer to help it find efficient SQL execution plans. Those
statistics are specific to the Oracle Database release that generates
them, and can be stale upon database upgrade.
For information on managing optimizer statistics, refer to the 11.2.0.4
Oracle Database Performance Tuning Guide.
INFORMATION ONLY
================
11. Check the Oracle documentation for the identified components for their
specific upgrade procedure.
The database upgrade script will not upgrade the following Oracle
components: OWB
The Oracle database upgrade script upgrades most, but not all Oracle
Database components that may be installed. Some components that are not
upgraded may have their own upgrade scripts, or they may be deprecated or
obsolete.
ORACLE GENERATED FIXUP SCRIPT
=============================
All of the issues in database ORCL
which are identified above as AFTER UPGRADE "(AUTOFIXUP)" can be resolved by
executing the following
SQL>@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
==================
PREUPGRADE SUMMARY
==================
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade.log
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
Execute fixup scripts as indicated below:
Before upgrade:
Log into the database and execute the preupgrade fixups
@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
After the upgrade:
Log into the database and execute the postupgrade fixups
@/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
Preupgrade complete: 2020-03-05T11:13:40
한번 더 수동으로 수행해야 할 사전 작업이 있는지 확인합니다.
{}
III. 업그레이드
1. preupgrade_fixup 실행
SET ECHO ON; SET SERVEROUTPUT ON; @/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql shutdown immediate;
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 11:19:11 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SET ECHO ON;
SQL> SET SERVEROUTPUT ON;
SQL> @/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql
SQL> REM
SQL> REM Oracle PRE-Upgrade Fixup Script
SQL> REM
SQL> REM Auto-Generated by: Oracle Preupgrade Script
SQL> REM Version: 19.0.0.0.0 Build: 1
SQL> REM Generated on: 2020-03-05 11:13:37
SQL> REM
SQL> REM Source Database: ORCL
SQL> REM Source Database Version: 11.2.0.4.0
SQL> REM For Upgrade to Version: 19.0.0.0.0
SQL> REM
SQL>
SQL> REM
SQL> REM Setup Environment
SQL> REM
SQL> SET ECHO OFF SERVEROUTPUT ON FORMAT WRAPPED TAB OFF LINESIZE 200;
Executing Oracle PRE-Upgrade Fixup Script
Auto-Generated by: Oracle Preupgrade Script
Version: 19.0.0.0.0 Build: 1
Generated on: 2020-03-05 11:13:37
For Source Database: ORCL
Source Database Version: 11.2.0.4.0
For Upgrade to Version: 19.0.0.0.0
Preup Preupgrade
Action Issue Is
Number Preupgrade Check Name Remedied Further DBA Action
------ ------------------------ ---------- --------------------------------
1. dictionary_stats YES None.
2. pre_fixed_objects YES None.
3. tablespaces_info NO Informational only.
Further action is optional.
4. exf_rul_exists NO Informational only.
Further action is optional.
5. rman_recovery_version NO Informational only.
Further action is optional.
The fixup scripts have been run and resolved what they can. However,
there are still issues originally identified by the preupgrade that
have not been remedied and are still present in the database.
Depending on the severity of the specific issue, and the nature of
the issue itself, that could mean that your database is not ready
for upgrade. To resolve the outstanding issues, start by reviewing
the preupgrade_fixups.sql and searching it for the name of
the failed CHECK NAME or Preupgrade Action Number listed above.
There you will find the original corresponding diagnostic message
from the preupgrade which explains in more detail what still needs
to be done.
PL/SQL procedure successfully completed.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
본격적인 업그레이드에 앞서 preupgrade_fixups.sql 스크립트를 실행합니다.
자동으로 처리할 수 없는 DBA가 수동으로 처리해야 할 사항들을 확인할 수 있습니다.
그리고 11g의 인스턴스를 중지합니다. 이후 부터는 19c 인스턴스로 작업을 진행합니다.
2. 파일 복사
cp <11g ORACLE_HOME 경로>/network/admin/*.ora <19c ORACLE_HOME 경로>/network/admin/ cp <11g ORACLE_HOME 경로>/dbs/spfile<인스턴스명>.ora <19c ORACLE_HOME 경로>/dbs/ cp <11g ORACLE_HOME 경로>/dbs/orapw<인스턴스명> <19c ORACLE_HOME 경로>/dbs/
[oracle@orcl ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@orcl ~]$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbup)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@orcl ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbup)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
[oracle@orcl ~]$ cp $ORACLE_HOME/network/admin/*.ora $ORACLE_BASE/product/19c/db_1/network/admin/
[oracle@orcl ~]$ cp $ORACLE_HOME/dbs/spfileorcl.ora $ORACLE_BASE/product/19c/db_1/dbs/
[oracle@orcl ~]$ cp $ORACLE_HOME/dbs/orapworcl $ORACLE_BASE/product/19c/db_1/dbs/
기존에 사용 중이던 네트워크 설정 파일(listener.ora, tnsnames.ora), 파라미터 파일 그리고 패스워드 파일을 19c의 경로로 복사합니다.
네트워크 설정 파일의 경우, 기존 11g의 홈경로가 저장되어 있을 경우 19c에 맞게 수정해야 합니다.
orapwd file=<19c ORACLE_HOME 경로>/dbs/orapw<데이터베이스명> force=y format=12
[oracle@orcl ~]$ orapwd file=$ORACLE_HOME/dbs/orapworcl force=y format=12 Enter password for SYS:<sys 계정 암호 입력>
업그레이드를 하지 않았을 경우, sys 계정 암호 변경 시 ORA-28017 에러 발생
SQL> alter user sys identified by oracle; alter user sys identified by oracle * ERROR at line 1: ORA-28017: The password file is in the legacy format.
12.2 이상으로 업그레이드할 경우 암호 복잡도 규칙이 강제 적용되어 OPW-00029 에러 발생
[oracle@orcl ~]$ orapwd file=$ORACLE_HOME/dbs/orapworcl force=y format=12.2 Enter password for SYS: OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.
복사한 패스워드 파일을 12c 이상의 버전으로 업그레이드 합니다.
3. 리스너 재기동
lsnrctl stop
[oracle@orcl ~]$ echo $ORACLE_HOME /u01/app/oracle/product/11.2.0/db_1 [oracle@orcl ~]$ lsnrctl stop LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-MAR-2020 11:25:03 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbup)(PORT=1521))) The command completed successfully
11g의 리스너를 중지합니다.
lsnrctl start
[oracle@orcl ~]$ echo $ORACLE_HOME /u01/app/oracle/product/19c/db_1 [oracle@orcl ~]$ lsnrctl start LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 05-MAR-2020 11:25:54 Copyright (c) 1991, 2019, Oracle. All rights reserved. Starting /u01/app/oracle/product/19c/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 19.0.0.0.0 - Production System parameter file is /u01/app/oracle/product/19c/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/dbup/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbup)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbup)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 05-MAR-2020 11:25:54 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19c/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/dbup/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbup)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully
19c의 리스너로 기동합니다.
4. 업그레이드
startup upgrade;
[oracle@orcl ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 5 11:26:30 2020 Version 19.6.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to an idle instance. SQL> startup upgrade; ORACLE instance started. Total System Global Area 2097149856 bytes Fixed Size 8898464 bytes Variable Size 1207959552 bytes Database Buffers 872415232 bytes Redo Buffers 7876608 bytes Database mounted. Database opened. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.6.0.0.0
데이터베이스를 업그레이드 모드로 기동합니다.
<19c ORACLE_HOME 경로>/bin/dbupgrade
[oracle@orcl ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/19c/db_1
[oracle@orcl ~]$ $ORACLE_HOME/bin/dbupgrade
Argument list for [/u01/app/oracle/product/19c/db_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in c = 0
Do not run in C = 0
Input Directory d = 0
Echo OFF e = 1
Simulate E = 0
Forced cleanup F = 0
Log Id i = 0
Child Process I = 0
Log Dir l = 0
Priority List Name L = 0
Upgrade Mode active M = 0
SQL Process Count n = 0
SQL PDB Process Count N = 0
Open Mode Normal o = 0
Start Phase p = 0
End Phase P = 0
Reverse Order r = 0
AutoUpgrade Resume R = 0
Script s = 0
Serial Run S = 0
RO User Tablespaces T = 0
Display Phases y = 0
Debug catcon.pm z = 0
Debug catctl.pl Z = 0
catctl.pl VERSION: [19.0.0.0.0]
STATUS: [Production]
BUILD: [RDBMS_19.6.0.0.0DBRU_LINUX.X64_191217]
/u01/app/oracle/product/19c/db_1/rdbms/admin/orahome = [/u01/app/oracle/product/19c/db_1]
/u01/app/oracle/product/19c/db_1/bin/orabasehome = [/u01/app/oracle/product/19c/db_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19c/db_1]
Analyzing file /u01/app/oracle/product/19c/db_1/rdbms/admin/catupgrd.sql
Log file directory = [/tmp/cfgtoollogs/upgrade20200305112854]
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20200305112854/catupgrd_catcon_8389.lst]
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20200305112854/catupgrd*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20200305112854/catupgrd_*.lst] files for spool files, if any
Number of Cpus = 2
Database Name = orcl
DataBase Version = 11.2.0.4.0
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905/catupgrd_catcon_8389.lst]
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905/catupgrd*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905/catupgrd_*.lst] files for spool files, if any
Log file directory = [/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905]
Parallel SQL Process Count = 4
Components in [orcl]
Installed [APEX APS CATALOG CATJAVA CATPROC CONTEXT JAVAVM ORDIM OWM SDO XDB XML XOQ]
Not Installed [DV EM MGW ODM OLS RAC WK]
------------------------------------------------------
Phases [0-107] Start Time:[2020_03_05 11:29:19]
------------------------------------------------------
*********** Executing Change Scripts ***********
Serial Phase #:0 [orcl] Files:1 Time: 67s
*************** Catalog Core SQL ***************
Serial Phase #:1 [orcl] Files:5 Time: 44s
Restart Phase #:2 [orcl] Files:1 Time: 3s
*********** Catalog Tables and Views ***********
Parallel Phase #:3 [orcl] Files:19 Time: 18s
Restart Phase #:4 [orcl] Files:1 Time: 3s
************* Catalog Final Scripts ************
Serial Phase #:5 [orcl] Files:7 Time: 17s
***************** Catproc Start ****************
Serial Phase #:6 [orcl] Files:1 Time: 13s
***************** Catproc Types ****************
Serial Phase #:7 [orcl] Files:2 Time: 10s
Restart Phase #:8 [orcl] Files:1 Time: 3s
**************** Catproc Tables ****************
Parallel Phase #:9 [orcl] Files:67 Time: 27s
Restart Phase #:10 [orcl] Files:1 Time: 3s
************* Catproc Package Specs ************
Serial Phase #:11 [orcl] Files:1 Time: 58s
Restart Phase #:12 [orcl] Files:1 Time: 2s
************** Catproc Procedures **************
Parallel Phase #:13 [orcl] Files:94 Time: 10s
Restart Phase #:14 [orcl] Files:1 Time: 2s
Parallel Phase #:15 [orcl] Files:121 Time: 17s
Restart Phase #:16 [orcl] Files:1 Time: 2s
Serial Phase #:17 [orcl] Files:22 Time: 5s
Restart Phase #:18 [orcl] Files:1 Time: 4s
***************** Catproc Views ****************
Parallel Phase #:19 [orcl] Files:32 Time: 20s
Restart Phase #:20 [orcl] Files:1 Time: 3s
Serial Phase #:21 [orcl] Files:3 Time: 13s
Restart Phase #:22 [orcl] Files:1 Time: 2s
Parallel Phase #:23 [orcl] Files:25 Time: 160s
Restart Phase #:24 [orcl] Files:1 Time: 2s
Parallel Phase #:25 [orcl] Files:12 Time: 107s
Restart Phase #:26 [orcl] Files:1 Time: 1s
Serial Phase #:27 [orcl] Files:1 Time: 0s
Serial Phase #:28 [orcl] Files:3 Time: 5s
Serial Phase #:29 [orcl] Files:1 Time: 0s
Restart Phase #:30 [orcl] Files:1 Time: 3s
*************** Catproc CDB Views **************
Serial Phase #:31 [orcl] Files:1 Time: 2s
Restart Phase #:32 [orcl] Files:1 Time: 3s
Serial Phase #:34 [orcl] Files:1 Time: 0s
***************** Catproc PLBs *****************
Serial Phase #:35 [orcl] Files:294 Time: 22s
Serial Phase #:36 [orcl] Files:1 Time: 0s
Restart Phase #:37 [orcl] Files:1 Time: 3s
Serial Phase #:38 [orcl] Files:6 Time: 7s
Restart Phase #:39 [orcl] Files:1 Time: 4s
*************** Catproc DataPump ***************
Serial Phase #:40 [orcl] Files:3 Time: 55s
Restart Phase #:41 [orcl] Files:1 Time: 2s
****************** Catproc SQL *****************
Parallel Phase #:42 [orcl] Files:13 Time: 111s
Restart Phase #:43 [orcl] Files:1 Time: 4s
Parallel Phase #:44 [orcl] Files:11 Time: 12s
Restart Phase #:45 [orcl] Files:1 Time: 4s
Parallel Phase #:46 [orcl] Files:3 Time: 3s
Restart Phase #:47 [orcl] Files:1 Time: 3s
************* Final Catproc scripts ************
Serial Phase #:48 [orcl] Files:1 Time: 10s
Restart Phase #:49 [orcl] Files:1 Time: 2s
************** Final RDBMS scripts *************
Serial Phase #:50 [orcl] Files:1 Time: 18s
************ Upgrade Component Start ***********
Serial Phase #:51 [orcl] Files:1 Time: 3s
Restart Phase #:52 [orcl] Files:1 Time: 3s
********** Upgrading Java and non-Java *********
Serial Phase #:53 [orcl] Files:2 Time: 387s
***************** Upgrading XDB ****************
Restart Phase #:54 [orcl] Files:1 Time: 1s
Serial Phase #:56 [orcl] Files:3 Time: 27s
Serial Phase #:57 [orcl] Files:3 Time: 6s
Parallel Phase #:58 [orcl] Files:10 Time: 5s
Parallel Phase #:59 [orcl] Files:25 Time: 7s
Serial Phase #:60 [orcl] Files:4 Time: 11s
Serial Phase #:61 [orcl] Files:1 Time: 0s
Serial Phase #:62 [orcl] Files:32 Time: 6s
Serial Phase #:63 [orcl] Files:1 Time: 0s
Parallel Phase #:64 [orcl] Files:6 Time: 9s
Serial Phase #:65 [orcl] Files:2 Time: 24s
Serial Phase #:66 [orcl] Files:3 Time: 88s
**************** Upgrading ORDIM ***************
Restart Phase #:67 [orcl] Files:1 Time: 5s
Serial Phase #:69 [orcl] Files:1 Time: 4s
Parallel Phase #:70 [orcl] Files:2 Time: 38s
Restart Phase #:71 [orcl] Files:1 Time: 3s
Parallel Phase #:72 [orcl] Files:2 Time: 5s
Serial Phase #:73 [orcl] Files:2 Time: 4s
***************** Upgrading SDO ****************
Restart Phase #:74 [orcl] Files:1 Time: 4s
Serial Phase #:76 [orcl] Files:1 Time: 38s
Serial Phase #:77 [orcl] Files:2 Time: 5s
Restart Phase #:78 [orcl] Files:1 Time: 4s
Serial Phase #:79 [orcl] Files:1 Time: 20s
Restart Phase #:80 [orcl] Files:1 Time: 2s
Parallel Phase #:81 [orcl] Files:3 Time: 53s
Restart Phase #:82 [orcl] Files:1 Time: 3s
Serial Phase #:83 [orcl] Files:1 Time: 8s
Restart Phase #:84 [orcl] Files:1 Time: 3s
Serial Phase #:85 [orcl] Files:1 Time: 13s
Restart Phase #:86 [orcl] Files:1 Time: 3s
Parallel Phase #:87 [orcl] Files:4 Time: 93s
Restart Phase #:88 [orcl] Files:1 Time: 4s
Serial Phase #:89 [orcl] Files:1 Time: 4s
Restart Phase #:90 [orcl] Files:1 Time: 2s
Serial Phase #:91 [orcl] Files:2 Time: 14s
Restart Phase #:92 [orcl] Files:1 Time: 3s
Serial Phase #:93 [orcl] Files:1 Time: 3s
Restart Phase #:94 [orcl] Files:1 Time: 2s
******* Upgrading ODM, WK, EXF, RUL, XOQ *******
Serial Phase #:95 [orcl] Files:1 Time: 26s
Restart Phase #:96 [orcl] Files:1 Time: 4s
*********** Final Component scripts ***********
Serial Phase #:97 [orcl] Files:1 Time: 4s
************* Final Upgrade scripts ************
Serial Phase #:98 [orcl] Files:1 Time: 426s
******************* Migration ******************
Serial Phase #:99 [orcl] Files:1 Time: 43s
*** End PDB Application Upgrade Pre-Shutdown ***
Serial Phase #:100 [orcl] Files:1 Time: 2s
Serial Phase #:101 [orcl] Files:1 Time: 0s
Serial Phase #:102 [orcl] Files:1 Time: 47s
***************** Post Upgrade *****************
Serial Phase #:103 [orcl] Files:1 Time: 37s
**************** Summary report ****************
Serial Phase #:104 [orcl] Files:1 Time: 3s
*** End PDB Application Upgrade Post-Shutdown **
Serial Phase #:105 [orcl] Files:1 Time: 2s
Serial Phase #:106 [orcl] Files:1 Time: 0s
Serial Phase #:107 [orcl] Files:1 Time: 26s
------------------------------------------------------
Phases [0-107] End Time:[2020_03_05 12:09:45]
------------------------------------------------------
Grand Total Time: 2429s
LOG FILES: (/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905/catupgrd*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/19c/db_1/cfgtoollogs/orcl/upgrade20200305112905/upg_summary.log
Grand Total Upgrade Time: [0d:0h:40m:29s]
OS의 oracle 계정에서 dbupgrade 쉘 스크립트를 실행합니다.
작업이 완료되면 자동으로 데이터베이스가 shutdown 됩니다.
{}
IV. 업그레이드 마무리 작업
1. Time Zone 업그레이드
startup upgrade; select * from V$TIMEZONE_FILE; select DBMS_DST.GET_LATEST_TIMEZONE_VERSION from dual;
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 5 13:43:00 2020
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 2097149856 bytes
Fixed Size 8898464 bytes
Variable Size 1342177280 bytes
Database Buffers 738197504 bytes
Redo Buffers 7876608 bytes
Database mounted.
Database opened.
SQL> select * from V$TIMEZONE_FILE;
FILENAME VERSION CON_ID
-------------------- ---------- ----------
timezlrg_14.dat 14 0
SQL> select DBMS_DST.GET_LATEST_TIMEZONE_VERSION from dual;
GET_LATEST_TIMEZONE_VERSION
---------------------------
32
업그레이드 윈도우를 시작하기 위해 upgrage 모드로 데이터베이스를 기동합니다.
기존 11g 버전의 time zone 정보와 19c 엔진에 설치된 최신 버전의 time zone 정보를 확인합니다.
SET SERVEROUTPUT ON; exec DBMS_DST.BEGIN_PREPARE(DBMS_DST.GET_LATEST_TIMEZONE_VERSION); exec DBMS_DST.FIND_AFFECTED_TABLES; select * from SYS.DST$AFFECTED_TABLES; select * from SYS.DST$ERROR_TABLE; select * from SYS.DST$TRIGGER_TABLE; exec DBMS_DST.END_PREPARE;
SQL> SET SERVEROUTPUT ON; SQL> exec DBMS_DST.BEGIN_PREPARE(DBMS_DST.GET_LATEST_TIMEZONE_VERSION); A prepare window has been successfully started. PL/SQL procedure successfully completed. SQL> exec DBMS_DST.FIND_AFFECTED_TABLES; PL/SQL procedure successfully completed. SQL> select * from SYS.DST$AFFECTED_TABLES; no rows selected SQL> select * from SYS.DST$ERROR_TABLE; no rows selected SQL> select * from SYS.DST$TRIGGER_TABLE; no rows selected SQL> exec DBMS_DST.END_PREPARE; A prepare window has been successfully ended. PL/SQL procedure successfully completed.
업그레이드에 앞서 영향을 받을만한 테이블(TIMESTAMP WITH TIME ZONE 사용 컬럼이 있는 테이블)이 있는지 조회합니다.
exec DBMS_DST.BEGIN_UPGRADE(DBMS_DST.GET_LATEST_TIMEZONE_VERSION); shutdown immediate startup
SQL> exec DBMS_DST.BEGIN_UPGRADE(DBMS_DST.GET_LATEST_TIMEZONE_VERSION); An upgrade window has been successfully started. PL/SQL procedure successfully completed. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 2097149856 bytes Fixed Size 8898464 bytes Variable Size 1342177280 bytes Database Buffers 738197504 bytes Redo Buffers 7876608 bytes Database mounted. Database opened.
최신 버전의 time zone으로 업그레이드를 시작합니다.
업그레이드 윈도우를 시작하고, 본격적인 업그레이드를 수행하기 위해 데이터베이스를 normal 모드로 재기동합니다.
SET SERVEROUTPUT ON;
DECLARE
failed_num PLS_INTEGER;
BEGIN
DBMS_DST.UPGRADE_DATABASE(failed_num);
DBMS_OUTPUT.PUT_LINE('DBMS_DST.UPGRADE_DATABASE : ' || failed_num);
END;
/
SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
2 failed_num PLS_INTEGER;
3 BEGIN
4 DBMS_DST.UPGRADE_DATABASE(failed_num);
5 DBMS_OUTPUT.PUT_LINE('DBMS_DST.UPGRADE_DATABASE : ' || failed_num);
6 END;
7 /
Table list: "MDSYS"."SDO_DIAG_MESSAGES_TABLE"
Number of failures: 0
Table list: "IX"."AQ$_STREAMS_QUEUE_TABLE_S"
Number of failures: 0
Table list: "IX"."AQ$_ORDERS_QUEUETABLE_S"
Number of failures: 0
Table list: "IX"."AQ$_STREAMS_QUEUE_TABLE_L"
Number of failures: 0
Table list: "IX"."AQ$_ORDERS_QUEUETABLE_L"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_FEEDBACK"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_FEEDBACK_FOLLOWUP"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_ACTIVITY_LOG1$"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_ACTIVITY_LOG2$"
Number of failures: 0
Table list: "APEX_180200"."WWV_QS_RANDOM_NAMES"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_DEBUG_MESSAGES2"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_WORKSHEET_NOTIFY"
Number of failures: 0
Table list: "APEX_180200"."WWV_FLOW_DEBUG_MESSAGES"
Number of failures: 0
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_S"
Number of failures: 0
Table list: "GSMADMIN_INTERNAL"."AQ$_CHANGE_LOG_QUEUE_TABLE_L"
Number of failures: 0
DBMS_DST.UPGRADE_DATABASE : 0
PL/SQL procedure successfully completed.
데이터베이스의 Time Zone을 업그레이드 합니다.
SET SERVEROUTPUT ON;
DECLARE
failed_num PLS_INTEGER;
BEGIN
DBMS_DST.END_UPGRADE(failed_num);
DBMS_OUTPUT.PUT_LINE('DBMS_DST.END_UPGRADE : ' || failed_num);
END;
/
SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
2 failed_num PLS_INTEGER;
3 BEGIN
4 DBMS_DST.END_UPGRADE(failed_num);
5 DBMS_OUTPUT.PUT_LINE('DBMS_DST.END_UPGRADE : ' || failed_num);
6 END;
7 /
An upgrade window has been successfully ended.
DBMS_DST.END_UPGRADE : 0
PL/SQL procedure successfully completed.
Time zone 업그레이드에서 오류가 없었다면, 작업을 종료합니다.
select PROPERTY_NAME, PROPERTY_VALUE from DATABASE_PROPERTIES where PROPERTY_NAME like 'DST_%' order by PROPERTY_NAME;
SQL> select PROPERTY_NAME, PROPERTY_VALUE 2 from DATABASE_PROPERTIES 3 where PROPERTY_NAME like 'DST_%' 4 order by PROPERTY_NAME; PROPERTY_NAME PROPERTY_VALUE ------------------------------ -------------------- DST_PRIMARY_TT_VERSION 32 DST_SECONDARY_TT_VERSION 0 DST_UPGRADE_STATE NONE
업그레이드 결과를 SQL로 확인할 수 있습니다.
2. 심볼릭 링크 디렉토리 정리
SET SERVEROUTPUT ON; @?/rdbms/admin/utldirsymlink.sql
SQL> SET SERVEROUTPUT ON; SQL> @?/rdbms/admin/utldirsymlink.sql No DIRECTORY OBJECTS with symlinks found. PL/SQL procedure successfully completed. No errors.
심볼릭 링크로 생성된 경로를 사용하는 디렉토리 객체가 있는지 검토합니다.
19c 버전에서는 지원하지 않는 기능이므로 해당되는 디렉토리가 있다면 대체 경로로 재생성해줘야 합니다.
3. Fixed Objects 통계 수집
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
SQL> EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS; PL/SQL procedure successfully completed.
데이터베이스의 성능을 고려하여 x$ 테이블과 인덱스에 대한 통계 정보를 수집합니다.
4. postupgrade_fixups 실행
SET ECHO ON; SET SERVEROUTPUT ON; @/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
SQL> SET ECHO ON;
SQL> SET SERVEROUTPUT ON;
SQL> @/u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql
SQL> REM
SQL> REM Oracle POST-Upgrade Fixup Script
SQL> REM
SQL> REM Auto-Generated by: Oracle Preupgrade Script
SQL> REM Version: 19.0.0.0.0 Build: 1
SQL> REM Generated on: 2020-03-05 11:13:39
SQL> REM
SQL> REM Source Database: ORCL
SQL> REM Source Database Version: 11.2.0.4.0
SQL> REM For Upgrade to Version: 19.0.0.0.0
SQL> REM
SQL>
SQL> REM
SQL> REM Setup Environment
SQL> REM
SQL> SET ECHO OFF SERVEROUTPUT ON FORMAT WRAPPED TAB OFF LINESIZE 200;
Session altered.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Package created.
No errors.
Package body created.
PL/SQL procedure successfully completed.
No errors.
Package created.
No errors.
Package body created.
No errors.
Executing Oracle POST-Upgrade Fixup Script
Auto-Generated by: Oracle Preupgrade Script
Version: 19.0.0.0.0 Build: 1
Generated on: 2020-03-05 11:13:39
For Source Database: ORCL
Source Database Version: 11.2.0.4.0
For Upgrade to Version: 19.0.0.0.0
Preup Preupgrade
Action Issue Is
Number Preupgrade Check Name Remedied Further DBA Action
------ ------------------------ ---------- --------------------------------
6. depend_usr_tables YES None.
7. old_time_zones_exist YES None.
8. dir_symlinks YES None.
9. post_dictionary YES None.
10. post_fixed_objects NO Informational only.
Further action is optional.
11. upg_by_std_upgrd YES None.
The fixup scripts have been run and resolved what they can. However,
there are still issues originally identified by the preupgrade that
have not been remedied and are still present in the database.
Depending on the severity of the specific issue, and the nature of
the issue itself, that could mean that your database upgrade is not
fully complete. To resolve the outstanding issues, start by reviewing
the postupgrade_fixups.sql and searching it for the name of
the failed CHECK NAME or Preupgrade Action Number listed above.
There you will find the original corresponding diagnostic message
from the preupgrade which explains in more detail what still needs
to be done.
PL/SQL procedure successfully completed.
Session altered.
마지막으로 postupgrade_fixups.sql 스크립트를 수행합니다.
업그레이드 이후에 별도의 조치가 필요한 에러, 경고 또는 정보를 출력합니다.
{}
{}