0% found this document useful (0 votes)
31 views5 pages

Database Upgrade - Manual

The document outlines the steps for manually upgrading an Oracle database from version 12.2.0.1 to 19c, detailing pre-upgrade preparations, upgrade steps, and post-upgrade actions. It includes commands for backing up files, checking database status, and gathering statistics, as well as scripts to run before and after the upgrade. The document emphasizes the importance of ensuring tablespace sizes and gathering dictionary statistics prior to the upgrade process.

Uploaded by

Ugoh Jessie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views5 pages

Database Upgrade - Manual

The document outlines the steps for manually upgrading an Oracle database from version 12.2.0.1 to 19c, detailing pre-upgrade preparations, upgrade steps, and post-upgrade actions. It includes commands for backing up files, checking database status, and gathering statistics, as well as scripts to run before and after the upgrade. The document emphasizes the importance of ensuring tablespace sizes and gathering dictionary statistics prior to the upgrade process.

Uploaded by

Ugoh Jessie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

INTRO

======
https://www.br8dba.com/upgrade-oracle-database-manually-from-12-2-0-1-to-19c/
https://www.youtube.com/watch?v=F5lI0r_cRFY

A database upgrade involves moving from an older version of a database management


system (DBMS) to a newer version. Database upgrades can be done
in two ways via DBUA or CLI.

PRE UPGRRADE STEPS


======================
--> Run the 19c pre-install package on Linux to complete all OS level pre-
requisites.
yum install -y oracle-database-preinstall-19c
yum update -y

--> Create a backup dir and back up important files like listener.ora, sqlnet.ora,
tnsnames.ora and spfile.
mkdir /u01/backup
cd $ORACLE_HOME/network/admin
cp -p listener.ora sqlnet.ora tnsnames.ora /u01/backup/
cd $ORACLE_HOME/dbs
cp -p spfiletest.ora orapwtest /u01/backup/

--> Copy 19c software into new db home and install Oracle 19c software.
mkdir -p /u02/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u02/
unzip
./runInstaller (refer to patching note if you want to apply patches)

--> Make a dir for the pre-upgrade script, then run the script
mkdir -p /u02/preupgrade
/u01/app/oracle/product/12c/db_1/jdk/bin/java -jar
/u02/app/oracle/product/19c/db_1/rdbms/admin/preupgrade.jar FILE DIR
/u02/preupgrade

[oracle@testone preupgrade]$ /u01/app/oracle/product/12c/db_1/jdk/bin/java -jar


/u02/app/oracle/product/19c/db_1/rdbms/admin/preupgrade.jar
FILE DIR /u02/preupgrade
==================
PREUPGRADE SUMMARY
==================
/u02/preupgrade/preupgrade.log
/u02/preupgrade/preupgrade_fixups.sql
/u02/preupgrade/postupgrade_fixups.sql

--> Check the preupgrade.log for recommendations

[oracle@testone preupgrade]$ cat /u02/preupgrade/preupgrade.log


Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2024-09-10T14:43:53

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.

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 470 MB 500 MB
SYSTEM 800 MB 912 MB
TEMP 32 MB 150 MB
UNDOTBS1 70 MB 439 MB

Minimum tablespace sizes for upgrade are estimates.

The above can be fixed by extending the tablespace files and executing the data
dict query.

For 1
=====
SQL> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

PL/SQL procedure successfully completed.

For 3
======
Identify the data files associated with each tablsspace and resize accordingly.

SQL> select FILE_NAME "FILES", BYTES/1024/1024 "SIZE" from dba_temp_files;


SQL> select FILE_NAME "FILES", BYTES/1024/1024 "SIZE" from dba_data_files;

SQL> alter database tempfile '/u01/app/oracle/oradata/test/temp01.dbf' resize 1g;

Database altered.

SQL> alter database datafile '/u01/app/oracle/oradata/test/undotbs01.dbf' resize


1g;

Database altered.

SQL> alter database datafile '/u01/app/oracle/oradata/test/system01.dbf' resize 1g;


Database altered.

SQL> alter database datafile '/u01/app/oracle/oradata/test/sysaux01.dbf' resize


1g;

Database altered.

--> Purge recycle bin.


SQL> PURGE DBA_RECYCLEBIN;

--> Crosscheck archivelog parameters.


SQL> show parameter recovery

NAME TYPE VALUE


-
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area/test
db_recovery_file_dest_size big integer 8016M
recovery_parallelism integer 0
remote_recovery_file_dest string
SQL>

--> Run preupgrade fix script


SQL> @/u02/preupgrade/preupgrade_fixups.sql

