Tuesday, June 10, 2008

Upgrade to 10.2.0.3.0 and apply CPUJAN2008

Oracle CPU Patch procedures for Database Base version 10.2.0.3
-------------------------------------------------------------------------------------------
Step1: Backup the existing Oracle Binaries
$tar -cvvf ora102020bin_02042008.tar /opt/oracle/102 /var/opt/oracle /etc/ORACLE
$gzip ora102020bin_01302008.tar

Step2: Upgrade the OPATCH version to 10.2.0.3.4 or later
a.check the version of the opatch utility installed,
$cd /opt/oracle/102/OPatch $ ./opatch version
b.To upgrade the OPatch, backup the existing OPatch and simply extract the file p4898608_10203_GENERIC.zip .
$ cd $ORACLE_HOME
$mkdir OPatch_102020
$mv $ORACLE_HOME/OPatch/* $ORACLE_HOME/OPatch_102020/
$unzip p4898608_10202_GENERIC.zip

C.Verify the OPatch version after the upgrade.
$cd $ORACLE_HOME/OPatch/ $ ./opatch version

Step3. Make sure the following executables must be present in the $PATH: make, ar, ld, and nm.
$export PATH=$PATH:/usr/ccs/bin

Step4. shutdown all the instances,listeners and processes associated to the ORACLE_HOME being patched.
$ emctl stop agent
$emctl stop dbconsole
Run this command as root: /etc/init.d/init.cssd stop

Step5. Upgrade the database to 10.2.0.3.0 version.
a.Applying Oracle10g patch set interactively.
---------------------------------------------
a.1.Login as the 'Oracle' user.
a.2.Run exceed.
a.3.$ export DISPLAY=localhost:0.0
a.4.$cd /pkg2/oracle/db102/10203patchset/Disk1
a.5.$ ./runInstaller
a.6.Follow the screen instructions.
a.7.When prompted, run the $ORACLE_HOME/root.sh script as the root user.

b.Post installation tasks.
-----------------------------
Note:After you install the patch set, you must perform the following steps on every database associated with the upgraded ----- Oracle home:
b.1.Using the DBUA utility.

---------------------------
b.1.1.Log in as the Oracle software owner user.
b.1.2.Set the values for the environment variables $ORACLE_HOME, $ORACLE_SID and $PATH.

$export ORACLE_HOME PATH
$export ORACLE_SID=xxxx
b.1.3.Start the listener as follows

$ lsnrctl start
b.1.4.Run Oracle Database Upgrade Assistant either in the interactive mode:

$export DISPLAY=localhost:x.y
$ dbua &

b.1.5.On the Welcome screen, click Next.
b.1.6.On the Databases screen, select the name of the Oracle Database that you want to update, then click Next.

b.1.7.On the Recompile invalid objects screen, select the Recompile the invalid objects at the end of upgrade option, then click Next.
b.1.8.If you have not taken the backup of the database earlier, on the Backup screen, select the I would like to take this tool to backup the database option, mention the Path, then click Next.
b.1.9.On the Summary screen, check the summary, then click Finish.
b.1.10.On the End of upgradation screen, click Exit, then click Yes to exit from Oracle Database Upgrade Assistant.
b.1.11.If you are using the Oracle Recovery Manager catalog, enter the following command:
$ rman catalog
username/password@alias
RMAN> UPGRADE CATALOG;
b.1.12.Running changePerm.sh Script

$ cd $ORACLE_HOME/install
$./changePerm.sh

b.2.Manual Upgrade.
------------------- ---------
b.2.1. Make sure atleast 50 MB free space in SYSTEM tablespace.

b.2.2. Start the Listener
$lsnrctl start
b.2.3. Startup the database with nomount option and check the value for SHARED_POOL_SIZE and JAVA_POOL_SIZE. Both should be minimum 150.
$export ORACLE_SID=xxxx

$sqlplus
SQL>connect / as sysdba
SQL>startup nomount
b.2.4. If necessary, set the value of the SHARED_POOL_SIZE initialization parameter to at least 150 MB:
SQL> ALTER SYSTEM SET SHARED_POOL_SIZE='150M' SCOPE=spfile;
b.2.5.If necessary, set the value of the JAVA_POOL_SIZE initialization parameter to at least 150 MB:
SQL> ALTER SYSTEM SET JAVA_POOL_SIZE='150M' SCOPE=spfile;
b.2.6.Shut down the database:
SQL> shutdown immediate

b.2.7.Log in as the Oracle software owner user.
b.2.8.Start the Listener.

$ lsnrctl start
b.2.9.Login to each database.

$export ORACLE_SID=xxxx
$ sqlplus
SQL> connect / as sysdba
SQL> STARTUP UPGRADE
SQL> SPOOL /tmp/upgrade1.log
SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql
SQL> SPOOL OFF
b.2.10.Review the spooled log file for errors and inspect the list of components that is displayed at the end of catupgrd.sql script.
b.2.11.If necessary, rerun the catupgrd.sql script after correcting any problems.
b.2.12.Restart the database:
SQL> shutdown immediate

SQL> startup
b.2.13.Run the utlrp.sql script to recompile all invalid PL/SQL packages.
SQL> @/opt/oracle/102/rdbms/admin/utlrp.sql If utlrp.sql fails then run @/opt/oracle/102/rdbms/admin/prvtcr.plb and utlrp.sql again.
b.2.14.If you are using the Oracle Recovery Manager catalog, enter the following command:
$ rman catalog
username/password@xxxx
RMAN> UPGRADE CATALOG;
b.2.15.Running changePerm.sh Script

$ cd $ORACLE_HOME/install
$./changePerm.sh

Step6: Apply patch 5746875 to update utltzuv2.sql
Shutdown the listener and all the databases in the ORACLE_HOME. $cd /u02/pkg/oracle/patches/DST/db10.2.0.3.0/5746875/
$ export OPATCH_PLATFORM_ID=0
$$ORACLE_HOME/OPatch/opatch apply
Run utltzuv2.sql in each database Startup the databases and listener

$sqlplus
SQL> connect / as sysdba
SQL>@/opt/oracle/102/rdbms/admin/utltzuv2.sql
Check whether any data is affected,
SQL> select * from sys.sys_tzuv2_temptab;
SQL>select distinct owner from dba_tab_cols where data_type like '%WITH TIME ZONE';

To rollback this patch (5746875).
---------------------------------------------
$cd /u02/pkg/oracle/patches/DST/db10.2.0.3.0/5746875/
$ opatch rollback -id 5746875

Step7: Apply patch 5632264 to update V4 timezone
Shutdown the listener and all the instances.
$cd /pkg/oracle/patches/DST/db10.2.0.3.0/5632264/

$export OPATCH_PLATFORM_ID=23
$ $ORACLE_HOME/OPatch/opatch apply


To rollback this patch (5632264)
--------------------------------
$cd /u02/pkg/oracle/patches/DST/db10.2.0.3.0/5632264/
$ $ORACLE_HOME/OPatch/opatch rollback -id 5632264

Step8: Apply Oracle JVM Time Zone Updates (5865568)
Find out whether Oracle JVM Time Zone patch is needed by

SQL>select comp_name, version, status from dba_registry where comp_name='JServer JAVA Virtual Machine';
Backup the following files and remove them from the ORACLE_HOME.
$ORACLE_HOME/javavm/lib/zi/Africa/Timbuktu

$ORACLE_HOME/javavm/lib/zi/America/Buenos_Aires $ORACLE_HOME/javavm/lib/zi/America/Catamarca $ORACLE_HOME/javavm/lib/zi/America/Coral_Harbour $ORACLE_HOME/javavm/lib/zi/America/Cordoba
$ORACLE_HOME/javavm/lib/zi/America/Indianapolis
$ORACLE_HOME/javavm/lib/zi/America/Jujuy
$ORACLE_HOME/javavm/lib/zi/America/Louisville
$ORACLE_HOME/javavm/lib/zi/America/Mendoza
$ORACLE_HOME/javavm/lib/zi/Europe/Belfast
$ORACLE_HOME/javavm/lib/zi/Pacific/Yap
$cd /pkg/oracle/patches/DST/db10.2.0.3.0/5865568/

$$ORACLE_HOME/OPatch/opatch apply

Post-Installation Steps
---------------------------------
Before we run the following, Ensure that the opatch has successfully ended without errors during "opatch apply" --- connect as SYS and run the $ORACLE_HOME/javavm/admin/fixTZa script.
$export ORACLE_SID=xxxx
$sqlplus
SQL>connect / as sysdba
SQL> STARTUP
SQL> @$ORACLE_HOME/javavm/admin/fixTZa
If it terminates in any way other than printing the following message, ########################################################
Bug is in fact present, so this patch is needed Proceed by restarting the database and running script fixTZb ########################################################
inspect the output to determine whether the script was either incorrectly run or the bug is in fact not present.
If the latter, take no further action. If the earlier, correct the indicated condition and rerun the script.
- Shutdown and restart the database using startup migrate.
- connect as SYS and run $ORACLE_HOME/javavm/admin/fixTZb script.
SQL> SHUTDOWN

SQL> STARTUP MIGRATE
@$ORACLE_HOME/javavm/admin/fixTZb
If it terminates in any way other than printing the following message, ########################################################

Bug is no longer present. Patch succeeded. ########################################################
inspect the output to determine what was done incorrectly and retry as indicated. - Shutdown the database. SQL> SHUTDOWN
- Restart the database

SQL>startup

JVM Patch 5865568 Deinstallation:
-------------------------------------------
$cd /pkg/oracle/patches/DST/db10.2.0.3.0/5865568/
$opatch rollback -id 5865568
Before you run the following, Ensure that the opatch has successfully ended without errors during "opatch rollback" Restore the following files in to the ORACLE_HOME.
$ORACLE_HOME/javavm/lib/zi/Africa/Timbuktu
$ORACLE_HOME/javavm/lib/zi/America/Buenos_Aires $ORACLE_HOME/javavm/lib/zi/America/Catamarca $ORACLE_HOME/javavm/lib/zi/America/Coral_Harbour $ORACLE_HOME/javavm/lib/zi/America/Cordoba
$ORACLE_HOME/javavm/lib/zi/America/Indianapolis
$ORACLE_HOME/javavm/lib/zi/America/Jujuy
$ORACLE_HOME/javavm/lib/zi/America/Louisville
$ORACLE_HOME/javavm/lib/zi/America/Mendoza
$ORACLE_HOME/javavm/lib/zi/Europe/Belfast
$ORACLE_HOME/javavm/lib/zi/Pacific/Yap

- Restart the each database using startup migrate
SQL> STARTUP MIGRATE
- connect as SYS and do the following
SQL> create or replace java system /
- Shutdown the database. SQL> SHUTDOWN
- Restart the each database normally
SQL>startup

Step9: Apply CPUJan2008 patch p6646853_10203_SOLARIS64.zip
Make sure the OPatch version is 10.2.0.3.4 or later Shutdown all the databases and listener. $cd /pkg/oracle/patches/CPUPATCHES/10g/CPUJan2008/6646853/
$$ORACLE_HOME/OPatch/opatch napply -skip_subset -skip_duplicate

Post-Installation Steps
---------------------------------
a.Start the listener
$lsnrctl start
b.Start up all database instances running out of the ORACLE_HOME being patched.
c.Loading Modified .sql Files into the Database For each database instance running out of the ORACLE_HOME being patched, connect to the database using Sqlplus as sysdba and run catcpu.sql as follows -
$cd $ORACLE_HOME/cpu/CPUJan2008/
$export ORACLE_SID=xxxx
$sqlplus
SQL> connect / as sysdba
SQL> STARTUP
SQL>spool /tmp/emrep_CPUJan2008.log
SQL> @$ORACLE_HOME/cpu/CPUJan2008/catcpu.sql
SQL> spool off
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
SQL>select distinct owner from DBA_OBJECTS where status = 'INVALID';
d.Recompiling Views in the Database
SQL>SELECT * FROM registry$history where ID = '6452863';
If it returns no rows then,
e.Run the pre-check script, which reports the maximum number of views and objects that may be recompiled:
$cd $ORACLE_HOME/cpu/view_recompile
$export ORACLE_SID=xxxx
$sqlplus
SQL> CONNECT / AS SYSDBA
SQL> @$ORACLE_HOME/cpu/view_recompile/recompile_precheck_jan2008cpu.sql
SQL>shutdown immediate
f.Run the view recompilation script. Note that this script is run with the database in upgrade mode, which restricts connections as SYSDBA.
$cd $ORACLE_HOME/cpu/view_recompile
$export ORACLE_SID=xxxx
$sqlplus
SQL> CONNECT / AS SYSDBA
SQL> STARTUP UPGRADE
SQL> @$ORACLE_HOME/cpu/view_recompile/view_recompile_jan2008cpu.sql
SQL> SHUTDOWN;
SQL> STARTUP;
g.Check the log file for any errors. The log file is in the current directory and is named: vcomp__.log
h.If any invalid objects were reported, run the utlrp.sql script as follows:
$cd $ORACLE_HOME/rdbms/admin
$export ORACLE_SID=xxxx
$sqlplus
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
Then, manually recompile any invalid objects.
i.Verify that the view recompilation has been performed for the database, by executing the following statement:
SQL>SELECT * FROM registry$history where ID = '6452863';
This has to return only one row.

CPUJan2008 Patch 6646853 Deinstallation Instructions
---------------------------------------------------------------------------------
Shutdown all the instances and Listener.
To de-install the patch, set the current directory to the directory where the patch is located and then run opatch by entering the following command:
$cd /pkg/oracle/patches/CPUPATCHES/10g/CPUJan2008/6646853/
$ $ORACLE_HOME/OPatch/opatch nrollback -id 6452863,6646853,6650081,6650095,6650096,6650105,6667542
Start up all database instances running out of the ORACLE_HOME being roll backed. For each database instance running out of the ORACLE_HOME being roll backed, connect to the database using Sqlplus as sysdba and run catcpu_rollback.sql as follows -
$cd $ORACLE_HOME/cpu/CPUJan2008
$sqlplus
SQL> connect / as sysdba
SQL> STARTUP
SQL> @catcpu_rollback.sql
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
SQL> @/opt/oracle/102/rdbms/admin/utlrp.sql
We can check for any invalid objects by executing following statement;
SQL> select OBJECT_NAME from DBA_OBJECTS where status = 'INVALID';

Step10. Check and verify the Patch updates applied to the server and the database instances. $cd $ORACLE_HOME/OPatch $./opatch lsinventory

Step11: To fix the full export probelm, run the below as sysdba
GRANT EXECUTE ON SYS.DBMS_DEFER_IMPORT_INTERNAL TO EXP_FULL_DATABASE;
GRANT EXECUTE ON SYS.DBMS_EXPORT_EXTENSION TO EXP_FULL_DATABASE;


No comments: