Thursday, June 13, 2013

Oracle Database CPU Patching Very quick steps



Oracle Database CPU Patching Very quick steps.

Note: for detailed steps please read Patch readme file, few patch require database to be started in upgrade mode.

1. Backup Oracle Home -
           
            cd $ORACLE_HOME
            tar -cvf /u03/PATCH/HOMEBKP/DB_102050_HOME_bkp.tar .

2. Check Patch Readme file to know current version of OPatch matching requirement.

            Check opatch version :
            which opatch  -> ensure it shows the opatch file from right Oracle Home
            opatch -version -> will show opatch version.

            To upgrade,
           
            move current opatch directory to new name
            cd $ORACLE_HOME
            mv OPatch Opatch.bak

            Download and unzip opatch latest version from download.oracle.com and unzip the folder in Oracle Home.

3. Set Environment Variables.

            export ORACLE_HOME=/u01/app/oracle/product/10.2.0.5
            export PATH=$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$PATH
            export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
            export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib

4. Shutdown all the instances and listener running from this Oracle Home.


5. Download patch and unzip the patch file in desired location.

            cd /u03/PATCH/

            unzip p14727319_10205_Linux-x86-64.zip

6. Prerequisites Check - running below command


            $ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir 14727319

            Invoking OPatch 10.2.0.5.1

            Oracle Interim Patch Installer version 10.2.0.5.1
            Copyright (c) 2010, Oracle Corporation.  All rights reserved.

            PREREQ session

            Oracle Home       : /u01/app/oracle/product/10.2.0.5
            Central Inventory : /u01/app/oracle/product/10.2.0.5
               from           : /etc/oraInst.loc
            OPatch version    : 10.2.0.5.1
            OUI version       : 10.2.0.5.0
            OUI location      : /u01/app/oracle/product/10.2.0.5/oui
            Log file location : /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch2013-06-13_02-30-20AM.log

            Patch history file: /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch_history.txt

            Invoking prereq "checkconflictagainstohwithdetail"

            Prereq "checkConflictAgainstOHWithDetail" passed.

            OPatch succeeded.


7. Apply the patch.

            -> Before applying it is always better to check which opatch is being used run “which opatch “command to know.

            $ echo $ORACLE_HOME
            /u01/app/oracle/product/10.2.0.5
            $ which opatch
            ~/product/10.2.0.5/OPatch/opatch

            -> cd to Patch locatio and run opatch apply ( It will ask for few interactive questions answer them)
           
            $ cd 14727319
            $ opatch apply
            Invoking OPatch 10.2.0.5.1

            Oracle Interim Patch Installer version 10.2.0.5.1
            Copyright (c) 2010, Oracle Corporation.  All rights reserved.


            Oracle Home       : /u01/app/oracle/product/10.2.0.5
            Central Inventory : /u01/app/oracle/product/10.2.0.5
               from           : /etc/oraInst.loc
            OPatch version    : 10.2.0.5.1
            OUI version       : 10.2.0.5.0
            OUI location      : /u01/app/oracle/product/10.2.0.5/oui
            Log file location : /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch2013-06-13_02-33-03AM.log

            Patch history file: /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch_history.txt

            ApplySession applying interim patch '14727319' to OH '/u01/app/oracle/product/10.2.0.5'

            Running prerequisite checks...
            Patch 14727319: Optional component(s) missing : [ oracle.rdbms.dv, 10.2.0.5.0 ] , [ oracle.rdbms.dv.oc4j, 10.2.0.5.0 ] , [ oracle.network.cman, 10.2.0.5.0 ]
            Provide your email address to be informed of security issues, install and
            initiate Oracle Configuration Manager. Easier for you if you use your My
            Oracle Support Email address/User Name.
            Visit http://www.oracle.com/support/policies.html for details.
            Email address/User Name:

            You have not provided an email address for notification of security issues.
            Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y

            OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


            Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
            (Oracle Home = '/u01/app/oracle/product/10.2.0.5')


            Is the local system ready for patching? [y|n]
