Wednesday, October 5, 2011

Database Upgrade

When major patch sets or database releases are put into production we completely ignore them. The only time we consider patches or new releases important is when there is a direct need for them. For instance I have a system with a corrupt tablespace. The fix for this specific issue was to upgrade the database to the next major revision. No big deal.

We have to perform silent installations where I work because we only have SSH access to the systems. Please note that we're running on Linux (always). So here are the steps involved with a silent installation and the cause and fix for the following errors:
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option

Set up your environment ORACLE_SID, ORACLE_HOME, ORACLE_BASE, the usual shit. You know what, if you don't have this part figured out by now then don't bother with the upgrade. Next!

Next you unzip your patch file and jump into the Disk1/Install/response directory. You should see a single (or multiple) response files. Pick the one that sis pertinent and edit it. This part should be pretty straight forward. Note that if you have an existing name for your Oracle Home that they must match. If you don't know what it is then it will tell you when it's ran (It errors out with: Oracle home name XXXX already exists at the Oracle Home you specified). Why they did not automate this I have no clue. Once you're satisfied with all of the entries move on.

Now we need to shut down EVERYTHING that's related to that home. dbconsole, CRS, ASM, Listener and RDBMS. Details.

$ORACLE_HOME/bin/emctl stop dbconsole


sqlplus "/ as sysdba"
shutdown immediate

ORACLE_SID=+ASM
sqlplus "/ as sysASM"
shutdown immediate


$ORACLE_HOME/bin/crsctl stop crs (as ROOT)


EMCTL dbconsole stop

LSNRCTL stop

Now everything is shutdown and you have your patch unzipped and the response file ready. Change your directory to the runInstall script and kick it off silently:

./runInstaller -silent -responseFile /u01/Disk1/response/patchset.rsp

Once that completes you ARE NOT FINISHED. I made the mistake of thinking that I was. There are still 2 very important steps. If you attempt to start your database you get bootstrap and forced disconnection errors. The traces generated say that you have to open the database in UPGRADE mode. What they don't mention is that you skipped a step.

Start everything up (dbconsole, CRS, ASM, Listener and RDBMS) and then:

sqlplus "/ as sysdba"
startup UPGRADE
@?/rdbms/admin/catupgrd.sql
shutdown immediate
startup
@?/rdbms/admin/utlrp.sql

And voila! You are finished. Well done you crazy DBA you! I only say that because reading how to upgrade a database from me is terrifying. Go flog yourself.

0 comments:

Post a Comment