ORACLE 12c GRID VE DATABASE UPGRADE 18C

yum install -y oracle-database-preinstall-18c
yum update

mkdir -p /u01/app/18.0.0.0/grid
mkdir -p /u01/app/oracle/product/18.0.0.0/db
chown -R oracle:oinstall /u01/app/18.0.0.0/grid
chown -R oracle:oinstall /u01/app/oracle/product/18.0.0.0/db
chmod -R 775 /u01/app/18.0.0.0/grid
chmod -R 775 /u01/app/oracle/product/18.0.0.0/db

su - oracle
. .bash_profile
. .grid
crsctl stat res  -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       ol6                      STABLE
ora.FRA.dg
               ONLINE  ONLINE       ol6                      STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       ol6                      STABLE
ora.asm
               ONLINE  ONLINE       ol6                      Started,STABLE
ora.ons
               OFFLINE OFFLINE      ol6                      STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ol6                      STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       ol6                      STABLE
ora.orcl.db
      1        ONLINE  ONLINE       ol6                      Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             .1/db,STABLE
--------------------------------------------------------------------------------


srvctl status database -d orcl
 
Database is running.

 crsctl query has releaseversion

Oracle High Availability Services release version on the local node is [12.2.0.1.0]

 crsctl query has softwareversion

Oracle High Availability Services version on the local node is [12.2.0.1.0]

12c grid dizini altında

./runcluvfy.sh
Çikti

This tool sets up the environment needed to run the 'cluvfy' utility
and then runs the 'cluvfy' utility with the options specified.
Please see the 'cluvfy' documentation for further details.

Usage:
  /u01/app/18.0.0.0/grid/runcluvfy.sh <cluvfy command options> [-logdir <dir>]

  -logdir <dir>: Path of directory where log trace will be generated.
Usage:

Verifying Physical Memory ...PASSED
Verifying Available Physical Memory ...PASSED
Verifying Swap Size ...FAILED (PRVF-7573)
Verifying Free Space: ol6:/usr,ol6:/var,ol6:/etc,ol6:/sbin,ol6:/tmp ...PASSED
Verifying User Existence: oracle ...
Verifying Users With Same UID: 54321 ...PASSED
Verifying User Existence: oracle ...PASSED
Verifying Group Existence: dba ...PASSED
Verifying Group Membership: dba ...PASSED
Verifying Run Level ...PASSED
Verifying Architecture ...PASSED
Verifying OS Kernel Version ...PASSED
Verifying OS Kernel Parameter: semmsl ...PASSED
Verifying OS Kernel Parameter: semmns ...PASSED
Verifying OS Kernel Parameter: semopm ...PASSED
Verifying OS Kernel Parameter: semmni ...PASSED
Verifying OS Kernel Parameter: shmmax ...PASSED
Verifying OS Kernel Parameter: shmmni ...PASSED
Verifying OS Kernel Parameter: shmall ...PASSED
Verifying OS Kernel Parameter: file-max ...PASSED
Verifying OS Kernel Parameter: ip_local_port_range ...PASSED
Verifying OS Kernel Parameter: rmem_default ...PASSED
Verifying OS Kernel Parameter: rmem_max ...PASSED
Verifying OS Kernel Parameter: wmem_default ...PASSED
Verifying OS Kernel Parameter: wmem_max ...PASSED
Verifying OS Kernel Parameter: aio-max-nr ...PASSED
Verifying OS Kernel Parameter: panic_on_oops ...PASSED
Verifying Package: binutils-2.20.51.0.2 ...PASSED
Verifying Package: compat-libcap1-1.10 ...PASSED
Verifying Package: compat-libstdc++-33-3.2.3 (x86_64) ...PASSED
Verifying Package: libgcc-4.4.7 (x86_64) ...PASSED
Verifying Package: libstdc++-4.4.7 (x86_64) ...PASSED
Verifying Package: libstdc++-devel-4.4.7 (x86_64) ...PASSED
Verifying Package: sysstat-9.0.4 ...PASSED
Verifying Package: ksh ...PASSED
Verifying Package: make-3.81 ...PASSED
Verifying Package: glibc-2.12 (x86_64) ...PASSED
Verifying Package: glibc-devel-2.12 (x86_64) ...PASSED
Verifying Package: libaio-0.3.107 (x86_64) ...PASSED
Verifying Package: libaio-devel-0.3.107 (x86_64) ...PASSED
Verifying Package: nfs-utils-1.2.3-15 ...PASSED
Verifying Package: e2fsprogs-1.41.12 ...PASSED
Verifying Package: e2fsprogs-libs-1.41.12 (x86_64) ...PASSED
Verifying Package: smartmontools-5.43-1 ...PASSED
Verifying Package: net-tools-1.60-110 ...PASSED
Verifying Users With Same UID: 0 ...PASSED
Verifying Current Group ID ...PASSED
Verifying Root user consistency ...PASSED

