Oracle 19c自动升级实用程序(第2部分)

发布于:2021-02-08 15:52:20

0

261

0

Oracle Oracle 19c 自动升级 数据库

在AutoUpgrade 19c第1部分中,我们以分析模式执行AutoUpgrade,对数据库执行只读检查,并返回一个报告,其中突出显示了数据库升级中可能出现的任何警告或潜在错误,并提供了一些建议。

在修复模式下执行自动升级时,它会执行在分析模式下也会执行的检查,完成这些检查后,自动升级会在升级开始前执行修复早期版本源数据库所需的所有自动修复任务。

请注意,在修复模式下运行时,自动升级不会创建还原点(这仅在升级模式下完成)–因此建议在修复模式下运行自动升级之前进行备份或创建手动GRP。

在prechecks文件夹中,将存在SID_checklist.cfg文件,该文件将包含要执行的预检查以及针对该预检查存在相应修复程序的文件。

dbname]          [DB1]
==========================================
[container]          [DB1]
==========================================
[checkname]          DICTIONARY_STATS
[stage]              PRECHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           RECOMMEND
----------------------------------------------------

[checkname]          POST_DICTIONARY
[stage]              POSTCHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           RECOMMEND
----------------------------------------------------

[checkname]          POST_FIXED_OBJECTS
[stage]              POSTCHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           RECOMMEND
----------------------------------------------------

[checkname]          PRE_FIXED_OBJECTS
[stage]              PRECHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           RECOMMEND
----------------------------------------------------

[checkname]          OLD_TIME_ZONES_EXIST
[stage]              POSTCHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           WARNING
----------------------------------------------------

[checkname]          PARAMETER_MIN_VAL
[stage]              PRECHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           WARNING
----------------------------------------------------

[checkname]          MANDATORY_UPGRADE_CHANGES
[stage]              PRECHECKS
[fixup_available]    YES
[runfix]             YES
[severity]           INFO
----------------------------------------------------

[checkname]          RMAN_RECOVERY_VERSION
[stage]              PRECHECKS
[fixup_available]    NO
[runfix]             N/A
[severity]           INFO
----------------------------------------------------

[checkname]          TABLESPACES_INFO
[stage]              PRECHECKS
[fixup_available]    NO
[runfix]             N/A
[severity]           INFO
----------------------------------------------------

在固定模式下执行自动升级

[oracle@host02 bin]$ $ORACLE_HOME/jdk/bin/java -jar /home/oracle/autoupgrade.jar -config /tmp/config.txt -mode fixups
Autoupgrade tool launched with default options
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
2 databases will be processed
Type 'help' to list console commands
upg> lsj
+----+-------+---------+---------+--------+--------------+--------+--------+---------------+
|Job#|DB_NAME|    STAGE|OPERATION|  STATUS|    START_TIME|END_TIME| UPDATED|        MESSAGE|
+----+-------+---------+---------+--------+--------------+--------+--------+---------------+
| 106|    DB1|PRECHECKS|PREPARING| RUNNING|19/06/10 18:37|     N/A|18:37:07|Loading DB info|
| 107|    DB2|    SETUP|PREPARING|FINISHED|19/06/10 18:37|     N/A|18:37:06|      Scheduled|
+----+-------+---------+---------+--------+--------------+--------+--------+---------------+
Total jobs 2

upg> status
---------------- Config -------------------
User configuration file    [/tmp/config.txt]
General logs location      [/u02/app/oracle/autoupgrade        # Top level logging directory (Required)/cfgtoollogs/upgrade/auto]
Mode                       [FIXUPS]
DB upg fatal errors        ORA-00600,ORA-07445
DB Post upgrade abort time [60] minutes
DB upg abort time          [1440] minutes
DB restore abort time      [120] minutes
DB drop GRP abort time     [3] minutes
------------------------ Jobs ------------------------
Total databases in configuration file [2]
Total Non-CDB being processed         [2]
Total CDB being processed             [0]
Jobs finished successfully            [0]
Jobs finished/aborted                 [0]
jobs in progress                      [2]
------------ Resources ----------------
Threads in use                        [19]
JVM used memory                       [26] MB
CPU in use                            [13%]
Processes in use                      [19]

upg> tasks
+---+--------------+-------------+
| ID|          NAME|         Job#|
+---+--------------+-------------+
|  1|          main|      WAITING|
| 30|      jobs_mon|      WAITING|
| 31|       console|     RUNNABLE|
| 32|  queue_reader|      WAITING|
| 33|         cmd-0|      WAITING|
| 44| job_manager-0|      WAITING|
| 47|    event_loop|TIMED_WAITING|
| 48|    bqueue-106|      WAITING|
| 49|    checks-106|      WAITING|
| 50|rep_checks-106|TIMED_WAITING|
|104|    db1-puic-0|      WAITING|
|105|    db1-puic-1|      WAITING|
|169|      quickSQL|     RUNNABLE|
|171|      quickSQL|     RUNNABLE|

+---+--------------+-------------+
upg> lsj
+----+-------+---------+---------+--------+--------------+--------+--------+---------+
|Job#|DB_NAME|    STAGE|OPERATION|  STATUS|    START_TIME|END_TIME| UPDATED|  MESSAGE|
+----+-------+---------+---------+--------+--------------+--------+--------+---------+
| 106|    DB1|PREFIXUPS|EXECUTING| RUNNING|19/06/10 18:37|     N/A|18:37:34|         |
| 107|    DB2|    SETUP|PREPARING|FINISHED|19/06/10 18:37|     N/A|18:37:06|Scheduled|
+----+-------+---------+---------+--------+--------------+--------+--------+---------+
Total jobs 2

upg> lsj
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
|Job#|DB_NAME|    STAGE|OPERATION|  STATUS|    START_TIME|END_TIME| UPDATED|      MESSAGE|
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
| 106|    DB1|PREFIXUPS|EXECUTING| RUNNING|19/06/10 18:37|     N/A|18:37:42|Remaining 5/5|
| 107|    DB2|    SETUP|PREPARING|FINISHED|19/06/10 18:37|     N/A|18:37:06|    Scheduled|
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
Total jobs 2

upg> lsj
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
|Job#|DB_NAME|    STAGE|OPERATION|  STATUS|    START_TIME|END_TIME| UPDATED|      MESSAGE|
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
| 106|    DB1|PREFIXUPS|EXECUTING| RUNNING|19/06/10 18:37|     N/A|18:37:42|Remaining 5/5|
| 107|    DB2|    SETUP|PREPARING|FINISHED|19/06/10 18:37|     N/A|18:37:06|    Scheduled|
+----+-------+---------+---------+--------+--------------+--------+--------+-------------+
Total jobs 2

upg> Job 106 completed
Job 107 completed
------------------- Final Summary --------------------
Number of databases            [ 2 ]

Jobs finished successfully     [2]
Jobs failed                    [0]
Jobs pending                   [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 106 FOR DB1
Job 107 FOR DB2

[oracle@host02 bin]$


如果我们查询最后一个u分析的列,我们可以看到数据字典统计是最新的,并且是由执行的自动升级修复作业收集的。

SQL> select max(last_analyzed) from dba_tables where owner='SYS'
 2  and table_name='ACCESS$';

MAX(LAST_
---------
10-JUN-19


SQL> prompt 'Statistics for Fixed Objects'
select NVL(TO_CHAR(last_analyzed, 'YYYY-Mon-DD'), 'NO STATS') last_analyzed, COUNT(*) fixed_objects
FROM dba_tab_statistics
WHERE object_type = 'FIXED TABLE'
GROUP BY TO_CHAR(last_analyzed, 'YYYY-Mon-DD')
ORDER BY 1 DESC;

SQL> 'Statistics for Fixed Objects'

LAST_ANALYZED FIXED_OBJECTS
------------- -------------
NO STATS 152
2019-Jun-10       1137