Tuesday, June 16, 2015

Apply PSU6 Manually


In this post I am describing how to manually apply the PSU patch on both GI home and RAC Home respectively. 

when one uses opatch auto the whole process is automated which we are going to do manually. Opatch will check the applicability of the each component of the PSU patch and apply it on GI OR RAC home accordingly. 


##
## APPLY PSU 6 i.e. patch 20834621
##
PSU 6 has following patch components. One has to apply this components both on GI home and RAC Home. 
Before starting the patch process, make sure you dont have any conflicts with prior applied patches.


GI PSU - 
GI PSU component         - 20485808
DB PSU - 20299013
OCW Component - 20420937
ACFS Component - 20299019 

Process - 

root@host301[/ora00/app/11.2.0.4/grid/crs/install]# ./roothas.pl -unlock
Using configuration parameter file: ./crsconfig_params

Successfully unlock /ora00/app/11.2.0.4/grid


Run the pre root script. If this is a GI Home, as the root user execute:
# /ora00/app/11.2.0.4/grid/crs/install/roothas.pl -unlock



##
## RUN SLIBCLEAN AS ROOT( only for AIX )
##
root@host401[/ora00/app/11.2.0.4/grid]# /usr/sbin/slibclean


PATCH - 20834621

Apply the CRS patch using grid user. As the GI home owner execute:

$ /ora00/app/11.2.0.4/grid/OPatch/opatch apply -oh /ora00/app/11.2.0.4/grid -local /11204_PSU6/20834621/20485808/20420937

Patching component oracle.crs, 11.2.0.4.0...

Verifying the update...
Patch 20420937 successfully applied
Log file location: /ora00/app/11.2.0.4/grid/cfgtoollogs/opatch/opatch2015-05-01_18-12-49PM_1.log

OPatch succeeded.

##

As the GI home owner execute:
$ /ora00/app/11.2.0.4/grid/OPatch/opatch apply -oh /ora00/app/11.2.0.4/grid -local /11204_PSU6/20834621/20485808/20299019

Patching component oracle.usm, 11.2.0.4.0...

Verifying the update...
Patch 20299019 successfully applied
Log file location: /ora00/app/11.2.0.4/grid/cfgtoollogs/opatch/opatch2015-05-01_18-23-01PM_1.log

OPatch succeeded.

##


As the GI home owner execute:
$ /ora00/app/11.2.0.4/grid/OPatch/opatch apply -oh /ora00/app/11.2.0.4/grid -local /11204_PSU6/20834621/20485808/20299013

Composite patch 20299013 successfully applied.
OPatch Session completed with warnings.
Log file location: /ora00/app/11.2.0.4/grid/cfgtoollogs/opatch/opatch2015-05-01_18-24-59PM_1.log

OPatch completed with warnings.

Composite patch 20299013 successfully applied.
OPatch Session completed with warnings.
Log file location: /ora00/app/11.2.0.4/grid/cfgtoollogs/opatch/opatch2015-05-01_18-24-59PM_1.log

OPatch completed with warnings.


AS ORACLE USER - 

Run the pre script for DB component of the patch. As the database home owner execute:
$ /11204_PSU6/11204_PSU6/20834621/20485808/20420937/custom/scripts/prepatch.sh -dbhome /ora01/app/oracle/product/11.2.0.4/db_1

Apply the DB patch. As the database home owner execute:

$ /ora01/app/oracle/product/11.2.0.4/db_1/OPatch/opatch apply -oh /ora01/app/oracle/product/11.2.0.4/db_1 -local /11204_PSU6/11204_PSU6/20834621/20485808/20420937/custom/server/20420937

Patching component oracle.rdbms, 11.2.0.4.0...

Verifying the update...
Patch 20420937 successfully applied
Log file location: /ora01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2015-05-01_19-33-25PM_1.log

OPatch succeeded.

$ /ora01/app/oracle/product/11.2.0.4/db_1/OPatch/opatch apply -oh /ora01/app/oracle/product/11.2.0.4/db_1 -local /11204_PSU6/20834621/20485808/20299013

Composite patch 20299013 successfully applied.
OPatch Session completed with warnings.
Log file location: /ora01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2015-05-01_19-35-30PM_1.log

OPatch completed with warnings.



Run the post script for DB component of the patch. As the database home owner execute:
$ /11204_PSU6/20834621/20485808/20420937/custom/scripts/postpatch.sh -dbhome /ora01/app/oracle/product/11.2.0.4/db_1

Reapplying file permissions on /ora01/app/oracle/product/11.2.0.4/db_1/srvm/admin/ractrans
Reapplying file permissions on /ora01/app/oracle/product/11.2.0.4/db_1/srvm/admin/getcrshome
Reapplying file permissions on /ora01/app/oracle/product/11.2.0.4/db_1/bin/gnsd
Reapplying file permissions on /ora01/app/oracle/product/11.2.0.4/db_1/bin/crsdiag.pl
Postpatch completed successfully


Run the post script. As the root user execute:
# /ora00/app/11.2.0.4/grid/rdbms/install/rootadd_rdbms.sh

-- 
If this is a GI Home, as the root user execute:
# /ora00/app/11.2.0.4/grid/crs/install/roothas.pl -patch

Using configuration parameter file: /ora00/app/11.2.0.4/grid/crs/install/crsconfig_params
ACFS driver install actions failed
CRS-4123: Oracle High Availability Services has been started.

The following steps load modified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.

Install the SQL portion of the patch by running the following command. For an Oracle RAC environment, reload the packages on one of the nodes.

# cd $ORACLE_HOME/sqlpatch/20406239
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> startup upgrade
SQL> @postinstall.sql
SQL> shutdown
SQL> startup 

Now run the following script for each database running out of this RDBMS Home.

SQL> $ORACLE_HOME/rdbms/admin/catbundle.sql PSU APPLY 

After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

Hope this helps...

Friday, June 5, 2015


Convert Oracle RAC Cluster to RAC One 


During one of the recent deployments, we came across the scenario, where we have to convert out two node RAC cluster to One Node RAC One node.
We tried to find proper MOS note but could not find any, though there are plenty of notes to convert the otherwise i.e. from RAC One to RAC.

So I thought it will be good to put up a note with all the detailed information. 

NodeA -

SYS@racon1 SQL> sho parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      racon


$ srvctl config database -d racon
Database unique name: racon
Database name: racon
Oracle home: /ora01/app/oracle/product/11.2.0.4/db_1
Oracle user: oracle
Spfile: +DATA1/racon/spfileracon.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racon
Database instances: racon1,racon2
Disk Groups: DATA1,ARCH1,REDO1,REDO2
Mount point paths:
Services:
Type: RAC
Database is administrator managed

$ crsctl stat res  | grep ora.racon.db
NAME=ora.racon.db
< NodeA : racon1 : oracle : /users/oracle >
$ crsctl stat res ora.racon.db -p
NAME=ora.racon.db
TYPE=ora.database.type
ACL=owner:oracle:rwx,pgrp:oinstall:r--,other::r--,group:dba:r-x,group:oinstall:r-x,user:grid:r-x
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
AUTO_START=restore
CARDINALITY=2
.................
.................
GEN_START_OPTIONS@SERVERNAME(NodeA)=open
GEN_START_OPTIONS@SERVERNAME(NodeB)=open
GEN_USR_ORA_INST_NAME=
GEN_USR_ORA_INST_NAME@SERVERNAME(NodeA)=racon1
GEN_USR_ORA_INST_NAME@SERVERNAME(NodeB)=racon2
HOSTING_MEMBERS=
INSTANCE_FAILOVER=0
LOAD=1
LOGGING_LEVEL=1
MANAGEMENT_POLICY=AUTOMATIC
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ONLINE_RELOCATION_TIMEOUT=0
ORACLE_HOME=/ora01/app/oracle/product/11.2.0.4/db_1
ORACLE_HOME_OLD=
PLACEMENT=restricted
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=2
ROLE=PRIMARY
SCRIPT_TIMEOUT=60
SERVER_POOLS=ora.racon
SPFILE=+DATA1/racon/spfileracon.ora
START_DEPENDENCIES=hard(ora.DATA1.dg,ora.ARCH1.dg,ora.REDO1.dg,ora.REDO2.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DATA1.dg,ora.ARCH1.dg,ora.REDO1.dg,ora.REDO2.dg)
START_TIMEOUT=600
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA1.dg,shutdown:ora.ARCH1.dg,shutdown:ora.REDO1.dg,shutdown:ora.REDO2.dg)
STOP_TIMEOUT=600
TYPE_VERSION=3.2
UPTIME_THRESHOLD=1h
USR_ORA_DB_NAME=racon
USR_ORA_DOMAIN=
USR_ORA_INST_NAME=
USR_ORA_INST_NAME@SERVERNAME(NodeA)=racon1
USR_ORA_INST_NAME@SERVERNAME(NodeB)=racon2
USR_ORA_OPEN_MODE=open
USR_ORA_OPI=false
USR_ORA_STOP_MODE=immediate
VERSION=11.2.0.4.0