--> Create a restore point


create restore point pre_upgrade guarantee flashback database;

--> Confirm restore point


SQL> col name for a20;
SQL> select name, guarantee_flashback_database, time from v$restore_point;

UPGRADE STEPS
=============

-->Shutdown the old database


SQL> shutdown immediate

-->Stop the listener


[oracle@testone ~]$ lsnrctl stop

--> Copy backed up files to their default locations in the new database home
[oracle@testone ~]$ cd /u01/backup/
[oracle@testone backup]$
[oracle@testone backup]$ cp spfiletest.ora orapwtest
/u02/app/oracle/product/19c/db_1/dbs
[oracle@testone backup]$ cp listener.ora tnsnames.ora
/u02/app/oracle/product/19c/db_1/network/admin/

--> Create an env variable for new database home. Set it once done.
[oracle@testone ~]$ cat 19c.env
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u02/app/oracle
export DB_HOME=$ORACLE_BASE/product/19c/db_1
export ORACLE_HOME=$DB_HOME
export ORACLE_SID=test
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

--> Check sqlplus version


[oracle@testone ~]$ sqlplus -v

SQL*Plus: Release 19.0.0.0.0 - Production


Version 19.3.0.0.0

--> Start up database in upgrade mode


[oracle@testone backup]$ sqlplus / as sysdba
SQL> startup upgrade
ORACLE instance started.

Total System Global Area 1157627168 bytes


Fixed Size 8895776 bytes
Variable Size 419430400 bytes
Database Buffers 721420288 bytes
Redo Buffers 7880704 bytes
Database mounted.
Database opened.

--> Check database status


SQL> select name,open_mode,cdb,version,status from v$database,v$instance;

NAME OPEN_MODE CDB VERSION STATUS


--------- -------------------- --- ----------------- ------------
TEST READ WRITE NO 19.0.0.0.0 OPEN MIGRATE

--> Navigate to oracle home dir


[oracle@testone ~]$ cd $ORACLE_HOME
[oracle@testone db_1]$ cd bin
[oracle@testone bin]$ ./dbupgrade -n 8

Argument list for [/u02/app/oracle/product/19c/db_1/rdbms/admin/catctl.pl]


For Oracle internal use only A = 0
Run in c = 0

POST UPGRADE
=============

--> Check database status


SQL> select name,open_mode,cdb,version,status from v$database,v$instance;

--> Check upgrade status


SQL> @$ORACLE_HOME/rdbms/admin/utlusts.sql TEXT

--> Check for invalid objects


SQL> select count(*) from dba_objects where status='INVALID';

--> Recompile invalid objects


SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
--> Check for invalid objects
SQL> select count(*) from dba_objects where status='INVALID';

--> Check upgrade status


SQL> @$ORACLE_HOME/rdbms/admin/utlusts.sql TEXT

--> Run postupgrade_fixups.sql


SQL> @/u02/preupgrade/postupgrade_fixups.sql

--> Update filezone file


SQL> select version from v$timezone_file;

--> Fix the timezone issue


SQL> @$ORACLE_HOME/rdbms/admin/utltz_countstats.sql;
SQL> @$ORACLE_HOME/rdbms/admin/utltz_countstar.sql;
SQL> @$ORACLE_HOME/rdbms/admin/utltz_upg_check.sql;
SQL> @$ORACLE_HOME/rdbms/admin/utltz_upg_apply.sql;

--> Cross check filezone file

SQL> select version from v$timezone_file;

VERSION
----------
32

1 row selected.

--> Gather statistics on fixed object


SQL> EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS

Rerun postupgrade_fixups.sql
SQL> @/u02/preupgrade/postupgrade_fixups.sql

--> Reverify for invalid objects


SQL> select count(*) from dba_objects where status='INVALID';

--> Drop restore point


SQL> drop restore point PRE_UPGRADE;

P.S: Restore files are kept in the recovery path as seen below
[oracle@testone u02]$ ls /u01/app/oracle/fast_recovery_area/test/TEST/flashback/
o1_mf_mg0ocnpo_.flb o1_mf_mg0ocvq0_.flb o1_mf_mg0sdbjo_.flb o1_mf_mg0v2t59_.flb
o1_mf_mg0vnk3j_.flb

--> Update compatible parameter


SQL> show parameter COMPATIBLE
SQL> ALTER SYSTEM SET COMPATIBLE = '19.0.0' SCOPE=SPFILE;

--> Restart database and verify compatible parameter


SQL> show parameter COMPATIBLE

--> Verify dba_registry


SQL> select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy