Tags

11g (5) 12c (6) 18c (3) 19c (4) ASM (1) Critical Patch (11) Data Pump (1) Dataguard (9) Diverse (3) GRID (7) GitLab (2) Linux (8) OEM (2) ORA Errors (13) Oracle (12) RMAN (4)
Showing posts with label 18c. Show all posts
Showing posts with label 18c. Show all posts

Saturday, December 28, 2019

Upgrade Oracle Grid from 18c to 19c


Upgrade Oracle Grid from 18c to 19c

Upgrade oracle grid infrastructure to 19C

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment. 

Upgrading Grid to 19c

You need to download following file:
LINUX.X64_193000_grid_home.zip

STEP 1 Grid Upgrade:

Oracle Grid upgrade from 18c to 19c
Preparation:
Keep following detail for later

srvctl config asm
ASM home: <CRS home>
Password file: +DATA/orapwasm
Backup of Password file:
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.259.1019395497
ASM diskgroup discovery string: /dev/sd*

Stop ASM, Database and Listener:
This command is related to the pluggable DB. If you do not have Multitenant DB then you don’t need to use following command.
alter pluggable database KARDBPDB close immediate;
srvctl status database -d KARDBPRD
Database is running.
srvctl stop database -d KARDBPRD

srvctl status  listener -l LISTENER
srvctl stop listener -l LISTENER

srvctl status asm
ASM is running on kardbprd.us.com
srvctl stop asm -f

crsctl stop has <<== no need to stop Clusterware
crsctl stat res –t

Create NEW directory for NEW Grid home:
Unzip the LINUX.X64_193000_grid_home.zip in the new $GRID_HOME
unzip LINUX.X64_193000_grid_home.zip -d /oracle/app/home/product/19.0.0/grid_19

Precheck Tasks:

/oracle/app/home/product/19.0.0/grid_19/runcluvfy.sh stage -pre hacfg
Verifying Physical Memory ...PASSED
Verifying Available Physical Memory ...PASSED
Verifying Swap Size ...PASSED
Verifying Free Space: kardbprd.us.com:/usr,kardbprd.us.com:/var,kardbprd.us.com:/etc,kardbprd.us.com:/sbin,kardbprd.us.com:/tmp ...PASSED
Verifying User Existence: oracle ...
  Verifying Users With Same UID: 1001 ...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 Package: kmod-20-21 (x86_64) ...PASSED
Verifying Package: kmod-libs-20-21 (x86_64) ...PASSED
Verifying Package: binutils-2.23.52.0.1 ...PASSED
Verifying Package: compat-libcap1-1.10 ...PASSED
Verifying Package: libgcc-4.8.2 (x86_64) ...PASSED
Verifying Package: libstdc++-4.8.2 (x86_64) ...PASSED
Verifying Package: libstdc++-devel-4.8.2 (x86_64) ...PASSED
Verifying Package: sysstat-10.1.5 ...PASSED
Verifying Package: gcc-c++-4.8.2 ...PASSED
Verifying Package: ksh ...PASSED
Verifying Package: make-3.82 ...PASSED
Verifying Package: glibc-2.17 (x86_64) ...PASSED
Verifying Package: glibc-devel-2.17 (x86_64) ...PASSED
Verifying Package: libaio-0.3.109 (x86_64) ...PASSED
Verifying Package: libaio-devel-0.3.109 (x86_64) ...PASSED
Verifying Package: nfs-utils-1.2.3-15 ...PASSED
Verifying Package: smartmontools-6.2-4 ...PASSED
Verifying Package: net-tools-2.0-0.17 ...PASSED
Verifying Package: compat-libstdc++-33-3.2.3 (x86_64) ...PASSED
Verifying Package: libxcb-1.11 (x86_64) ...PASSED
Verifying Package: libX11-1.6.3 (x86_64) ...PASSED
Verifying Package: libXau-1.0.8 (x86_64) ...PASSED
Verifying Package: libXi-1.7.4 (x86_64) ...PASSED
Verifying Package: libXtst-1.2.2 (x86_64) ...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 successful.

CVU operation performed:      stage -pre hacfg
Date:                         Dec 10, 2019 11:18:20 AM
CVU home:                     /oracle/app/home/product/19.0.0/grid_19/
User:                         oracle

Starting with Upgrade:
I am using MobaXterm for X display.
export DISPLAY=xxx.xx.xx.xx:0.0
unset ORACLE_BASE
unset ORACLE_HOME
unset ORACLE_SID

./gridSetup.sh
Chose following options:
=>> Upgrade Oracle Grid Infrastructure
=>> uncheck --Register with Enterprise Manager (EM) Cloud Control
=>> Oracle base: /oracle/app/home (keep the same)
=>> uncheck --Automatically run configuration script
=>> Submit
=>> execute following script as root user:
/oracle/app/home/product/19.0.0/grid_19/rootupgrade.sh

Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /oracle/app/home/product/19.0.0/grid_19

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /oracle/app/home/product/19.0.0/grid_19/crs/install/crsconfig_params
The log of current session can be found at:
  /oracle/app/home/crsdata/kardbprd.us.com/crsconfig/roothas_2019-12-10_11-31-34AM.log