.
.
.
.
.
.
.
.
##########. Last few lines of Patch log...##############

            Patching component oracle.xdk.rsf, 10.2.0.5.0...
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libxml10.a"  with "lib/libxml10.a/lpxpar.o"
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib32/libxml10.a"  with "lib32/libxml10.a/lpxpar.o"

            Patching component oracle.precomp.common, 10.2.0.5.0...

            Patching component oracle.rdbms.rman, 10.2.0.5.0...
            Copying file to "/u01/app/oracle/product/10.2.0.5/rdbms/admin/recover.bsq"

            Patching component oracle.sdo.locator, 10.2.0.5.0...
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libordsdo10.a"  with "lib/libordsdo10.a/mdidx.o"
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libordsdo10.a"  with "lib/libordsdo10.a/mdrcr.o"
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libordsdo10.a"  with "lib/libordsdo10.a/mdrt.o"
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libordsdo10.a"  with "lib/libordsdo10.a/mdopp.o"
            Updating archive file "/u01/app/oracle/product/10.2.0.5/lib/libordsdo10.a"  with "lib/libordsdo10.a/mdgr.o"

            Patching component oracle.network.listener, 10.2.0.5.0...

            Patching component oracle.network.client, 10.2.0.5.0...
            Copying file to "/u01/app/oracle/product/10.2.0.5/bin/adapters"
            Running make for target client_sharedlib
            Running make for target ioracle
            Running make for target iwrap
            Running make for target client_sharedlib
            Running make for target proc
            Running make for target irman
            Running make for target itnslsnr
            ApplySession adding interim patch '14727319' to inventory

            Verifying the update...
            Inventory check OK: Patch ID 14727319 is registered in Oracle Home inventory with proper meta-data.
            Files check OK: Files from Patch ID 14727319 are present in Oracle Home.

            The local system has been patched and can be restarted.


            OPatch succeeded.

8. On each database on oracle home startup the database and run below listed scripts.


            For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script as follows:

            cd $ORACLE_HOME/rdbms/admin
            sqlplus /nolog
            SQL> CONNECT / AS SYSDBA
            SQL> STARTUP
            SQL> @catbundle.sql psu apply
            SQL> -- Execute the next statement only if this is the first PSU applied for 10.2.0.5 or this is the first PSU applied since 10.2.0.5.3.
            SQL> @utlrp.sql
            SQL> QUIT



            Check the following log files in $ORACLE_HOME/cfgtoollogs/catbundle or $ORACLE_BASE/cfgtoollogs/catbundle for any errors:

            catbundle_PSU__APPLY_.log
            catbundle_PSU__GENERATE_.log


9. Check the Opatch latest patch version " opatch lsinventory"

            $ opatch lsinventory
            Invoking OPatch 10.2.0.5.1

            Oracle Interim Patch Installer version 10.2.0.5.1
            Copyright (c) 2010, Oracle Corporation.  All rights reserved.


            Oracle Home       : /u01/app/oracle/product/10.2.0.5
            Central Inventory : /u01/app/oracle/product/10.2.0.5
               from           : /etc/oraInst.loc
            OPatch version    : 10.2.0.5.1
            OUI version       : 10.2.0.5.0
            OUI location      : /u01/app/oracle/product/10.2.0.5/oui
            Log file location : /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch2013-06-13_02-35-14AM.log

            Patch history file: /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/opatch_history.txt

            Lsinventory Output file location : /u01/app/oracle/product/10.2.0.5/cfgtoollogs/opatch/lsinv/lsinventory2013-06-13_02-35-14AM.txt

            --------------------------------------------------------------------------------
            Installed Top-level Products (3):

            Oracle Database 10g                                                  10.2.0.1.0
            Oracle Database 10g Products                                         10.2.0.1.0
            Oracle Database 10g Release 2 Patch Set 4                            10.2.0.5.0
            There are 3 products installed in this Oracle Home.


            Interim patches (1) :

            Patch  14727319     : applied on Thu Jun 13 02:34:39 PDT 2013
            Unique Patch ID:  15760144
               Created on 13 Dec 2012, 08:27:13 hrs PST8PDT
               Bugs fixed:
                 8865718, 11790175, 13489660, 9020537, 9772888, 8650138, 8664189, 10091698
                 14275629, 14469008, 10092858, 12551710, 7519406, 13349665, 8771916
                 7509714, 8822531, 10139235, 10159846, 13257247, 8350262, 11792865
                 7119382, 13632738, 11724962, 8966823, 9320130, 13775862, 11674645
                 15877957, 7026523, 15877958, 15877959, 9399589, 14841459, 9672816
                 13503598, 9499302, 9150282, 9448311, 9659614, 13632743, 9949948, 8882576
                 10327179, 7612454, 7111619, 9711859, 9714832, 9735237, 9952230, 15877960
                 12780098, 15877961, 15877962, 14665116, 15877963, 8660422, 11066597
                 14546673, 14105702, 9713537, 14105703, 14105704, 13483152, 13737773
                 13737775, 14269955, 12925532, 12748240, 9694101, 14390396, 12862186
                 12862187, 10249537, 14727319, 9586877, 8211733, 6694396, 9548269, 7115910
                 7710224, 9337325, 8354642, 7602341, 14076510, 11856395, 10157402, 12565867
                 6402302, 10327190, 10269717, 14023636, 11693109, 10017048, 8546356
                 8394351, 9024850, 8224558, 9770451, 9360157, 8488233, 9109487, 10132870
                 9171933, 10173237, 9532911, 10068982, 10306945, 7361418, 11725006
                 8666117, 6157713, 9184754, 10214450, 14205448, 8544696, 9767674, 9323583
                 8277300, 9726739, 13343467, 8412426, 10326338, 10165083, 12419392
                 6651220, 10208905, 9145204, 13554409, 11076894, 7450366, 11893577
                 8970313, 14492313, 6011045, 14492314, 10162036, 11814891, 14492315
                 10248542, 14492316, 9469117, 13359623, 9952270, 9842573, 13343471
                 10324526, 14546638, 12419258, 9322219, 8636407, 10010310, 12828105
                 9689310, 9390484, 13736501, 13736502, 9824435, 13736503, 13736504
                 13736505, 13736506, 9963497, 9032322, 13736507, 12551700, 12551701
                 12551702, 14035825, 11858315, 12551703, 12551704, 12551705, 10076669
                 12551706, 14040433, 12551707, 6076890, 12551708, 14258925, 9308296
                 13916709, 12827745, 12880299, 14038805, 13923855, 9072105, 8528171, 11737047



            --------------------------------------------------------------------------------

            OPatch succeeded.