Pre-check for Oracle Restart configuration was unsuccessfull

Failures were encountered during execution of CVU verification request "stage -pre hacfg".

Verifying Swap Size ...FAILED
ol6: PRVF-7573 : Sufficient swap size is not available on node "ol6" [Required
     = 16GB (1.6777216E7KB) ; Found = 7.8516GB (8232956.0KB)]

Swap alanının yetersiz olduğunu söylüyor bu bizim upgrade işlemini etkileyecek bir problem değil, upgrade işlemine geçebiliriz.

cd /u01/app/18.0.0.0/grid
./gridInstal.sh
This test checks that the Oracle patch “27006180” has been applied in home “/u01/app/oracle/12.2.0.1/grid”. (more details)

Bu hatayı düzeltmek için –“27006180” patch dosyasi indirildi 12c grid dizini altındaki OPatch içerisinde

./opatchauto apply /u01/patch/27006180/

patch uygulandıktan sonra upgrade işleminde bu hata alınmayacak

Daha sonrasında 12c database i 18c ye upgrade işlemine geçeciğiz bunun için öncelikle 18c sofware ini kuruyoruz.

cd /u01/app/oracle/product/18.0.0.0/db
./runInstaller

Kurrlum başarı ile tamamlandıktan sonra Upgrade işlemine geçiyoruz

cd /u01/app/oracle/product/18.0.0.0/db/rdbms/admin

java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

. .bash_profile
. .db
java -jar preupgrade.jar TERMINAL

Çıktı

Report generated by Oracle Database Pre-Upgrade Information Tool Version
18.0.0.0.0 on 2019-11-08T09:48:07

Upgrade-To version: 18.0.0.0.0

