Wednesday 24 December 2014

External Tables

This article gives a brief understanding about External tables. External Tables are defined as tables that do not reside in the database, and can be in any format for which an access driver is provided. This external table definition can be thought of as a view that allows running any SQL query against external data without requiring that the external data first be loaded into the database.

You can, for example, select, join, or sort external table data. You can also create views and synonyms for external tables. However, no DML operations (UPDATE, INSERT, or DELETE) are possible, and indexes cannot be created on external tables.

Oracle provides the means of defining the metadata for external tables through the CREATE TABLE ... ORGANIZATION EXTERNAL statement.

Before firing the above command we need to create a directory object where the external files will reside.

CREATE OR REPLACE DIRECTORY EXT_TABLES AS 'C:\EXT_TABLES\';

Example: The example below describes how to create external files, create external tables, query external tables and create views.

Step I: Creating the flat files, which will be queried

The file "emp_ext1.dat" contains the following sample data:

101,Andy,FINANCE,15-DEC-1995
102,Jack,HRD,01-MAY-1996
103,Rob,DEVELOPMENT,01-JUN-1996
104,Joe,DEVELOPMENT,01-JUN-1996

The file "emp_ext2.dat" contains the following sample data:

105,Maggie,FINANCE,15-DEC-1997
106,Russell,HRD,01-MAY-1998
107,Katie,DEVELOPMENT,01-JUN-1998
108,Jay,DEVELOPMENT,01-JUN-1998

Copy these files under "C:\EXT_TABLES"

Step II: Create a Directory Object where the flat files will reside

SQL> CREATE OR REPLACE DIRECTORY EXT_TABLES AS 'C:\EXT_TABLES';

Directory created.

Step III: Create metadata for the external table

SQL> CREATE TABLE emp_ext
(
empcode NUMBER(4),
empname VARCHAR2(25),
deptname VARCHAR2(25),
hiredate date
)
  ORGANIZATION EXTERNAL
    (
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY ext_tables
      ACCESS PARAMETERS
      (
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        MISSING FIELD VALUES ARE NULL
      )
      LOCATION ('emp_ext1.dat','emp_ext2.dat')
    )
  REJECT LIMIT UNLIMITED;

Table created.

The REJECT LIMIT clause specifies that there is no limit on the number of errors that can occur during a query of the external data.

"The ORACLE_LOADER is an access driver for loading data from the external files into the tables."

Step IV: Querying Data

SQL> SELECT * FROM  emp_ext;

        EMPCODE EMPNAME              DEPTNAME               HIREDATE
       --------- ------------------- ---------------------- ---------
         101 Andy                       FINANCE                15-DEC-95
         102 Jack                       HRD                    01-MAY-96
         103 Rob                        DEVELOPMENT            01-JUN-96
         104 Joe                        DEVELOPMENT            01-JUN-96
         105 Maggie                     FINANCE                15-DEC-97
         106 Russell                    HRD                    01-MAY-98
         107 Katie                      DEVELOPMENT            01-JUN-98
         108 Jay                        DEVELOPMENT            01-JUN-98

8 rows selected.


Step V: Creating Views

SQL> CREATE VIEW v_empext_dev AS
SELECT * FROM emp_ext
WHERE deptname='DEVELOPMENT';
View created.


SQL> SELECT * FROM v_empext_dev;

         EMPCODE EMPNAME            DEPTNAME             HIREDATE
       ------------ ------------- ---------------------- ---------
         103 Rob                     DEVELOPMENT       01-JUN-96
         104 Joe                     DEVELOPMENT       01-JUN-96
         107 Katie                   DEVELOPMENT       01-JUN-98
         108 Jay                     DEVELOPMENT       01-JUN-98

You can get the information of the objects you have created through DBA_OBJECTS, ALL_OBJECTS or USER_OBJECTS.

SQL> SELECT OBJECT_NAME, OBJECT_TYPE FROM ALL_OBJECTS
WHERE OBJECT_NAME LIKE 'EMP_EXT';

OBJECT_NAME                 OBJECT_TYPE
---------------------- ------------------
EMP_EXT          TABLE

1 row selected.

SQL> SELECT OBJECT_NAME, OBJECT_TYPE FROM ALL_OBJECTS
WHERE OBJECT_NAME LIKE 'EXT_TABLES';

