Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

mikedietrichde.com

HOL 18c Upgrade – Upgrade your


Database
5-6 minutes

In this part of the Lab you will upgrade the UPGR database
from Oracle 11.2.0.4 to Oracle 18.2.0. You can find detailed
steps including the output for a Multitenant upgrade here for
your information only in case you can’t complete the lab here.

Index

1. Preupgrade

2. Fixing the initUPGR.ora

3. Upgrade

4. Postupgrade and Recompilation

5. Time Zone Change

6. Compatible Change

7. Manual Changes

1. Preupgrade

Execute the preupgrade.jar against the UPGR database.


Execute it in an xterm, then open a 2nd xterm (or tab in the
xterm) with SQL*Plus to run the necessary changes to the
UPGR database.

1 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

. upgr
java -jar $OH18/rdbms/admin/preupgrade.jar TEXT
TERMINAL

The environment variable $OH18 is created only for your


convenience. It points always to the Oracle 18c Home.

Please read the output and follow all advice.

Important: When it says AUTOFIXUP it means the


preupgrade_fixups.sql script will do this task for you.
No manual action required in this case.

Open to the 2nd xterm or an xterm TAB and open


SQL*plus. Execute the necessary steps in the UPGR database
including the preupgrade_fixups.sql as the final step
before shutting down the database. The
preupgrade_fixups.sql script will fix all the AUTOFIXUP
marked messages for you.

. upgr

2 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

sqlplus / as sysdba

The log output of preupgrade.jar asks you to run


olspreupgrade.sql to move the audit table from SYSTEM
to SYS, change parameters and run the
preupgrade_fixups.sql.

@$OH18/rdbms/admin/olspreupgrade.sql
alter system set processes=300 scope=spfile;
alter system set sga_target=1G scope=spfile;
create pfile from spfile;
@/u01/app/oracle/cfgtoollogs/UPGR/preupgrade
/preupgrade_fixups.sql

This run will take a few minutes as dictionary statistics will be


refreshed.

You will see 2x “NO” as result of the


preupgrade_fixups.sql. No worries. Your database is
using the currently loaded SPFILE. Changes to parameters
such as PROCESSES and SGA_TARGET will only take effect
after a restart.

shutdown immediate
exit

2. Fixing the initUPGR.ora

Now you have to edit the initUPGR.ora and set one

3 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

important parameter. This underscore is only necessary as we


use a software label which is meant for Exadata purposes
originally. With 18.3.0 mid of July 2018, Oracle Database
software should be generally available on-premises on all
platforms.

Use either vi or gedit (if you prefer a graphical editor) and


add this parameter to your initUPGR.ora:

*._exadata_feature_on=TRUE

vi gedit
cd $ORACLE_HOME/dbs cd $ORACLE_HOME/dbs
vi initUPGR.ora gedit initUPGR.ora

Save the initUPGR.ora.

Copy the initUPGR.ora to the target environment and


create a new password file:

cp $ORACLE_HOME/dbs/initUPGR.ora $OH18/dbs
. upgr18
cd $ORACLE_HOME/dbs
orapwd file=orapwUPGR password=oracle entries=10
format=12

3. Upgrade

Now you’ll do the database upgrade of UPGR to Oracle 18.2.0.

. upgr18
sqlplus / as sysdba

Startup the database in UPGRADE mode and create an


SPFILE:

startup upgrade pfile=$OH18/dbs/initUPGR.ora

4 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

create spfile from pfile;


exit

Start the database upgrade in parallel with catctl.pl:

cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl catctl.pl -n 4 -l
/home/oracle/logs catupgrd.sql

The upgrade will take between 20-40 minutes to complete.

4. Postupgrade and Recompilation

Recompile first with utlrp.sql, then the


postupgrade_fixups.sql as you see from the instructions
of preupgrade.log :

. upgr18
sqlplus / as sysdba

Startup the database in NORMAL mode:

startup
@?/rdbms/admin/utlrp.sql
@/u01/app/oracle/cfgtoollogs/UPGR/preupgrade
/postupgrade_fixups.sql

This should be the result:

5 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

5. Time Zone Change

As final recommend step the time zone upgrade should be


done from version 14 to 31 should happen.

Since Oracle Database 12.2.0.1 several time zone scripts


get delivered by default in $ORACLE:HOME/rdbms/admin:

Now execute the time zone change from TZ v14 to TZ v31.


The database will be restarted twice.

@?/rdbms/admin/utltz_countstar.sql
@?/rdbms/admin/utltz_upg_check.sql
@?/rdbms/admin/utltz_upg_apply.sql

The result should be:

INFO: Total failures during update of TSTZ


data: 0 .
An upgrade window has been successfully ended.
INFO: Your new Server RDBMS DST version is
DSTv31 .

Compatible Change

As a final step, as the upgrade completed successfully, you


should adjust the COMPATIBLE parameter. It does not affect
the Optimizer behavior:

6 of 7 24/06/18, 15:53
HOL 18c Upgrade – Upgrade your Database about:reader?url=https://mikedietrichde.com/hands-on-lab/hol-18...

alter system set COMPATIBLE='18.1.0'


scope=spfile;
shutdown immediate
startup
exit

Manual Change of /etc/oratab

As we did a manual upgrade on the command line, you’ll have


to adjust the information in /etc/oratab now. Use vi or
gedit:

vi gedit
vi /etc/oratab gedit /etc/oratab

Change the following line from:

UPGR:/u01/app/oracle/product/11.2.0.4:Y

to:

UPGR:/u01/app/oracle/product/18:Y

Then save the file.

Congratulations – you upgraded the UPGR database


successfully from Oracle 11.2.0.4 to Oracle 18.2.0.

===> NEXT: AWR Diff Reports

Edit

7 of 7 24/06/18, 15:53

You might also like