SYS@racon1 SQL> sho parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 10.18.nn.nn)(PORT=1521))
remote_listener                      string      xxxx.com:1521


$ srvctl status database -d racon
Instance racon1 is running on node NodeA
Instance racon2 is running on node NodeB

-- Prior to converting an Oracle RAC database to an Oracle RAC One Node database, you must first ensure that the Oracle RAC database has only one instance.

$srvctl stop instance  -d racon -i  racon2

< NodeA : racon1 : oracle : /users/oracle >
$ srvctl stop instance  -d racon -i  racon2

< NodeA : racon1 : oracle : /users/oracle >
$ srvctl status database -d racon
Instance racon1 is running on node NodeA
Instance racon2 is not running on node NodeB


$ srvctl convert database -d racon  -c RACONENODE -i racon1 -w 30
PRCD-1214 : Administrator-managed RAC database racon has more than one instance

$ srvctl remove instance -d racon -i racon2
Remove instance from the database racon? (y/[n]) y


$ crsctl stat res ora.racon.db -p
NAME=ora.racon.db
TYPE=ora.database.type
ACL=owner:oracle:rwx,pgrp:oinstall:r--,other::r--,group:dba:r-x,group:oinstall:r-x,user:grid:r-x
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
AUTO_START=restore
CARDINALITY=1
CHECK_INTERVAL=1
CHECK_TIMEOUT=30
CLUSTER_DATABASE=true
DATABASE_TYPE=RAC
DB_UNIQUE_NAME=racon
DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=database) PROPERTY(DB_UNIQUE_NAME= CONCAT(PARSE(%NAME%, ., 2), %USR_ORA_DOMAIN%, .)) ELEMENT(INSTANCE_NAME= %GEN_USR_ORA_INST_NAME%) ELEMENT(DATABASE_TYPE= %DATABASE_TYPE%)
DEGREE=1
DESCRIPTION=Oracle Database resource
ENABLED=1
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_AUDIT_FILE_DEST=/ora47/adump/racon
GEN_START_OPTIONS=
GEN_START_OPTIONS@SERVERNAME(NodeA)=open
GEN_START_OPTIONS@SERVERNAME(NodeB)=open
GEN_USR_ORA_INST_NAME=
GEN_USR_ORA_INST_NAME@SERVERNAME(NodeA)=racon1


$ srvctl convert database -d racon  -c RACONENODE -i racon1 -w 30
PRCD-1242 : Unable to convert RAC database racon to RAC One Node database because the database had no service added

$ srvctl add  service -d racon -s racon -r racon1
PRCD-1210 : The service name racon cannot be same as the database default service name racon

$ srvctl add  service -d racon -s racon_svc -r racon1

$ srvctl config service -d racon -s racon_svc
Service name: racon_svc
Service is enabled
Server pool: racon_racon_svc
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: racon1
Available instances:

 < NodeA : racon1 : oracle : /users/oracle >
$ srvctl convert database -d racon  -c RACONENODE -i racon1 -w 30

$ srvctl config database -d racon
Database unique name: racon
Database name: racon
Oracle home: /ora01/app/oracle/product/11.2.0.4/db_1
Oracle user: oracle
Spfile: +DATA1/racon/spfileracon.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racon
Database instances:
Disk Groups: DATA1,ARCH1,REDO1,REDO2
Mount point paths:
Services: racon_svc
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: racon1
Candidate servers: NodeA
Database is administrator managed


$ srvctl relocate database -d racon -n NodeB
< NodeA : racon1 : oracle : /users/oracle >
$ srvctl status database -d racon
Instance racon1_2 is running on node NodeB
Online relocation: INACTIVE

$ srvctl relocate database -d racon -n NodeA
< NodeA : racon1 : oracle : /users/oracle >
$ srvctl status database -d racon
Instance racon1_1 is running on node NodeA
Online relocation: INACTIVE

So as you can see the conversion completed successfully and so is the relocation.. 
Hope that helps...