Wednesday, December 18, 2013

ORA-12547 TNS lost contact



Issue / Oracle error

sqlplus scott/tiger
SQL*Plus: Release 10.2.0.5.0 - Production on Wed May 18 09:32:35 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
ERROR:
ORA-12547: TNS :lost contact when try to connect to Oracle.

Issue description

I saw that TNS connection issue along with ORA-12547 Oracle error several times, usually when trying to connect to Oracle database server on Unix / Linux host with an OS user that does not belong to oinstall group (Oracle binaries owner group).  In this case, interesting enough that local TNS connection to database (when using tnsnames alias) works fine:
sqlplus scott/tiger@orcl
and only local BEQ protocol connection through an Oracle error ORA-12547:

sqlplus scott/tiger
ERROR:
ORA-12547: TNS:lost contact
There can be different reasons of this issue, but usually the problem is in wrong privileges/ownership of some Oracle binaries located in $ORACLE_HOME/bin directory. Perhaps, Oracle database binaries were installed / linked not correctly or something or somebody has changed the files’ ownership.

Solution

  1. Ensure the DB is up and running and you can connect locally AS SYSDBA to the database using Oracle binaries owner (usually oracle:oinstall Unix / Linux user). If it does not work, probably you encounter a different problem.
  2. Check privileges of an Oracle file on Unix / Linux host where database is running:
  3. cd $ORACLE_HOME/bin
    ls -ltr oracle
    -rwxr-xr-x    1 oracle   oinstall       136803483 Mar 16 20:32 oracle
  4. Change permissions as below:
  5. chmod 6751 oracle
    ls -ltr oracle
    -rwsr-s--x    1 oracle   oinstall       136803483 Mar 16 20:32 oracle
  6. Usually the above operation should fix the issue but I suggest continue investigating privileges of other files to avoid further possible problems.  As the matter of fact these special rights of Oracle binaries are set by $ORACLE_HOME/root.sh script on Unix / Linux after the Oracle installation. You can run the script again as root user, if you see more files have wrong permissions or ownership (make backup before, just in case). For that I provide as an example 2 lists of oracle binary files in $ORACLE_HOME/bin directory with correct rights below.

ORA-12637 Packet receive failed


                                                   ORA-12637 Packet Receive Failed


Issue: Sometimes when your trying to login for  oracle database  from WINDOWS client box to Linux box/Windows server box  we will face issue below issues

ORA-12637 Packet receive failed


Symptoms:
Trying to connect from a remote client or even loopback on the server to the database, results in an ORA-12637 Packet receive failed. Connection attempt is in the standard form:
sqlplus scott/tiger@ORCL


Cause:

Check to see if you have the SQLNET.AUTHENTICATION_SERVICES=(NTS) line in the sqlnet.ora file (client and/or server). If you are passing usernames and passwords that will be authenticated via the Oracle database, then you should not have NTS authentication enabled or attempted. If this parameter is set, then authentication will be retrieved from the OS and, if the database and OS are not setup for OS or External Authentication, an abnormal condition exists and errors are likely

Solution:
Remove the SQLNET.AUTHENTICATION_SERVICES=(NTS) line.
Only if an external authentication mechanism (OS authentication) is to be employed will this line be used.
Note:
- If this line is removed from the Server, then the database and listener will need to be restarted.
- If this line is removed from only the Client, then no Oracle processes need to be restarted.

Tuesday, September 24, 2013

TRANSFORM in ORACLE 11g DATAPUMP

                                  TRANSFORM in ORACLE 11g DATAPUMP

Purpose
Enables you to alter object creation DDL for objects being imported.
Syntax and Description
TRANSFORM = transform_name:value[:object_type]
The transform_name specifies the name of the transform. The possible options are as follows:
  • SEGMENT_ATTRIBUTES - If the value is specified as y, then segment attributes (physical attributes, storage attributes, tablespaces, and logging) are included, with appropriate DDL. The default is y.
  • STORAGE - If the value is specified as y, then the storage clauses are included, with appropriate DDL. The default is y. This parameter is ignored if SEGMENT_ATTRIBUTES=n.
  • OID - If the value is specified as n, then the assignment of the exported OID during the creation of object tables and types is inhibited. Instead, a new OID is assigned. This can be useful for cloning schemas, but does not affect referenced objects. The default value is y.
  • PCTSPACE - The value supplied for this transform must be a number greater than zero. It represents the percentage multiplier used to alter extent allocations and the size of data files.