2019/12/10 11:31:35 CLSRSC-595: Executing upgrade step 1 of 12: 'UpgPrechecks'.
2019/12/10 11:31:38 CLSRSC-595: Executing upgrade step 2 of 12: 'GetOldConfig'.
2019/12/10 11:31:40 CLSRSC-595: Executing upgrade step 3 of 12: 'GenSiteGUIDs'.
2019/12/10 11:31:40 CLSRSC-595: Executing upgrade step 4 of 12: 'SetupOSD'.
2019/12/10 11:31:40 CLSRSC-595: Executing upgrade step 5 of 12: 'PreUpgrade'.

ASM has been upgraded and started successfully.

2019/12/10 11:32:56 CLSRSC-595: Executing upgrade step 6 of 12: 'UpgradeAFD'.
2019/12/10 11:32:57 CLSRSC-595: Executing upgrade step 7 of 12: 'UpgradeOLR'.
clscfg: EXISTING configuration version 0 detected.
Creating OCR keys for user 'oracle', privgrp 'dba'..
Operation successful.
2019/12/10 11:33:01 CLSRSC-595: Executing upgrade step 8 of 12: 'UpgradeOCR'.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node kardbprd.us.com successfully pinned.
2019/12/10 11:33:03 CLSRSC-595: Executing upgrade step 9 of 12: 'CreateOHASD'.
2019/12/10 11:33:04 CLSRSC-595: Executing upgrade step 10 of 12: 'ConfigOHASD'.
2019/12/10 11:33:05 CLSRSC-329: Replacing Clusterware entries in file 'oracle-ohasd.service'
2019/12/10 11:33:50 CLSRSC-595: Executing upgrade step 11 of 12: 'UpgradeSIHA'.

kardbprd.us.com     2019/12/10 11:34:50     /oracle/app/home/crsdata/kardbprd.us.com/olr/backup_20191210_113450.olr     724960844

kardbprd.us.com     2019/09/19 13:17:50     /oracle/app/home/product/18.0.0/grid_18/cdata/kardbprd.us.com/backup_20190919_131750.olr     70732493
2019/12/10 11:34:50 CLSRSC-595: Executing upgrade step 12 of 12: 'InstallACFS'.
2019/12/10 11:37:47 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

I just want to make sure that everything works properly after upgrade. I am going stop everything and will start again.
srvctl status asm
crsctl stat res -t
srvctl stop asm -f
crsctl stop has
crsctl start has
srvctl start asm

Adjust the location and any parameter required in the tnsnames.ora file
srvctl stop listener -l LISTENER
srvctl start listener -l LISTENER

Stop/Start DB from the DB_HOME
srvctl stop database -d KARDBPRD
srvctl start database -d KARDBPRD

Login into DB and in ASM Instance and verify the standard configurations.


$ sqlplus / as sysasm
SQL*Plus: Release 18.0.0.0.0 - Production on Mon Nov 25 13:38:48 2019
Version 18.3.0.0.0
Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

Check the status of the Pluggable database.

col NAME format a30
col OPEN_TIME format a40
set linesize 200
SELECT NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;
alter pluggable database KARDBPDB open;

This will open all pluggable databases.
alter pluggable database all open;

Stop PDB command:
alter pluggable database KARDBPDB close immediate;
This will close all pluggable databases.
alter pluggable database all close immediate;

Login into ASM Instance and verify the standard configurations.

sqlplus / as sysasm

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 10 12:19:51 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

If You are satisfied with the upgrade and application test then change the compatibility parameter on  ASM disk groups.

col VALUE format a30;
col COMPATIBILITY form a10
col DATABASE_COMPATIBILITY form a10
col NAME form a20
select group_number, name, compatibility, database_compatibility from v$asm_diskgroup;
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%';

alter diskgroup DATA SET attribute 'compatible.asm'='19.0.0.0.0';
compatible.rdbms muste be the same as DB.
alter diskgroup DATA set attribute 'compatible.rdbms'='18.0.0.0.0';

Start the Database after ASM compatibility parameters are changed.

Done:

The best person is the one who benefits all human beings. [Prophet Muhammad (PBUH)]

Upgrade Oracle Database from 18c to 19c



Database Upgrade:

Multitenant : Upgrading to Oracle Database 19c

Upgrade Oracle Database from 18c to 19c

PURPOSE: All documents are provided on this Blog just for educational purposes only.  Please make sure that you run it in your test environment before to move on to production environment.

Pretasks:
Login as 18c DB
create pfile='/oracle/download/initDB_18c.ora' from spfile;
NOTE: don't change this parameter keep as it is. You can do later.
*.compatible
Check the current time zone Version.
select * from v$timezone_file;
FILENAME                VERSION     CON_ID
-------------------- ---------- ----------
timezlrg_31.dat              31          0

I am using the GUI for Installation. Just Installing Software.