OBJECT_NAME                 OBJECT_TYPE
---------------------- ------------------
EXT_TABLES                  DIRECTORY

1 row selected.

Populating Tables using the INSERT command

You can populate data from external files using an "insert into … select from" statement instead of using SQL*Loader. This method provides very fast data loads.

Example:

Consider a table EMPLOYEES:

SQL> desc EMPLOYEES;

 Name                              Null?     Type
 --------------------------------- -------- --------------

 EMPCODE                                       NUMBER(4)
 EMPNAME                                       VARCHAR2(25)
 DEPTNAME                                      VARCHAR2(25)
 HIREDATE                                      DATE

SQL> INSERT INTO employees
     (empcode,empname,deptname,hiredate) SELECT * FROM emp_ext;

8 rows created.

SQL> SELECT * FROM employees;

        EMPCODE EMPNAME               DEPTNAME               HIREDATE
       ------------ ------------------- ---------------------- ---------
         101 Andy                        FINANCE                 15-DEC-95
         102 Jack                        HRD                     01-MAY-96
         103 Rob                         DEVELOPMENT             01-JUN-96
         104 Joe                         DEVELOPMENT             01-JUN-96
         105 Maggie                      FINANCE                 15-DEC-97
         106 Russell                     HRD                     01-MAY-98
         107 Katie                       DEVELOPMENT             01-JUN-98
         108 Jay                         DEVELOPMENT             01-JUN-98

8 rows selected.

Direct Loader

TWO TYPES OF LOADER
=======================
1. DIRECT LOADER :- DIRECT LOADER WORK ON HIGH WATER MARK & FIRST IS RECORD INSERT ON TEMORARY SEGMENT ,
   AFTER THE COMMIT EXECUTE THEN APPLY THE PARAMANENT

2. SQL*LOADER:- SQL*LOADERIS THE EXTERNAL TABLE ENTRY & INSERT THE RECORD ON TABLE THROUGH EXTERNAL TABLE.

=========================================
DIRECT LOAD:-
SERIAL DIRECT LOAD (HIGH WATER MARK )
=========================================

##THIS QUERY BY DEFAULT LOGGING MODE ,THIS OPERATION GENERATE REDO ENTRIES FOR RECOVERY PURPOSE

INSERT /*+APPEND+*/ INTO ABC
LOGGING
SELECT * FROM EMP WHERE DEPTNO=20


##WHEN THIS QUERY "NOLOGGING" MODE ,THIS OPERATION NOT GENERATED REDO ENTRIES FOR RECOVERY PURPOSE

INSERT /*+APPEND+*/ INTO ABC
NOLOGGING
SELECT * FROM EMP WHERE DEPTNO=20


EXAMPLE:-
===========
SQL> SELECT * FROM EMP;
SQL> CREATE TABLE ABC AS SELECT * FROM EMP;
SQL> SET LINE 320
SQL> SPOOL C:\TEMP\ABC.TXT;
SQL >SELECT * FROM ABC WHERE DEPTNO=20;
SQL> SPOOL OFF;
SQL. DELETE FROM ABC WHERE DEPTNO=20;

SQL> INSERT /*+APPEND+*/ INTO ABC SELECT * FROM EMP WHERE DEPTNO=20

NOTE:- SEE THE DEPTNO 20 RECORDS ARE INSERT END OF THE ROW FOR ALL RECODS IT'S HIGH WATER MARK i.e. CONTIGOUES ENTRY OR BUNCH OF RECODRS ENTRY (SERIAL CONTIGIOUS EXTENT ENTRY)

FOR EG:- YOU WILL INSERT NORMAL ROW & THIS QUERY INSERT ROW SEE THE DIFFERENCE



=============================================
DIRECT LOAD:-
PARALLEL DIRECT LOAD (HIGH WATER MARK )
=============================================

## PARALLEL "DML" CODE PERFORM FOR THE SESSION ONLY

SQL> ALTER SESSION ENABLE PARALLEL DML;


## PRALLEL INSERT RECORD IN THE TABLE, THE "8" IS DENOTED THE PROCESS "8" RECORD i.e. (8 ENTRIES INSERTED INTO THE TABLE PARALLELY AT A TIME )

INSERT /*+ PARALLEL(ABC,8) */ INTO ABC SELECT * FROM EMP WHERE DEPTNO=20;