Note that you can use the PCTSPACE transform with the Data Pump Export SAMPLE parameter so that the size of storage allocations matches the sampled data subset.
  • SEGMENT_CREATION - If set to y (the default), then this transform causes the SQL SEGMENT CREATION clause to be added to the CREATE TABLE statement. That is, the CREATE TABLE statement will explicitly say either SEGMENT CREATION DEFERRED or SEGMENT CREATION IMMEDIATE. If the value is n, then the SEGMENT CREATION clause is omitted from the CREATE TABLE statement. Set this parameter to n to use the default segment creation attributes for the table(s) being loaded. (This functionality is available starting with Oracle Database 11g release 2 (11.2.0.2).)
The type of value specified depends on the transform used. Boolean values (y/n) are required for the SEGMENT_ATTRIBUTESSTORAGE, and OID transforms. Integer values are required for the PCTSPACE transform.

The object_type is optional. If supplied, it designates the object type to which the transform will be applied. If no object type is specified, then the transform applies to all valid object types.

Valid Object Types For the Data Pump Import TRANSFORM Parameter
SEGMENT_ATTRIBUTES
STORAGE
OID
PCTSPACE
SEGMENT_CREATION
CLUSTER
X
X

X

CONSTRAINT
X
X

X

INC_TYPE


X


INDEX
X
X

X

ROLLBACK_SEGMENT
X
X

X

TABLE
X
X
X
X
X
TABLESPACE
X


X

TYPE


X




First lets assume we took the export  full or schema mode export.
$expdp full=y dumpfile=d1.dmp directory=dps

Case 1:  Normal import 

[oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp.sql

Import: Release 11.2.0.3.0 - Production on Tue Sep 24 09:49:19 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp.sql
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
.......
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 09:49:31

[oracle@racs dp]$ vi emp.sql


CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" PARALLEL 1 ;

  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;

Using TRANSFORM option you can change or ignore these options.  Benefit is you may do not want similar metadata.  Forexample, tablespace name is pointing as USERS, current import user may be using different tablespace. As you know whenever we create a table , if your not specified the tablespace, it will take default user's tablespace.  If you want go like that case means you need to use TRANSFORM options. etc.

Case 2:  SEGMENT ATTRIBUTE option with N

 It will ignore all segment attributes(pink color) things for objects(you can verify the table for applicable objects). 

 [oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg.sql transform=segment_attributes:n

Import: Release 11.2.0.3.0 - Production on Tue Sep 24 09:51:17 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg.sql transform=segment_attributes:n
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
....
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 09:51:30


[oracle@racs dp]$ vi emp_seg.sql
  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  ;

  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") ENABLE;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Now everything is default.   

Case 3: ignore SEGMENT ATTRIBUTES FOR TABLE

[oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg_tab.sql transform=segment_attributes:n:table

Import: Release 11.2.0.3.0 - Production on Tue Sep 24 09:52:47 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg_tab.sql transform=segment_attributes:n:table
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
....
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 09:52:59

[oracle@racs dp]$ vi emp_seg_tab.sql


CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" PARALLEL 1 ;

  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;

Note:  Now attributes are ignored for table only.

Case 4: IGNORE SEGMENT ATTRIBUTES FOR INDEX

  [oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg_ind.sql transform=segment_attributes:n:index

Import: Release 11.2.0.3.0 - Production on Tue Sep 24 09:53:51 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_seg_ind.sql transform=segment_attributes:n:index
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
.....
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 09:54:01

[oracle@racs dp]$ vi emp_seg_ind.sql
 
  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  ;
  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;

Note:  Now indexes are ignored attributes.

Case 5: IGNORE THE STORGE

By default objects will get

STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)

  [oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_sto.sql transform=storage:n

Import: Release 11.2.0.3.0 - Production on Tue Sep 24 10:03:40 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_sto.sql transform=storage:n
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
....
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 10:03:53

[oracle@racs dp]$ vi emp_sto.sql


  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  TABLESPACE "USERS" ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  PCTFREE 10 INITRANS 2 MAXTRANS 255
  TABLESPACE "USERS" PARALLEL 1 ;

  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  TABLESPACE "USERS"  ENABLE;

Note: Now its ignored storage .


Case 6: Change the PCTSPACE.

PCTSPACE parameter helpful to either reduce/increase the storage space.  Whatever value you put(interms of percentage), based on metadata value its resize.

For example,  EMP table pct space is 

STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)

now pctspace=10  means it will initially allocates 10% extents and also for next extent, while importing the data.

[oracle@racs dp]$ impdp tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_pct_tab.sql  transform=pctspace:10
Import: Release 11.2.0.3.0 - Production on Tue Sep 24 10:38:42 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: dpusr
Password:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully loaded/unloaded
Starting "DPUSR"."SYS_SQL_FILE_TABLE_01":  dpusr/******** tables=scott.emp dumpfile=d1.dmp directory=dps sqlfile=emp_pct_tab.sql transform=pctspace:10
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
...
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
Job "DPUSR"."SYS_SQL_FILE_TABLE_01" successfully completed at 10:38:55
[oracle@racs dp]$ vi emp_pct_tab.sql

CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10 BYTE),
        "JOB" VARCHAR2(9 BYTE),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0)
   ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 6554 NEXT 104858 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
  PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 6554 NEXT 104858 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" PARALLEL 1 ;

  ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT DPUSR
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 6554 NEXT 104858 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;

Now you can compare these values without pctspace option.

CASE 7: OID

SQL> SELECT SYS_OP_GUID() FROM DUAL;


SYS_OP_GUID()
--------------------------------
CF8C98BA272CA45CE0400C0A8D67761

CREATE TYPE APPtypes OID 'TESTOID'
AS OBJECT (attrib1 NUMBER);

SQL> CREATE TYPE APPtypes OID 'CF8C98BA272CA45CE0400C0A8D67761'
     AS OBJECT (attrib1 NUMBER);
     /

Type created.

SQL> select TYPE_NAME, TYPE_OID from user_types where TYPE_NAME='APPTYPES';

TYPE_NAME                      TYPE_OID
------------------------------ --------------------------------
APPTYPE                        CF8C98BA272CA45CE0400C0A8D67761

Taking the export of only TYPE objects from the schema using include option

expdp job_name=schemaexp1s schemas=scott include=type dumpfile=exp_types.dmp logfile=exp_type.log directory=dps compression=all

Export: Release 11.2.0.2.0 - Production on Wed Nov 28 05:31:07 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYS"."SCHEMAEXP1":  /******** AS SYSDBA job_name=schemaexp1 schemas=scott include=type dumpfile=exp_types.dmp logfile=exp_type.log directory=dps compression=all
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Master table "SYS"."SCHEMAEXP1" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SCHEMAEXP1 is:
  /u01/backup1/export/exp_types.dmp
Job "SYS"."SCHEMAEXP1" successfully completed at 05:31:17

Dropping the type
SQL> drop type APPTYPE;

Type dropped.

Importing the type object with transform=OID:n:type which will create the type object with new OID value.
$ impdp dumpfile=exp_types.dmp logfile=imp_exp_type.log directory=dps full=y transform=OID:n:type

Import: Release 11.2.0.2.0 - Production on Wed Nov 28 05:34:40 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_FULL_01":  /******** AS SYSDBA dumpfile=exp_types.dmp logfile=imp_exp_type.log directory=dps full=y transform=OID:n:type
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at 05:34:45

Object created with new OID value.
SQL> select TYPE_NAME, TYPE_OID from user_types where TYPE_NAME='APPTYPES';


TYPE_NAME                      TYPE_OID
------------------------------ --------------------------------
APPTYPE                        CF8CB70D75454DAE0400C0A8D671725

SQL> drop type APPTYPE;

Type dropped.
Importing the dump with transform=OID:y:type which will maintain the same OID values during the export.

$ impdp dumpfile=exp_types.dmp logfile=imp_exp_type.log directory=dps full=y transform=OID:y:type

Import: Release 11.2.0.2.0 - Production on Wed Nov 28 05:35:47 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_FULL_01":  /******** AS SYSDBA dumpfile=exp_type.dmp logfile=imp_exp_type.log directory=EXP_DIR full=y transform=OID:y:type
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at 05:35:56

Type object imported with same OID during the export.
SQL> select TYPE_NAME, TYPE_OID from user_types where TYPE_NAME='APPTYPE';

TYPE_NAME                      TYPE_OID
------------------------------ --------------------------------
APPTYPE                        CF8C98BA272CA45CE0400C0A8D67761