===== Autoupgrade =====
export CFG="/oracle/scripts/autoupgrade_loane_crelane_crelsase_bile.cfg"
SIDLIST="${CFG##*grade_}"
SIDLIST=$(echo $SIDLIST|sed -e 's/.cfg//' -e 's/_/ /g')
==== Check version ====
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -version
If not latest, download from link at the top of this document (if not already existing in /oracle/Patches)
echo $OH19
read -p "Press Enter to continue"
nodb199
cp /oracle/Patches/autoupgrade.jar.21.1.2 $OH19/rdbms/admin/autoupgrade.jar
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -version
==== Check new parameters have been taken into account ====
ORAENV_ASK=NO
for i in ${SIDLIST}; do
export ORACLE_SID="$i"
printf "\n\n%s\n" "Processing $ORACLE_SID"
. oraenv
[[ $? -ne 0 ]] && echo "WARNING: Cannot set environment for $ORACLE_SID, skipping" && continue
sqlplus -s / as sysdba<<'EOSQL'
shu immediate
create spfile from pfile;
startup mount
alter database archivelog;
alter database open;
set lines 1000 pages 100
col name for a30
col value for a100
select name
, value
from v$parameter
where name in (
'db_domain',
'service_names',
'memory_max_target',
'memory_target',
'sga_max_size',
'sga_target',
'pga_aggregate_limit',
'pga_aggregate_target',
'local_listener',
'log_archive_dest',
'log_archive_dest_1',
'open_links',
'db_recovery_file_dest',
'db_recovery_file_dest_size'
)
order by 1
/
EOSQL
done
==== Autoupgrade with analyse option ====
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -config "${CFG}" -mode analyze
Job 100 completed
Job 102 completed
Job 103 completed
------------------- Final Summary --------------------
Number of databases [ 4 ]
Jobs finished [4]
Jobs failed [0]
Jobs pending [0]
Please check the summary report at:
/home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.html
/home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.log
==== Check the status of the deploy ====
grep '\[Status]' /home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.log
=== Autoupgrade with deploy option ===
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -config "${CFG}" -mode deploy
Job 105 completed
Job 106 completed
Job 107 completed
Job 104 completed
------------------- Final Summary --------------------
Number of databases [ 4 ]
Jobs finished [4]
Jobs failed [0]
Jobs pending [0]
---- Drop GRP at your convenience once you consider it is no longer needed ----
Drop GRP from bila: drop restore point AUTOUPGRADE_9212_BILA121020
Drop GRP from loana: drop restore point AUTOUPGRADE_9212_LOANA121020
Drop GRP from crelsasa: drop restore point AUTOUPGRADE_9212_CRELSASA121020
Drop GRP from crelana: drop restore point AUTOUPGRADE_9212_CRELANA121020
Please check the summary report at:
/home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.html
/home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.log
=== Check the status of the deploy ===
grep '\[Status]' /home/oracle/logs/autoupgrade/cfgtoollogs/upgrade/auto/status/status.log
==== Clear a properly failed upgrade ====
In case something really went badly wrong...
select * from v$restore_point;
shu immediate
startup mount;
flashback database to restore point &grp;
alter database open resetlogs;
exit
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -config "${CFG}" -clear_recovery_data
then reset the environment to the old home
If the issue was with the startup file,
cd /home/oracle/logs/autoupgrade/${ORACLE_SID}/${ORACLE_SID}/temp
vi *pfile_${ORACLE_SID}.ora
Changing the real one in the dbs directory will have no effect!
* If necessary, disable one or more fixups: https://docs.oracle.com/en/database/oracle/oracle-database/19/upgrd/how-to-override-default-fixups.html
Other command that might help
$OH19/jdk/bin/java -jar $OH19/rdbms/admin/autoupgrade.jar -config "${CFG}" -restore -all_failed
==== Post-upgrade ====
* Duplicate, modify home in new and comment out the old line in /etc/oratab
* Check listener startup in /etc/lsnrtab
* When static listener entries are setup in 19c listener.ora, remove them. They will now be dynamically registered.
=== Reinitialise environment ===
. oraenv
==== Check the end time on this file for the end of the upgrade ====
ls -al /oracle/autoupgrade/logs/${ORACLE_SID}/${ORACLE_SID}/*/postupgrade/postupgrade.log
=== If POST-UPGRADE errors ===
cat /home/oracle/autoupgrade/logs/${ORACLE_SID}/${ORACLE_SID}/*/postfixups/failed_postfixups.log
=== Other post-upgrade stuff ===
* Change the password file format
* The format of the password file has changed (new format is version 12.2). It is possible to run 19c database with a legacy password file but sysdba, sysbackup, etc… passwords cannot be changed unless the new format is used (by creating a new password file). This also introduces minimum password complexities that cannot be overruled.
* Check for symbolic links in directory names
* Manage database users
* Ensure RMAN recovery window is correct
ORAENV_ASK=NO
for i in ${SIDLIST}; do
export ORACLE_SID="$i"
printf "\n%s\n" "Processing $ORACLE_SID"
. oraenv >/dev/null
[[ $? -ne 0 ]] && echo "WARNING: Cannot set environment for $ORACLE_SID, skipping" && continue
orapwd describe file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID}
orapwd file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID} password=something force=y
orapwd describe file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID}
sqlplus -s / as sysdba<<-'EOSQL'
@?/rdbms/admin/utldirsymlink.sql
alter profile default limit password_life_time unlimited;
alter user dbsnmp identified by something account unlock;
alter user system account lock;
alter user sys account lock;
EOSQL
echo "CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 28 DAYS;"|rman target / catalog rman/rman@rman12
done
=== Following 2 sections should no longer be necessary as network config are no longer upgraded ===
* Ensure environment from here on is set to 19c
* Remove just upgraded database(s) from listener.ora.19c
vi $TNS_ADMIN/listener.ora.19c
* Check 19c tnsnames and listener.ora is not corrupted
cd $TNS_ADMIN
diff sqlnet.ora.19c sqlnet.ora
diff listener.ora.19c listener.ora
diff tnsnames.ora.19c tnsnames.ora
cd -
=== Restart listeners ===
for i in $(ps -ef | grep [t]ns|grep "LSNR_HN"|grep '/19.9.0/'|awk '{print $10}'); do
echo $i
lsnrctl stop $i
lsnrctl start $i
done
=== Check appli connection is in tnsnames.ora ===
* Test connections via tns
ORAENV_ASK=NO
for i in ${SIDLIST}; do
export ORACLE_SID="$i"
printf "\n%s\n" "Processing $ORACLE_SID"
. oraenv >/dev/null
[[ $? -ne 0 ]] && echo "WARNING: Cannot set environment for $ORACLE_SID, skipping" && continue
echo "register database with the listener"
echo "alter system register;" | sqlplus -s / as sysdba
echo "test connection to appli database"
echo "exit" | sqlplus -s cgkmon/C6KM0N@appli
echo "test connection to ${ORACLE_SID} database"
echo "exit" | sqlplus -s cgkmon/C6KM0N@"${ORACLE_SID}"
done