Friday, April 17, 2015

Introduction of Opatch and how to apply

Introduction to Opatch

Opatch is Oracle supplied utility .

OPatch is used for patching Oracle software. 

OPatch is a java based utility that allow the application and rolling back of interim patches to an Oracle 

product

The program has sub-commands that may take arguments.

 Getting and using Opatch utility

OPatch is PLATFORM specific.

Release is based on Oracle Universal Installer version

The latest opatch utility can be downloaded via patch number 6880880 from My Oracle Support .

Downloaded Patch to be unzipped in OH , which will create a directory $ORACLE_HOME/Opatch

Execute the following command  to verify the version

        $ORACLE_HOME/Opatch/opatch version

 Main functionality of Opatch    

Applying the patch 

Rollback the patch 

Conflict check 

Report the installed components and patches

 Set PATH environment variable

Windows: set PATH=%ORACLE_HOME%/OPatch:%PATH%

Unix: export PATH=$ORACLE_HOME/OPatch:$PATH

 Opatch prerequisite checks

Check ORACLE_HOME  environment variable

Check for JRE / JDK

Check for Oracle Universal Installer and OPatch Version Compatibility

Checks for PERL( specific to 9i/10gR1 )

Check for Patch Applicable on Operating System

Check for System Space

Check for System Commands, which are used for system updates    e.g. fuser , ar , ld …etc..

Architecture of Inventories

Inventory Pointer file

Default Location : /etc/oraInst.loc or /var/opt/oracle/oraInst.loc ( for most UNIX systems )

Gives the location of central inventory

Central Inventory

Location given by Inventory pointer file.

As per OFA architecture, $ORACLE_BASE/oraInventory

Critical File : - <central-inventory>/ContentsXML/inventory.xml

Provides information about Oracle installations present on system

On Windows : C:\Program Files\Oracle\Inventory

Local Inventory( Oracle Home inventory )

Location : $ORACLE_HOME/inventory

Critical File : - $ORACLE_HOME/inventory/ContentsXML/comps.xml

Contains list of installed components/interim patches in this particular Oracle Home 

Environment variables used by OPatch

ORACLE_HOME : This variable must point to a valid Oracle Home and matches the value when that 

Oracle Home was installed.

OPATCH_DEBUG: Setting this variable to "true" sets the log level to debug.

OPATCH_PLATFORM_ID : If this variable to set to some numeric value, then OPatch skips platform ID 

check and assumes the platform ID to be the one specified here.

OPATCH_NO_FUSER: Setting this variable to "true" informs the OPatch to skip the check for active 

executables.

PATH: This variable must have a valid Opatch utility location included in it. 

Most common commands available with OPatch

$ 'opatch apply ...' is to apply a patch

$ 'opatch rollback ...' is to roll back a patch

$ 'opatch lsinventory' is to show inventory on an Oracle Home

$ 'opatch query ...' is to query a given patch from specific details

$ 'opatch version' is to show the version of the OPatch being used

$ 'opatch prereq ...' is to invoke some prerequiste checks

$ 'opatch util ...' is to invoke some independent utilities 

Opatch –help

Opatch -help command  : Invoking OPatch without arguments or with the 'help' sub-command returns 

the list of valid sub-commands to the user:

Usage: opatch [ -help ] [ -r[eport] ] [ command ]

opatch –help apply

opatch –help lsinventory

opatch –help nappl

opatch –help nrollback

opatch –help rollback

opatch –help query

opatch –help version

opatch –help prereq

opatch –help util 


Sunday, April 12, 2015

CREATE DTABASE USING COLD BACKUP

DEVELOPMENT SERVER(SWO1143) :

Step1: Copy the backup files from source server to target server.

                -source server = ( sw00888,sw00889,sw00891 )

                -target server = ( sw01143 Development server)

Step2: we need to install only oracle software in this server (sw01143).

                -oracle database version =11.2.0.3

Step3: Copy all the datafiles,Redolog files, controlfiles from backup location to              

original location.

 -install oracle binaries on ORACLE_HOME=E:\Oracle\Product\11.2.0\dbhome_1.

 -Backup location = F:\oradata\copy ( sw00888 server)

  in development server :

             -Datafiles location: E:\oradata\instance_name\*.dbf

             -Controlfiles location E:\oradata\instance_name\*.ctl

             -Redologfiles location E:\oradata\instance_name\*.rdo

Step4: Copy the pfile “initsw01143.ora”  in “ORACLE_HOME\database” location.

               -Pfile Having the bellow parameters  (Example)

               dousna01._db_cache_size=557842432

                             dousna01._java.pool_size=20971520

                        'E:\ORADATA\DOUSNA01\CONTROL01.CTL'

dousna01._large_pool_size=4194304

dousna01._shared_pool_size=243269632

dousna01._streams_pool_size=4194304

compatible='10.2.0.3'

control_files='E:\ORADATA\DOUSNA01\CONTROL01.CTL'

          'E:\ORADATA\DOUSNA01\CONTROL01.CTL'

db_block_size=8192

db_domain='se.hvwan.net'

db_file_multiblock_read_count=16

db_name='dousna01

db_recovery_file_dest_size=2147483648

dispatchers='(protocal=tcp)  (service=dosehvo4xdb)

java_pool_size=2000000

job_queue_processess=0

nls_language='AMERICAN'

nls_territory='AMERICA'

open_cursors=300

open_links=24

pga_aggregate_target=314572800

processess=150

recyclebin='OFF'

remote_login_passwordfile='EXCLUSIVE';

replication_dependency_tracking=TRUE

sga_target=838860800

……

Step5: Make a directories as mension in the pfile like dumps, and change the

 Open the command prompt and perform those commands

--sql prompt will open

 Set ORACLE_SID=Sw01143

 Check “echo %ORACLE_SID%

 ORADIM –new –sid sidname(dousju01)( it will create instance in winds)

 Set ORACLE_HOME=Oracle_home path

 Run Sqlplus “/as sysdba”

 Fire the “startup” command

 Database will open in noarchive log mode, put into Archivelog mode.

           

                  Using bellow query  in sql prompt check the database mode

          SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE

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

        NOARCHIVELOG

                   Put the database in mount stage and then run the query

                                           SQL> startup mount

                  ORACLE instance started.

                  Total System Global Area  184549376 bytes

                  Fixed Size                  1300928 bytes

                  Variable Size             157820480 bytes

                  Database Buffers           25165824 bytes

                  Redo Buffers                 262144 bytes

                  Database mounted.

                                            Database altered.

                                   Database altered.

                             SQL> select log_mode from v$database;

        SQL> alter database archivelog;

     SQL> alter database open;

LOG_MODE

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

      ARCHIVELOG