10. Check all databases and listener are started properly. Send our an email to users for check

Long time.......

There has been no post for a very long time.... inactive .. Will start posting from today again..

Keep watching.. all the post in the blogs will be useful for a Core Oracle DBAs for their day today DBA activities .

Regards
Siva Prasad

Friday, June 3, 2011

RMAN Backup Script with TSM Env setting

connect target /
connect catalog catuse/catuser@rmancatlogdb
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 180 DAYS;
run {
allocate channel c3 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=C:\Program Files\tivoli\TSM\AgentOBA\tdpo_dbname.opt)';
backup database format 'DB_%d_%s_%p_%t' include current controlfile filesperset 12;
sql 'alter system archive log current';
change archivelog all crosscheck;
backup archivelog all format 'AL_%d_%s_%p_%t' filesperset 32;
backup current controlfile format '%d_%T_%t_%s_%p.ctl';
release channel c3;
}

TSM RMAN Backup Implementation & dircetory permissions issue.

TSM Implementation

We have started implementing RMAN Backup with Tivoli Storage Manager.
Things were set, TSM Client installation was done, TDPO file also was created and we have tried to run a test backup but backup fails with below error.

RMAN-03009: failure of allocate command on c1 channel at 01/23/2011
11:12:42
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
Linux-x86_64 Error: 106: Transport endpoint is already connected
Additional information: 7011
ORA-19511: Error received from media manager layer, error text:
SBT error = 7011, errno = 106, sbtopen: system error


Solution :

Wile trying to run backup TSM Client tries to update to file tdpoerror.log for which the “ORACLE” user need to have read Wright access to below location.

/usr/tivoli/tms/client/oracle/bin64/

Or

/opt/Tivoli/tms/client/oracle/bin64/

After oracle user have read write access to oracle for TSM client installation path.

Upgrade database 10.2.0.1 to 10.2.0.4 with 32 bit to 64 bit conversion

Upgrade database 10.2.0.1 to 10.2.0.4 with 32 bit to 64 bit conversion

While consolidating the database servers we had to move a database from 10.2.0.1 to 10.2.0.4 home. Here we have taken cold backup of the database on the source server and copied to target server and tried to upgrade resulted in below error, as the source database was in 32bit and target database home was in 64bit.

Error Message:

No errors.
CREATE OR REPLACE FUNCTION version_script
*
ERROR at line 1:
ORA-06544: PL/SQL: internal error, arguments: [56319], [], [], [], [], [], [],
[]
ORA-06553: PLS-801: internal error [56319]


Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Reason:

The reason was we are upgrading a database from 10.2.0.1 32 Bit home to 10.2.0.4 64 Bit home. Oracle bit upgrade 32bit database 64 bit is not automatic.

Solution :

There is one more script to be executed before we run catupgrd.sql.
There are two ways.
1. run the script utlip.sql as below

a. sqlplus > @?/rdbms/admin/utlip.sql

2. Uncomment the below line in catupgrd.sql script
vi catupgrd.sql change:
==> @@&utlip_file
to:==> @@utlip.sql

and run catupgrd.sql
3. SQL> @?/rdbms/admin/catupgrd.sql

This should solve the issue.

In active.. It been a long time ther is no post on the blog

In active.. It been a long time there is no post on the blog

was bit busy.. will keep posting here after..

Thursday, November 5, 2009

Skip an archive log or mark an archive log unavailable in RMAN backup

run {
change archivelog from logseq 44937 until logseq 44947 unavailable;
}

run {
change archivelog 44937 unavailable;
}