SQL> DROP TABLE ABC;
SQL> SELECT * FROM EMP;
SQL> CREATE TABLE ABC AS SELECT * FROM EMP;
SQL >SELECT * FROM ABC WHERE DEPTNO=20;
SQL> DELETE FROM ABC WHERE DEPTNO=20;
SQL> COMMIT;
SQL> ALTER SESSION ENABLE PARALLEL DML;
SQL> INSERT /*+PARALLEL(ABC,8)*/ INTO ABC SELECT * FROM EMP WHERE DEPTNO=20;

NOTE:- SEE THE DEPTNO 20 RECORDS ARE INSERT END OF THE ROW FOR ALL RECODS IT'S HIGH WATER MARK i.e. CONTIGOUES ENTRY & PARALLELY

## PARALLEL DIRECT LOAD INSERT INTO A NONPARTIONED TABLE
DIRECT LOADER WORK ON HIGH WATER MARK & FIRST IS RECORD INSERT ON NEW TEMORARY SEGMENT, AFTER THE COMMIT EXECUTE THEN APPLY THE ARAMANENT

## PARALLEL DIRECT LOAD INSERT INTO A PARTIONED TABLE
PARALLEL EXECUTION SERVER IS ASSIGNED ONE OR MORE PARTITIONS,WITH NO MORE THAN ONE PROCESS WORKING PER PARTITION ,WITH NO MORE THANONE PROCESS WORKING PER PARTION.

THE PARALLEL EXECUTION SERVER INSERTS DATA BEYOND THE CURRENT "HWM" OF THE PARTION SEGMENTS ASSIGNED TO IT.

WHEN A STATEMENT EXECTES,THE "HWM" OF EACH PARTION SEGMENT IS UPDATED BY THE PARALLEL EXECUTION CO-ORDINATOR TO THE NEW VALUE,MAKING THE DATA VISIBLE TO OTHERS.




SQL*LOADER

Loader Method (1)

CREATE THE STRUCTUER OF TABLE:

CREATE TABLE T(EMPNO NUMBER,EMPNAME VARCHAR(20),SAL NUMBER,DEPTNO NUMBER);

====================================================================

CREATE LOADER FILE (ctl) FILE AS Fallows
load data
infile 'c:\data\mydata.csv'
into table T
fields terminated by "," optionally enclosed by '"'
( empno, empname, sal, deptno )


And save the file with any name but with the extension of .CTL in any location

Create the the datafile in which all the data u have for inset into the table

10001,"Scott Tiger", 1000, 40

10002,"Frank Naude", 500, 20

Save the datafiel with 'c:\data\mydata.csv' name :

Now fire the command in c:\

sqlldr HR/HR control=C:\DATA\A.ctl



Loader Method (2)
Create the structure of table in hr as fallows:

create table d(dept char(4),deptname char(20));

than create a .CTL file as given below in the any location and save with .CTL

load data
infile *
replace
into table d
( dept position (01:05) char(4),
deptname position (08:27) char(20))
begindata
COSC COMPUTER SCIENCE
ENGL ENGLISH LITERATURE
MATH MATHEMATICS
POLY POLITICAL SCIENCE

Use the following Command on c:\ for insert data into hr table d.

sqlldr HR/HR control=C:\DATA\F.ctl


Loader Method (3)
Excel File uploads into database:

Create the Structure of Table l into database

create table l(rollno number,sname varchar(10),sal number);

create a excel file with data into it and save it into any location with .CSV Format and make the .CTL file for loading data of excel file like that.

load data
infile 'c:\data\dil.csv'
into table l
fields terminated by "," optionally enclosed by '"'
( rollno, sname, sal )

Fire the Command into the C:\

sqlldr HR/HR control=C:\data\l.ctl

Master Note For OPatch

For the most current information, please refer to:
(Doc ID 293369.1) Master Note For OPatch



Master Note For OPatch


For the most current information, please refer to:
(Doc ID 293369.1) Master Note For OPatch

Applies to:

Oracle Universal Installer - Version 1.0.0.0.50 and later
Information in this document applies to any platform.

Purpose

To provide a comprehensive list of commonly used Opatch notes.

Scope

This is applicable to all levels of expertise for Opatch.

Details

Ask Questions, Get Help, And Share Your Experiences With This Article

Would you like to explore this topic further with other Oracle Customers, Oracle Employees, and Industry Experts?

Click here to join the discussion where you can ask questions, get help from others, and share your experiences with this specific article.

Discover discussions about other articles and helpful subjects by clicking here to access the main My Oracle Support Community page for Database Install/Upgrade.

 General

Note 1451669.1 FAQ : Understanding OPatch Tool And Patching
Note 224346.1 OPatch - Where Can I Find the Latest Version of OPatch?
Note 374092.1 Which OPatch version to download to apply/rollback interim patches?
Note 453495.1 FAQs on OPatch Version : 11.1
Note.334108.1 OPatch version 10.2 - FAQ

Note 433218.1 Why Should You Install 32-Bit JDK/JRE When You Have 64-Bit Oracle and Operating System ?
Note 1475077.1 Can the $ORACLE_HOME/jdk and $ORACLE_HOME/jdk/jre Directories Be Removed?
Note 1449674.1 Is It Supported to Update /Upgrade the Default JDK/JRE in Oracle Home?

Note 1446582.1 Frequently Asked Questions (FAQ): Patching Oracle Database Server
Note 865255.1 Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch

Note 1376691.1 Composite Patches for Oracle Products [Video]
Note 761111.1 RDBMS Online Patching Aka Hot Patching
Note 1463390.1 Limits Of Online Patching

Note 563656.1 Different types of Patch Conflicts - Superset/Subset/Duplicate/Bug/File
Note 1321267.1 Database Patch conflict resolution
Note 1299688.1 Patch conflict resolution
Note 1061295.1 Patch Set Updates - One-off Patch Conflict Resolution

Note 418537.1 Significance of oraInst.loc When Installing Oracle Products and Applying Patches
Note 812874.1 Understanding and Diagnosing MISSING_COMPONENT and/or SKIPPING_COMPONENT messages during opatch apply
Note 551222.1 Why Does OPatch Backup The Same Library Multiple Times?
Note 283367.1 OPatch for Oracle Application Server 10g (10.1.2, 10.1.3, 10.1.4)
Note 403212.1 Location Of Logs For Opatch And OUI
Note 403218.1 Can You Delete $ORACLE_HOME/.patch_storage Directory?

Note 861152.1 Does  PSU Released For Oracle 10gR2 (10.2.0.4) ,11g R1 (11.1.0.7) and 11g R2( 11.2.0.1) Change The Database Version/Fifth Digit?

How To

Note 298906.1 How To Repair A Corrupted Inventory For RDBMS
Note 556834.1 Steps To Recreate Central Inventory(oraInventory) In RDBMS Homes
Note 406037.1 Using OPatch -report option, how to check for potential conflicts during patch apply without Database / Listener shutdown
Note 458485.1 How to find whether the one-off Patches will conflict or not?
Note 550522.1 How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space.
Note 749787.1 How to run opatch in silent mode?
Note 821263.1 How to confirm that a Critical Patch Update (CPU) has been installed in Linux / UNIX
Note 750350.1 How To Find The Description/Details Of The Bugs Fixed By A Patch Using Opatch?
Note 729384.1 How To Find If a Specific Patch Has Been Applied On Oracle 8i or 9.0.1 (or 9i R1)?
Note 470225.1 How To Use Truss With Opatch?
Note 312767.1 How to Rollback a Failed Interim Patch Installation
Note 966023.1 How to create a ocm response file for opatch silent installation.
Note 459360.1 How To Do The Prerequisite/Conflicts Checks Using OUI(Oracle Universal Installer) And Opatch Before Applying/Rolling Back A Patch
Note.739963.1 Using AIX commands genld, genkld and slibclean to avoid library file locking errors (libjox)
Note 1394537.1 How To Rollback An Online Patch If The Database Is Down Or Removed
Note 453399.1 How To Check if inventory.xml/comps.xml Or Any Oracle XML File Is Correct?
Note 1474666.1 How to apply OC4J patch (13705478) on RDBMS home

Diagnostic Tools For Opatch

Note 1430571.1 Script To Collect Opatch Diagnostic Information For Unix Platform (opatchdiag.sh)
Note 1441309.1 Oneoffsdiag.sh:Script To Verify The Existance Of $ORACLE_HOME/inventory/oneoffs/PATCH_ID and also actions.xml and actions.xml inventory.xml in $ORACLE_HOME/inventory/oneoffs/PATCH_ID/etc/config

Known Issues

With Inventory

Note 229773.1 ALERT Applying Multiple Interim Patches Using OPatch Can Cause Inventory Corruption
Note 401454.1 Opatch Lsinventory Raises An OPatchException While Accessing O2O
Note 413829.1 Opatch Fails With 'Can not get details for given Oracle Home'
Note 417275.1 OPatch Lsinventory Reports `Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/transform/Source` When Executed Against 9.2.0.x
Note 417694.1 "OUI-67124:Inventory check failed: Patch ID is not registered in Oracle Home Inventory" while applying one-off patches using opatch
Note 431783.1 Opatch Lsinventory Result Shows: * Warning: no filemap entries available.
Note 795452.1 Opatch reports Error when using multiple oracle users
Note 864117.1 Opatch error: "Inventory load failed... OPatch cannot load inventory for the given Oracle Home."
Note 821550.1 Opatch Lsinventory Error: " Unable To Parse The Xml File"
Note 861677.1 Opatch error : "Unable to lock Central Inventory"
Note 864803.1 Opatch error: "Apply Session failed: ApplySession failed to prepare the system. No detail available."
Note 437026.1 ERROR :"OPatch cannot find a valid oraInst.loc file to locate Central Inventory.OPatch failed with error code 104"
Note 728417.1 OPatch Fails With "LsInventorySession failed:OracleHomeInventory gets null oracleHomeInfo"
Note 751152.1 Opatch Lsinventory Fails With "Unable to create patchObject" OPatch failed with error code 73
Note 1086853.1 OPatch Lsinventory Reports "OUI-67076 : OracleHomeInventory was not able to create a lock file"
Note 876343.1 Patch conflict Error OUI-67301 on 11.1.0.7.0 due to one off in inventory
Note 1185246.1 OPatch Fails With "OUI-67028:Inventory load failed"
Note 1308866.1 Opatch Cannot Load Inventory For The Given Oracle Home
Note 1456247.1 The opatch apply failing with OPatch failed with error code 39 :This patch requires some components to be installed in the home. Either the Oracle Home doesn't have the components or this patch is not suitable for this Oracle Home.

With Java

Note 332698.1 OPatch was not able to locate executable jar
Note 417372.1 OPATCH Error " java.lang.UnsatisfiedLinkError: ... liboraInstaller.so: ... "
Note 808368.1 opatch: cannot open shared object file.  Possible cause: architecture word width mismatch
Note 974371.1 After Installing The 11.2.0.1 32-bit Client Software On SPARC Solaris, OPatch and OUI Fail With ELFCLASS32 Errors For liboraInstaller.so
Note 417177.1 ERROR : "Java could not be located. OPatch cannot proceed!.OPatch failed with error code = 1"
Note 1474852.1 UTE011: Active tracepoint array length for JVM is 7559; should be 7577 Could not create JVM.
Note 1475894.1 Opatch commands error: JVMJ9VM019E Fatal error: Unable to find and initialize required class java/lang/ClassCircularityError

With Pre-Patching

Note 943436.1 Opatch Prereq Checkapplicable Error: "Unable to create Patch Object. Check if the given patch location is correct"
Note 780858.1 OPatch Fails With `Prerequisite check "CheckActiveFilesAndExecutables" failed` And `Following executables are active : $ORACLE_HOME/lib/libnmemso.so`
Note 882932.1 Prerequisite check "CheckPatchApplicableOnCurrentPlatform" failed When Applied Generic Patch 8282506
Note 861507.1 PSU Opatch conflict check fails with "OPatch failed with error code 73"
Note 292946.1 Opatch Detecting Wrong Platform Id For Install Of Patch
Note 404473.1 OPatch Reports Error "Opatch detects your platform as... this patch...supports platforms: 0 (Generic Platform)"
Note 602334.1 Opatch Not Working, Reporting That It Is Obsolete
Note 729218.1 ERROR: "The Oracle Home does not meet OUI version requirement.OPatch failed with error code 73"
Note 257800.1 OPATCH: Interim Patch  is holding the lock from this patch
Note 312926.1 Opatch Apply Gives: Can't Locate English.Pm In @Inc
Note 1050819.1 OPatch Reports Missing Component and Prerequisite Check "CheckApplicable" Failed
Note 869945.1 Zop-40: The Patch(es) Has Conflicts/Supersets With Other Patches
Note 1231223.1 Opatch Fails With Error Code 255
Note 747049.1 Opatch rollback error: Prerequisite check "CheckActiveFilesAndExecutables" failed
Note 1475206.1 Patch <patch_number> requires OPatch version <opatch version>