=======================================
Status of the database prior to upgrade
=======================================
      Database Name:  ORCL
     Container Name:  ORCL
       Container ID:  0
            Version:  12.2.0.1.0
         Compatible:  12.2.0.0
          Blocksize:  8192
           Platform:  Linux x86 64-bit
      Timezone File:  26
  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
  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 18.0.0.0.0 ORACLE HOME.

       Parameter                                 Currently  18.0.0.0.0 minimum
       ---------                                 ---------  ------------------
       processes                                       200                 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.  Run 12.2.0.1.0 $ORACLE_HOME/rdbms/admin/utlrp.sql to recompile invalid
      objects.  You can view the individual invalid objects with

        SET SERVEROUTPUT ON;
        EXECUTE DBMS_PREUP.INVALID_OBJECTS;

      93 objects are INVALID.

      There should be no INVALID objects in SYS/SYSTEM or user schemas before
      database upgrade.

  3.  Review and remove any unnecessary HIDDEN/UNDERSCORE parameters.

      The database contains the following initialization parameters whose name
      begins with an underscore:

      _min_sys_process
      _rac_dbtype_reset

      Remove hidden parameters before database upgrade unless your application
      vendors and/or Oracle Support state differently.  Changes will need to be
      made in the pfile/spfile.

  4.  (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 12.2.0.1
      Oracle Database SQL Tuning Guide.

  INFORMATION ONLY
  ================
  5.  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
      ----------                     ----------  -----------
      SYSTEM                            1090 MB      1524 MB

      Minimum tablespace sizes for upgrade are estimates.

  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.  Upgrade the database time zone file using the DBMS_DST package.

      The database is using time zone file version 26 and the target 18.0.0.0.0
      release ships with time zone file version 31.

      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 18.0.0.0.0 Oracle Database
      Globalization Support Guide.

  7.  (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.

  8.  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 12.2.0.1
      Oracle Database SQL Tuning Guide.

  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: 2019-11-08T09:48:07

Çıktı incelinip içerisindeki adımlar ve uyarılar yapılandırılır.

Upgrade edilecek olan db ortam değişkenleri set edilir

. .profile_all
. .profile_db
dbua

Yükseltme işleminin başarısız olması ve 12.2 DB’ye geri dönmesi durumunda kurtarma seçeneğini belirtin.

işlem biitkten sonra preupgrade işleminde upgrade den sonra çalıstırılacak olan

 SQL>@/u01/app/oracle/cfgtoollogs/ORCL/preupgrade/postupgrade_fixups.sql
select con_id,comp_name,status,version,version_full from cdb_registry order by 1,2;

   CON_ID COMP_NAME                           STATUS       VERSION         VERSION_FULL
---------- ----------------------------------- ------------ --------------- ---------------
         1 Oracle Database Catalog Views       VALID        18.0.0.0.0      18.3.0.0.0
         1 Oracle Database Packages and Types  VALID        18.0.0.0.0      18.3.0.0.0
         1 Oracle Real Application Clusters    OPTION OFF   18.0.0.0.0      18.3.0.0.0
         1 Oracle Text                         VALID        18.0.0.0.0      18.3.0.0.0
         1 Oracle Workspace Manager            VALID        18.0.0.0.0      18.3.0.0.0
         1 Oracle XML Database                 VALID        18.0.0.0.0      18.3.0.0.0
         3 Oracle Database Catalog Views       VALID        18.0.0.0.0      18.3.0.0.0
         3 Oracle Database Packages and Types  VALID        18.0.0.0.0      18.3.0.0.0
         3 Oracle Real Application Clusters    OPTION OFF   18.0.0.0.0      18.3.0.0.0
         3 Oracle Text                         VALID        18.0.0.0.0      18.3.0.0.0
         3 Oracle Workspace Manager            VALID        18.0.0.0.0      18.3.0.0.0
         3 Oracle XML Database                 VALID        18.0.0.0.0      18.3.0.0.0

SQL> select * from v$timezone_file;

FILENAME                VERSION     CON_ID
-------------------- ---------- ----------
timezlrg_31.dat              31          0

SQL> alter system set compatible='18.0.0.0.0' scope=spfile;
shutdown immediate;

SQL> alter diskgroup FRA SET attribute 'compatible.asm'='18.0.0.0.0';
SQL> alter diskgroup DATA  SET attribute 'compatible.asm'='18.0.0.0.0';
SQL> alter diskgroup fra set attribute 'compatible.rdbms'='18.0.0.0.0';
SQL> alter diskgroup data set attribute 'compatible.rdbms'='18.0.0.0.0';

SQL> select g.name,a.name,a.value from v$asm_diskgroup g, v$asm_attribute a where g.group_number=a.group_number and a.name like '%compat%';

NAME                 NAME                 VALUE
-------------------- -------------------- --------------------
DATA                 compatible.asm       18.0.0.0.0
DATA                 compatible.rdbms     18.0.0.0.0
FRA                  compatible.asm       18.0.0.0.0
FRA                  compatible.rdbms     18.0.0.0.0