Create new Oracle_Home directory und unzip the files as follow.
unzip LINUX.X64_193000_grid_home.zip -d /oracle/app/home/product/19.0.0/dbhome_19

Install just Software.


export DISPLAY=xx.xx.xx.xx:0.0
unset ORACLE_BASE
unset ORACLE_HOME
unset ORACLE_SID
./runInstaller

=>> Set Up Software Only
=>> Single Instance database installation
=>> Enterprise Edition
=>> keep the same Oracle Base
=>> chose the group you have.
=>> Keep as it is Uncheck "Automatically run configuration script"
=>> Click on Install

Execute the root script as root user.
/oracle/app/home/product/19.0.0/dbhome_19/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /oracle/app/home/product/19.0.0/dbhome_19

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /oracle/app/home/product/19.0.0/dbhome_19/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

Execute Preupgrade scropt.

/oracle/app/home/product/18.0.0/dbhome_18/jdk/bin/java -jar /oracle/app/home/product/19.0.0/dbhome_19/rdbms/admin/preupgrade.jar FILE TEXT

==================
PREUPGRADE SUMMARY
==================
  /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/preupgrade.log
  /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/preupgrade_fixups.sql
  /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/postupgrade_fixups.sql

Execute fixup scripts across the entire CDB:

Before upgrade:

1. Execute preupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/ -b preup_kardbprd /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/preupgrade_fixups.sql

2. Review logs under /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/

After the upgrade:

1. Execute postupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/ -b postup_kardbprd /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/postupgrade_fixups.sql

2. Review logs under /oracle/app/home/cfgtoollogs/kardbprd/preupgrade/

Preupgrade complete: 2019-12-11T11:59:57

4. Run the preupgrade_fixups.sql script
@/oracle/app/home/product/19.0.0/dbhome_19/rdbms/admin/utlrp.sql
@/oracle/app/home/cfgtoollogs/kardbprd/preupgrade/preupgrade_fixups.sql

Check invalid Objects.
select comp_id,status from dba_registry;

Stop Database.
Since I have Pluggable database. Need to stop as follow.

col NAME format a30
col OPEN_TIME format a40
set linesize 200
SELECT NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;

NAME                           OPEN_MODE  RES OPEN_TIME
------------------------------ ---------- --- -------------------------------------
PDB$SEED                       READ ONLY  NO  10-DEC-19 12.00.07.535 PM +01:00
KARDBPDB                       READ WRITE NO  10-DEC-19 12.08.29.191 PM +01:00

alter pluggable database KARDBPDB close immediate;

SELECT NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;SQL> SQL> SQL>

NAME                           OPEN_MODE  RES OPEN_TIME
------------------------------ ---------- --- -------------------------------------
PDB$SEED                       READ ONLY  NO  10-DEC-19 12.00.07.535 PM +01:00
KARDBPDB                       MOUNTED        11-DEC-19 11.33.32.935 AM +01:00

Shutdown DB
srvctl status database -d KARDBPRD
Database is running.
srvctl stop database -d KARDBPRD

Shutdown Listener.
srvctl status  listener -l LISTENER
srvctl stop listener -l LISTENER

Set the ORACLE_HOME as 19 and login into the DB.
Edit the file initDB_18c.ora which we created earlier and create spfile from pfile.
create spfile from pfile='/oracle/download/initDB_18c.ora';

Start DB in Upgrade mode.

SQL> startup upgrade;
ORACLE instance started.

Total System Global Area 2281700816 bytes
Fixed Size                  9137616 bytes
Variable Size             671088640 bytes
Database Buffers         1593835520 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.

cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl catctl.pl -n 8 catupgrd.sql
...
...
...
------------------------------------------------------
Phases [0-107]         Start Time:[2019_12_11 13:53:48]
Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [CDB$ROOT] Files:1    Time: 17s
...
...
...
Grand Total Upgrade Time:    [0d:0h:47m:10s]

If needed add the new location to the srvcl tools
Add DB to srvctl
srvctl upgrade database -d KARDBPRD -o /oracle/app/home/product/19.0.0/dbhome_19

Execute the postupgrade script and the other command.
@/oracle/app/home/cfgtoollogs/kardbprd/preupgrade/postupgrade_fixups.sql
@$ORACLE_HOME/rdbms/admin/utldirsymlink.sql
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

Edit entry in the /etc/oratab

Updating TZ
Execute following commands:
You need following commands:
@?/rdbms/admin/utltz_countstar.sql
@?/rdbms/admin/utltz_upg_check.sql
@?/rdbms/admin/utltz_upg_apply.sql

SQL> select TZ_VERSION from registry$database;
TZ_VERSION
----------
        32
1 row selected.

SQL> SELECT * FROM v$timezone_file;
FILENAME                VERSION     CON_ID
-------------------- ---------- ----------
timezlrg_32.dat              32          0
1 row selected.

At this point, we are done with the Upgrade steps:

physical standby without duplicate command

physical standby without duplicate command create a physical standby database using RMAN without using duplicate command PURPOSE:   All docu...