With Linking

Note 417319.1 Getting Warnings While Applying Patches on Linux x86-64
Note 457126.1 Opatch Aborted After Relink Fails On Target Ioracle.
Note 789053.1 Cannot find or open library file: -l pls10 when applying a patch with 10.2
Note 402945.1 While installing one-off Patch on AIX systems, getting several WARNING messages: OUI-67215 - TOC overflow and/or xlC: not found / xlC: Execute permission denied
Note 1446945.1 "ld: warning: symbol `_start' has differing types:" While Installing Or Patching 11gR2 On Oracle Solaris Platform
Note 1457270.1 ld: warning: symbol `_start' has differing types
Note 1474762.1 WARNING:OUI-67200:Make failed to invoke "/usr/ccs/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=<path>"....'ld: fatal: file /<path to O_H>/lib/prod/lib/v9/crti.o: open failed: Permission denied
Note 1467060.1 Relinking Oracle Home FAQ ( Frequently Asked Questions)

With Post-Patching

Note 353150.1 OPatch Failing Validation Phase When Archiving Really Did Not Fail
Note 791187.1 OPatch Failing Validation Phase - OPatch versions 10.2.0.4.6 and 11.1.0.6.6
Note 1361802.1 Opatch Auto doesn't patch the RDBMS Home if no database exists

Miscellaneous

Note 799883.1 Opatch error: OUI-67160 Unexpected end of ZLIB input stream
Note 739815.1 OUI-67294 Warning During OPatch Apply
Note 553244.1 WARNING MESSAGE "OUI-67078" and "OUI-67620" FROM OPATCH WHEN APPLYING 10.2.X PATCHES
Note 751107.1 ERROR: "Copy Action: Source file <filename> does not exist.'oracle.rdbms, <version> Cannot copy file'"
Note 553263.1 Opatch Reports 'libclntsh.so.10.1 not removed. Text file busy'
Note 563356.1 OPatch error 'file not found' message on 11.1.0.6 32-bit
Note 1136432.1 OPatch fails with JVMXM008
Note 1066937.1 Apply Patch Fails with 'Patch ID is null' and Error Code 73
Note 1475147.1 Opatch - Failed to load the patch object. Possible causes are: OPatch failed with error code = 73 LsInventorySession failed:
Note 1108834.1 OUI-67073:ApplySession failed: Patch ID is null occurred when applying patch 9352179
Note 803097.1 OUI-67200:Make failed problem while applying a Patch
Note 730754.1 Opatch Gives Exception In Thread "Main" Unsatisfiedlinkerror: Haltimpl
Note 603465.1 OPatch Fails With "Jar not applied ... to $ORACLE_HOME/jdbc/lib/classes12.zip... 'invalid entry compressed size (expected x but got y bytes)'"
Note 1474874.1 Opatch Apply Fails - Jar Action: Source File "/<path to patch stage directory>/<filename> '<Oracle Product/Componet>': Cannot update file '/<path to ORACLE_HOME>/<directory>/<filename>' with '/<path>/<filename>'
Note.1085753.1 Opatch Failing With Error Code 74 While Applying PSU
Note 402945.1 While installing one-off Patch on AIX systems, getting several WARNING messages: OUI-67215 - TOC overflow and/or xlC: not found / xlC: Execute permission denied
Note 1055397.1 OPATCH NAPPLY HANGING
Note 1244414.1 opatch throws: Archive Action: Source file "$ORACLE_HOME/.patch_storage/........." does not exist.
Note 1269454.1 Opatch Failed With Error Code 73 Because Session Is Not Able to Create a Directory
Note 1355040.1 Online patching errors: use "OPatch util enableOnlinePatch" to add the SID(s)
Note 1462303.1 Opatch Fails With Error "No such file or directory"
Note 1474805.1 Opatch Log Shows - INFO:Skip patch patch number from list of patches to apply: This patch is not needed.
Note 1476964.1 OPatch Logging "Generic Conflict" Between Sub-Patches Of A Composite Patch
Note 1468097.1 Argument (s) Error ... Illegal File Format For Composite Patch. There Is No Composite.xml File.
Note 1435438.1 Multiple OUI Messages In OPatch Log : OUI-67161, OUI-67085, OUI-67047, OUI-67049, OUI-67048, OUI-67085 and OUI-67050

Windows Specific

Note 390761.1 Using OPatch On Windows When ORACLE_HOME Contains Space Characters
Note 416318.1 HOW TO Use Process Explorer to obtain a list of DLLs loaded by a Windows process
Note 418479.1 Files in Use errors, when running OPatch to apply patches on Windows
Note 791005.1 Opatch permissions problem on 64-bit windows 2008 and Oracle 10.2.0.3 and 10.2.0.4
Note 1446273.1 OPATCH 11.2.0.3.0 LOCKS SRVM.JAR WHEN APPLYING ANY 11.2.0.3 BUNDLE PATCH ON WINDOWS X64

Using My Oracle Support Effectively

Note 732697.1 What Information Oracle Support Need To Work On OPatch Service Requests?
Note 735257.1 What information Oracle Support needs to work on Critical Patch Update (CPU) Installation Service Requests
Note 747242.5 My Oracle Support Configuration Management FAQ
Note 868955.1 My Oracle Support Health Checks Catalog
Note 166650.1 Working Effectively With Global Customer Support
Note 199389.1 Escalating Service Requests with Oracle Support Services
Note 1194734.1 Where do I find that on My Oracle Support (MOS) [Video]

Generic Links

Note 1454618.1 Quick Reference To Patch Numbers For Database PSU, CPU And Bundle Patches
Note 854428.1 Patch Set Updates for Oracle Products
Note 268895.1 Oracle Database Server Patchset Information, Versions: 8.1. 7 to 11.2.0
Note 161549.1 Oracle Database Server and Networking Patches for Microsoft Platforms
Note 161818.1 Oracle Database (RDBMS) Releases Support Status Summary

References

NOTE:1351112.2 - Information Center: Upgrading and Migration Oracle Database
NOTE:1351022.2 - Information Center: Overview Database Server/Client Installation and Upgrade/Migration
NOTE:1298096.1 - Master Note For Database and Client Certification
NOTE:1351428.2 - Information Center: Patching and Maintaining Oracle Database Server/Client Installations
NOTE:1351051.2 - Information Center: Install and Configure Database Server/Client Installations

Opatch Apply and Rollback

OPATCH

 ORACLE VERSION 10.2.0.4.0

Before applying OPatch in production Database, check it on Test Database.
Shut-DOWN all Databases even their Listeners of corresponding $ORACLE_HOME.
Take a cold backup of ORACLE_HOME
Check Opatch Current Version Before applying.
Shutdown all services of corresponding Databases.

Backup of ORACLE_HOME using Tar command…

cd $ORACLE_HOME  (/d001/ora/product/10.2.0)
ls (Result:-  /d001/ora/product/10.2.0)

cd ..(Result:- /d001/ora/product)
ls  (Result:- /d001/ora/product)


cd ..(Result:- /d001/ora/oradata)
ls  (Result:- /d001/ora/oradata)

Syntax:- tar -cvzf orahome.tar 10.2.0
Syntax:- tar -cvzf oradata.tar oradata

ls


orahome.tar  
==> This is new tar file of oracle home.

10.2.0
==> This is our oracle home directory


oradata.tar  
==> This is new tar file of oracle database backup.


Steps to apply OPATCH:


à  Download the said Patch # 6084656, 6521934 (Patch number suggested by oracle)

p6084656_10204_Linux-x86.zip,   p6521934_10204_Linux-x86.zip

à Put corresponding patch zip file in your preferred location.
       [Exp: - $> cd /u02/]

à Set current working directory as compatible to OPatch apply.
       [Exp: - $> export PATH=$PATH:$ORACLE_HOME/OPatch]  
                          
à Now fire “$>opatch lsinventory” command. It must be succeeded.

à unzip the patch-file in C.W.D. (/northact/oratest/kml_patch_dir/)
   [Exp: - $> unzip p6084656_10204_Linux-x86.zip]
          · It would create a folder by the number (patch name) à 6084656

à Navigate to the extracted-Patch-folder where the patch-file was unzip/extracted
         [Exp: - $> cd /u02/6084656/]


à Run the Opatch apply command to apply the Patch as:
         [Exp: - $> opatch apply]  [It must be succeed]


(Patch would then be applied, after which you may bring the Database & Listener UP)



Steps to rollback OPATCH:

à   Shut-DOWN all Databases even their Listeners of corresponding $ORACLE_HOME.

à Take a cold backup of ORACLE_HOME.

à Set current working directory as compatible to OPatch apply.
       [Exp: - $> export PATH=$PATH:$ORACLE_HOME/OPatch]  
                          
à Now fire “$>opatch lsinventory” command. It must be succeeded.

à Run the Opatch rollback command to rollback the Patch as:
         [Exp: - $> opatch rollback –id <6084656>]  [It must be succeed]

Tuesday 23 December 2014

Rman backup using standby database

Rman backup using standby database

Some companies want to schedule backup from the standby database to reduce the load in the production environment. Infact standby serve this purpose without any additional effort.

Backup of standby database is similar to production. To take consistent backup we need to cancel the recovery mode and bring the database in mount mode, otherwise the backup will be in inconsistent mode.

The rman user id should be part of sysdba

$ rman target rman/oracle@db1 catalog rmanUser/passwd@catalog
RMAN> backup database;
RMAN> backup archivelog all;

Note:

1.Both the primary database and standby database should use the same recovery catalog


2.The control file and SPFILE must be backed up on the primary database. 


3. It is not advisable to run the backup from both the standby and primary database.
    When you run delete obsolete ,you may get the below error if backup has been taken from both primary and standby databases.

             RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
             RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status
             RMAN-06210: List of Mismatched objects

4. if at all you would like to take backup from both the primary and standby,Use a different recovery catalog schema for each of these two targets.  still you need to take the controlfile backup from the primary database.

Rac Database Backup Configuration - 11gr2

Configuring backup purely depends on the nodes where backup appliance has been configured. Here are som of the common methods followed in most of the organisations.

1. Single or muliple backup/storage media configured in first ( one ) node only.So want to run the backup from the first node only.

    This is the most common approach.Depends on the no of tape device configured,no of channels can be allocated to parallelise the rman backup. ( IT is a myth that more channels will always improve the performance of rman backup)

The below example script will help us to schedule a backup with two channels 

run {
    allocate channel t1 type 'sbt_tape'  format 'df.%d.%f.dbf_t%t_s%s_p%p.rmn'   maxpiecesize 5G  parms 'ENV=(NSR_SERVER=tape_srv)';
   allocate channel t2 type 'sbt_tape'  format 'df.%d.%f.dbf_t%t_s%s_p%p.rmn'    maxpiecesize 5G  parms 'ENV=(NSR_SERVER=tape_srv)';
  backup   incremental level 0   filesperset 10   tag 'INC1_DATABASE'    database;
 }

2. Backup/Storage media configured in all nodes and want to run the backup from all instances 

2.1 Dedicate the channel to a particular instance irrespective of the load on the instance

CONFIGURE DEFAULT DEVICE TYPE TO SBT;
CONFIGURE DEVICE TYPE SBT Parallelism 3;
configure channel 1 device type sbtconnect='rman_id/rman_pwd@racdb1';
configure channel 2 device type sbtconnect='rman_id/rman_pwd@racdb2';
configure channel 3 device type sbtconnect='rman_id/rman_pwd@racdb3';
run{
backup
     incremental level 0
     tag 'INC1_DATABASE'
     database;
 }


2.2  To run the backup based on the load,
create a service with the preferred instances and connect the backup session through the service name. Oracle will automatically direct the channels to the instances where the loads are less

CONFIGURE DEFAULT DEVICE TYPE TO SBT;
CONFIGURE DEVICE TYPE SBT Parallelism 3;
configure channel 1 device type sbt connect='rman_id/rman_pwd@Service1';

2.3 Non-determinstic connection - 11g new feature.
    With this oracle automatically decides the instance where the channel need to be run.    Just mention the parallelism will be sufficient to avail this feature.

CONFIGURE DEFAULT DEVICE TYPE TO SBT;
CONFIGURE DEVICE TYPE SBT Parallelism 3;

3.Backup/Storage media configured in Standby database

Some companies want to schedule backup from the standby database to reduce the load in the production environment. Infact standby serve this purpose without any additional effort.

Backup of standby database is similar to production, it is exactly same as production. To take consistent backup we need to cancel the recovery mode and bring the database in mount mode, otherwise the backup will be in inconsistent mode.