Showing posts with label Data Pump. Show all posts
Showing posts with label Data Pump. Show all posts

Tuesday, August 31, 2010

Datapump export or import fails with ORA-31626, ORA-31633, ORA-00955

Problem Description
While doing datapump export or import operation it fails with following error messages:

ORA-31626: job does not exist
ORA-31633: unable to create master table "ARJU.SYS_EXPORT_TABLE_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 863
ORA-00955: name is already used by an existing object

Cause of the Problem
Error is caused by a stopped job that remained in the DBA_DATAPUMP_JOBS. The new expdp/impdp job has the same name as the old expdp/impdp job.

Solution of the Problem
Clear the old job or specify a different name for the new job.

Step 01. Determine in SQL*Plus which Data Pump jobs exist in the database:
select owner_name, job_name, operation, job_mode, 
state, attached_sessions
from dba_datapump_jobs
where job_name not like 'BIN$%'
order by 1, 2;

Step 02. Ensure that the listed jobs in DBA_DATAPUMP_JOBS are not active DataPump export/import jobs. The status should be 'NOT RUNNING'.

Step 03. Check with the job owner that the job with status 'NOT RUNNING' in DBA_DATAPUMP_JOBS is not an export/import DataPump job that has been temporary stopped, but is actually a job that failed.

Step 04. Determine in SQL*Plus the related master tables:
select o.status, o.object_id, o.object_type, 
o.owner||'.'||object_name "OWNER.OBJECT"
from dba_objects o, dba_datapump_jobs j
where o.owner=j.owner_name and
o.object_name=j.job_name and
j.job_name not like 'BIN$%'
order by 4, 2;

Step 05. For jobs that were stopped in the past and won't be restarted anymore, delete the master table.
drop table ARJU.SYS_EXPORT_TABLE_05 ;

Related Documents
Expdp fails with ORA-01950 and ORA-01536
Expdp fails with ORA-31626, ORA-31633, ORA-06512, ORA-01031
Data pump export fails with ORA-39000, ORA-31641,ORA-27038

Thursday, July 22, 2010

exp fails with EXP-00023 and expdp fails with ORA-31631, ORA-39161

Problem Description
It is needed to export/import full database. To export full database, "EXPORT FULL DATABASE" privilege is granted and to import full database "IMPORT FULL DATABASE" privilege is granted. Now while doing full database export/import, exp fails with EXP-00023 and expdp fails with
ORA-31631: privileges are required
ORA-39161: Full database jobs require privileges

In the following example the error case is demonstrated.

A user named exp_user is created and it is granted EXPORT FULL DATABASE privilege.
E:\>sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jul 22 19:35:15 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create user exp_user identified by exp_user;

User created.

SQL> grant create session, resource, export full database to exp_user;

Grant succeeded.

SQL> select * from dba_sys_privs where grantee='EXP_USER';

GRANTEE PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
EXP_USER EXPORT FULL DATABASE NO
EXP_USER CREATE SESSION NO
EXP_USER UNLIMITED TABLESPACE NO

SQL> select * from dba_role_privs where grantee='EXP_USER';

GRANTEE GRANTED_ROLE ADM DEF
------------------------------ ------------------------------ --- ---
EXP_USER RESOURCE NO YES

E:\>exp exp_user/exp_user full=y file=exp_dump.dmp log=exp_dump.log

Export: Release 10.2.0.1.0 - Production on Thu Jul 22 19:43:52 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXP-00023: must be a DBA to do Full Database or Tablespace export
(2)U(sers), or (3)T(ables): (2)U >

Export grants (yes/no): yes >

Export table data (yes/no): yes >

Compress extents (yes/no): yes >

Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user EXP_USER
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user EXP_USER
About to export EXP_USER's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export EXP_USER's tables via Conventional Path ...
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.

E:\>expdp exp_user/exp_user full=y dumpfile=exp_dump.dmp logfile=exp_dump.log

Export: Release 10.2.0.1.0 - Production on Thursday, 22 July, 2010 19:51:21

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31631: privileges are required
ORA-39161: Full database jobs require privileges
From the above example, we see both exp and expdp operations have failed.

Cause of the Problem
The system privileges "EXPORT FULL DATABASE" and "IMPORT FULL DATABASE" was introduced in oracle database 10gR1. But these two privileges are not currently in use by oracle. May be they will be implemented in future releases. In oracle 10g and 11g these two system privileges are not operational and hence assigning these privileges will do nothing.

The right privileges used by export/import are the roles EXP_FULL_DATABASE/ IMP_FULL_DATABASE.

Solution of the Problem
Assign correct privileges to the user. He who will do full database export operation assign him EXP_FULL_DATABASE role and he who will perform full database import operation assign him IMP_FULL_DATABASE role.
E:\>sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jul 22 19:53:32 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> revoke export full database from exp_user;

Revoke succeeded.

SQL> grant exp_full_database to exp_user;

Grant succeeded.

SQL> select * from dba_sys_privs where grantee = 'EXP_USER';

GRANTEE PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
EXP_USER CREATE SESSION NO
EXP_USER UNLIMITED TABLESPACE NO

SQL> select * from dba_role_privs where grantee = 'EXP_USER';

GRANTEE GRANTED_ROLE ADM DEF
------------------------------ ------------------------------ --- ---
EXP_USER EXP_FULL_DATABASE NO YES
EXP_USER RESOURCE NO YES

Now invoking exp and expdp with full=y went fine.
D:\>exp exp_user/exp_user full=y file=exp_dump.dmp log=exp_dump.log

Export: Release 11.1.0.6.0 - Production on Thu Jul 22 21:19:03 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

About to export the entire database ...
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
.
.
.

Friday, July 16, 2010

Expdp fails with PLS-00201: identifier DMSYS.DBMS_DM_MODEL_EXP must be declared

Problem Description
Oracle data pump export fails with error "PLS-00201: identifier 'DMSYS.DBMS_DM_MODEL_EXP' must be declared ORA-06550:" like below.
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.
GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB []
ORA-31642: the following SQL statement fails:
BEGIN
DMSYS.DBMS_DM_MODEL_EXP.SCHEMA_CALLOUT('CLUS1PROD1',0,1,'10.01.00.03.00');
END;
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_METADATA", line 872
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DMSYS.DBMS_DM_MODEL_EXP' must be declared ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Cause of the Problem
The problem arises because DMSYS schema objects have been accidentally removed or DMSYS schema objects have Invalid status or DMSYS schema has been dropped.

Solution of the Problem
Case 01: DMSYS has been dropped
1. Start SQLPlus.
$ sqlplus /nolog

2. Connect with user SYS as SYSDBA and issue the following commands:
SQL> conn / as sysdba
SQL> DELETE FROM exppkgact$ WHERE SCHEMA='DMSYS';
SQL> exit;
3. Run export jobs.

Case 02: DMSYS schema objects have been accidentally removed / have invalid objects
1. Start SQLPlus and connect with user SYS as SYSDBA
$ sqlplus / as sysdba

2.
i) If Database is version 10.1.0.x do the following steps:
 SQL> run $ORACLE_HOME/dm/admin/dminst.sql SYSAUX TEMP $ORACLE_HOME/dm/admin/ 
SQL> run $ORACLE_HOME/dm/admin/odmpatch.sql (if the database is at a patch level)
SQL> run $ORACLE_HOME/rdbms/admin/utlrp.sql
ii) If Database is version 10.2.0.x do the following steps:
 SQL> run $ORACLE_HOME/rdbms/admin/dminst.sql SYSAUX TEMP $ORACLE_HOME/rdbms/admin/ 
SQL> run $ORACLE_HOME/rdbms/admin/odmpatch.sql
SQL> run $ORACLE_HOME/rdbms/admin/utlrp.sql
3. Ensure that 'Oracle Data Mining' is at valid status in dba_registry using,
SQL> select COMP_NAME,VERSION,STATUS from dba_registry where COMP_NAME='Oracle Data Mining';

4. Run the export jobs.

Export DataPump fails with ORA-39125 while Calling DMSYS.DBMS_DM_MODEL_EXP.SCHEMA_CALLOUT

Problem Description
While invoking oracle datapump schema level export it fails with error
"ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS
while calling DBMS_METADATA.FETCH_XML_CLOB []
ORA-31642: the following SQL statement fails:
BEGIN DMSYS.DBMS_DM_MODEL_EXP.SCHEMA_CALLOUT" like below.
#> expdp userid=system/password DIRECTORY=mydir DUMPFILE=expdp_scott.dmp LOGFILE=expdp_scott.log SCHEMAS=scott

Export: Release 10.2.0.1.0 - 64bit Production on Sunday, 27 July, 2008 10:00:38

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Starting "TEST"."JOB1": userid=system/***** DIRECTORY=mydir DUMPFILE=expdp_scott.dmp LOGFILE=expdp_scott.log SCHEMAS=scott
Estimate in progress using BLOCKS method...
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS
while calling DBMS_METADATA.FETCH_XML_CLOB []
ORA-31642: the following SQL statement fails:
BEGIN DMSYS.DBMS_DM_MODEL_EXP.SCHEMA_CALLOUT('SCOTT',0,1,'10.01.00.02.00'); END;
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_METADATA", line 872
ORA-04063: package body "DMSYS.DBMS_DM_UTIL" has errors
ORA-06508: PL/SQL: could not find program unit being called

Cause of the Problem
As the line "ORA-04063: package body "DMSYS.DBMS_DM_UTIL" has errors" appears the problem happened due to invalid state of the package DMSYS.DBMS_DM_UTIL. Package DMSYS.DBMS_DM_UTIL is used by the Oracle Data Mining option. You can verify the invalid objects in oracle by following query,
SQL> set lines 200
SQL> select status,
object_id,
object_type,
owner||'.'||object_name "OWNER.OBJECT"
from dba_objects
where status != 'VALID'
order by 4,2;

Solution of the Problem
Step 01: Log in to database as dmsys user and run the script dmutil.plb to re-create the invalid package.
SQL> CONNECT dmsys/dmsys
Connected.

SQL> @$ORACLE_HOME/dm/admin/dmutil.plb
Package created.
Package created.

Step 02: Run the script $ORACLE_HOME/rdbms/admin/utlrp.sql to recompile the invalid objects.
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

Step 03: Delete the Export DataPump log file and dump file of the previous failed attempt. Then re-run the export DataPump operation.

Saturday, February 27, 2010

EXP-00008, ORA-04063, ORA-06508, EXP-00083 PL/SQL: could not find program unit

Problem Description
Oracle full database export fails with error stack EXP-00008, ORA-04063, ORA-06508, EXP-00083 like below.
EXP-00008: ORACLE error 4063 encountered
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
EXP-00083: The previous problem occurred when calling WMSYS.LT_EXPORT_PKG.schema_info_exp

Cause of the Problem
The above problems are caused by the revoke of the execute privilege on UTL_FILE package from Public.

Oracle Workspace Manager (OWM) and some other database components (which are not installed in the database) need the privilege to execute procedure SYS.UTL_FILE.

During the creation of a default Database, the Workspace Manager gets installed by default. and the WMSYS user becomes intertwined with the export process and must be valid or at least the major parts for an export to complete properly as the export process looks for any "version-enabled" tables that Workspace Manager schema may be using.

Solution of the Problem
In order to solve above problems do following steps.

1. Grant execute privilege on SYS.UTL_FILE package to WMSYS user.
SQL> grant execute on SYS.UTL_FILE to WMSYS;

2. check for invalid objects in the WMSYS schema using following query,
SQL> select object_name,object_type,owner,status from dba_objects where status='INVALID' and owner='WMSYS';

3. Run script $ORACLE_HOME/rdbms/admin/utlrp.sql
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

Related Documents
http://arjudba.blogspot.com/2010/02/exp-00008-ora-06550-pls-00201-exp-00083.html
http://arjudba.blogspot.com/2010/02/ora-39127-ora-04063-ora-06508-ora-06512.html
http://arjudba.blogspot.com/2010/02/exp-00008-ora-04063-ora-06508-exp-00083.html
http://arjudba.blogspot.com/2009/12/export-fully-fails-with-pls-00201-ora.html
http://arjudba.blogspot.com/2009/12/export-fails-with-exp-00002-error-in.html
http://arjudba.blogspot.com/2009/01/ora-31655-no-data-or-metadata-objects.html
http://arjudba.blogspot.com/2009/01/expdp-fails-with-ora-31693-ora-06502.html
http://arjudba.blogspot.com/2008/12/ora-39095-dump-file-space-has-been.html
http://arjudba.blogspot.com/2008/09/expdp-fails-with-ora-31626-ora-31633.html
http://arjudba.blogspot.com/2008/07/data-pump-export-fails-with-ora-39000.html
http://arjudba.blogspot.com/2009/07/ora-39165-schema-sys-was-not-found-ora.html
http://arjudba.blogspot.com/2009/07/ora-39166-object-was-not-found-sys.html
http://arjudba.blogspot.com/2009/05/ora-39000-ora-39143-dump-file-may-be.html
http://arjudba.blogspot.com/2009/05/expdp-fails-with-ora-39001ora-39169ora.html

EXP-00008, ORA-06550, PLS-00201, EXP-00083 identifier 'SYS.LT_EXPORT_PKG' must be declared

Problem Description
When I try to do full database export it fails will following errors as below.
exporting post-schema procedural objects and actions
EXP-00008: ORACLE error 6550 encountered
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.LT_EXPORT_PKG' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
EXP-00083: The previous problem occurred when calling SYS.LT_EXPORT_PKG.schema_info_exp
. exporting statistics
.
Cause of the Problem
The above problem happened because the Workspace Manager component is not there. You can check from querying db_registry as below.
SQL> select comp_id, version, status from dba_registry is giving the following info :

COMP_ID VERSION STATUS
------------------------------ ------------------------------ -----------
CATPROC 10.1.0.2.0 VALID
RAC 10.1.0.2.0 INVALID
CATALOG 10.1.0.2.0 VALID
XDB 10.1.0.2.0 VALID

So we see that OWM is not installed. May be WMSYS user has been dropped.
The SYS.LT_EXPORT_PKG is created by the Oracle Workspace Manager (OWM).

OWM (Oracle Worspace Manager) is now closely integrated with much of the functionality of Oracle, especially the export. The export process looks for any "version-enabled" tables that Workspace Manager may be using. The WMSYS user is used to store all the metadata information for OWM and it is recommended to not remove the OWM user.

Solution of the Problem
The error stack "EXP-00008, ORA-06550, PLS-00201, EXP-00083 identifier 'SYS.LT_EXPORT_PKG' must be declared" are just an informational messages only and you can avoid those. The export utility is throwing warnings and then proceeding ahead. The export does not error out or stop abruptly.

Note that, the versioning feature has been closely incorporated into the export utility and hence it checks the versioning repository for such version enabled tables. But as the versioning metadata information is not found (as the WMSYS user holding this metadata has been dropped), it throws this informational messages.

If you really do not bother with the Oracle Workspace Manager component, just ignore the
message. But in case you want to eliminate this warning messages as well, you can either deinstall the Oracle Workspace Manager or re-install it.

Steps to Recreate WMSYS user(Oracle Workspace Manager)

1) Execute $ORACLE_HOME/rdbms/admin/owminst.plb as SYS user from SQL*PLUS prompt.
- $sqlplus / as sysdba
- SQL> @$ORACLE_HOME/rdbms/admin/owminst.plb


Steps to uninstall Oracle Workspace Manager (OWM)
1) Disable versioning on all version-enabled tables in the database before de-installing Oracle Workspace Manager.

2) Login to SQL*Plus as SYSDBA, invoke the owmuinst.plb de-installation script as below.
$ sqlplus / as sysdba
SQL> @$ORACLE_HOME/rdbms/admin/owmuinst.plb


Note that, de-installing Oracle Workspace Manager will remove any existing workspaces and the associated metadata.
Related Documents
http://arjudba.blogspot.com/2010/02/exp-00008-ora-06550-pls-00201-exp-00083.html
http://arjudba.blogspot.com/2010/02/ora-39127-ora-04063-ora-06508-ora-06512.html
http://arjudba.blogspot.com/2010/02/exp-00008-ora-04063-ora-06508-exp-00083.html
http://arjudba.blogspot.com/2009/12/export-fully-fails-with-pls-00201-ora.html
http://arjudba.blogspot.com/2009/12/export-fails-with-exp-00002-error-in.html
http://arjudba.blogspot.com/2009/01/ora-31655-no-data-or-metadata-objects.html
http://arjudba.blogspot.com/2009/01/expdp-fails-with-ora-31693-ora-06502.html
http://arjudba.blogspot.com/2008/12/ora-39095-dump-file-space-has-been.html
http://arjudba.blogspot.com/2008/09/expdp-fails-with-ora-31626-ora-31633.html
http://arjudba.blogspot.com/2008/07/data-pump-export-fails-with-ora-39000.html
http://arjudba.blogspot.com/2009/07/ora-39165-schema-sys-was-not-found-ora.html
http://arjudba.blogspot.com/2009/07/ora-39166-object-was-not-found-sys.html
http://arjudba.blogspot.com/2009/05/ora-39000-ora-39143-dump-file-may-be.html
http://arjudba.blogspot.com/2009/05/expdp-fails-with-ora-39001ora-39169ora.html

Friday, February 26, 2010

ORA-39127 ORA-04063 ORA-06508 ORA-06512 package body "WMSYS.LT_EXPORT_PKG" has errors

Problem Description
While doing data pump full database export, in the error log following error messages are generated.
Processing object type DATABASE_EXPORT/SCHEMA/TYPE/TYPE_SPEC
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.system_info_exp(0,dynconnect,10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5334
Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PRE_SYSTEM_ACTIONS/PROCACT_SYSTEM
Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.system_info_exp(1,dynconnect,10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5334
Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('SYS',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('SYSTEM',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('OUTLN',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('VIEWSTAR',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('EXP_DBA',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('TSMSYS',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('PTASUSER',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('VSUSER',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('PARTDB',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('WORKFLOW',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('QUEUEDB',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('CASCAN',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419
ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('DAADMIN',0,1,'10.02.00.02.00',newblock)
ORA-04063: package body "WMSYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called: "WMSYS.LT_EXPORT_PKG"
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 5419

Cause of the Problem
The above error stack is generated because WORKSPACE , XDB schemas have invalid objects.

Solution of the Problem
The solution is to validate LT_EXPORT_PKG package. In order to validate LT_EXPORT_PKG package, run $ORACLE_HOME/rdbms/admin/owminst.plb script as SYS user.
- $sqlplus / as sysdba
- SQL> @$ORACLE_HOME/rdbms/admin/owminst.plb

Related Documents
http://arjudba.blogspot.com/2010/02/exp-00008-ora-06550-pls-00201-exp-00083.html
http://arjudba.blogspot.com/2010/02/ora-39127-ora-04063-ora-06508-ora-06512.html
http://arjudba.blogspot.com/2010/02/exp-00008-ora-04063-ora-06508-exp-00083.html
http://arjudba.blogspot.com/2009/12/export-fully-fails-with-pls-00201-ora.html
http://arjudba.blogspot.com/2009/12/export-fails-with-exp-00002-error-in.html
http://arjudba.blogspot.com/2009/01/ora-31655-no-data-or-metadata-objects.html
http://arjudba.blogspot.com/2009/01/expdp-fails-with-ora-31693-ora-06502.html
http://arjudba.blogspot.com/2008/12/ora-39095-dump-file-space-has-been.html
http://arjudba.blogspot.com/2008/09/expdp-fails-with-ora-31626-ora-31633.html
http://arjudba.blogspot.com/2008/07/data-pump-export-fails-with-ora-39000.html
http://arjudba.blogspot.com/2009/07/ora-39165-schema-sys-was-not-found-ora.html
http://arjudba.blogspot.com/2009/07/ora-39166-object-was-not-found-sys.html
http://arjudba.blogspot.com/2009/05/ora-39000-ora-39143-dump-file-may-be.html
http://arjudba.blogspot.com/2009/05/expdp-fails-with-ora-39001ora-39169ora.html

Saturday, July 11, 2009

ORA-39165: Schema SYS was not found ORA-39166, ORA-31655

Problem Description
This is a variant of error described in ORA-39166: Object was not found, SYS tables can't be exported. The ORA-39166 throws if you want to take data pump export of SYS objects using SYS user. And ORA-39165 throws if you want to take data pump export of SYS objects as a non-SYS user.

With a simple example problem is demonstrated here.

SQL> conn / as sysdba
Connected.
SQL> create table database_10g(col1 number);

Table created.

SQL> insert into database_10g values(23);

1 row created.

SQL> commit;

Commit complete.

SQL> host E:\oracle\product\10.2.0\db_2\BIN\expdp userid=arju/a tables=sys.database_10g dumpfile=sys_table_test.dmp

Export: Release 10.2.0.1.0 - Production on Saturday, 11 July, 2009 18:30:26

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ARJU"."SYS_EXPORT_TABLE_01": userid=arju/******** tables=sys.database_10g dumpfile=sys_table_test.dmp
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
ORA-39165: Schema SYS was not found.
ORA-39166: Object DATABASE_10G was not found.
ORA-31655: no data or metadata objects selected for job
Job "ARJU"."SYS_EXPORT_TABLE_01" completed with 3 error(s) at 18:30:36

It says both schema SYS and object table does not exist. But actually both are existed. Here is the proof.
SQL> conn arju/a
Connected.
SQL> desc sys.database_10g
Name Null? Type
----------------------------------------- -------- ----------------------------
COL1 NUMBER

SQL> select * from sys.database_10g ;

COL1
----------
23

SQL> select table_name, owner from dba_tables where table_name='DATABASE_10G';

TABLE_NAME OWNER
------------------------------ ------------------------------
DATABASE_10G SYS

Cause of the Problem
There is a restriction imposed in data pump export that SYS tables, objects are not exported even with full export option. Whenever we export by schemas=sys then role grants are exported but no data. Data pump does not allow to export system schemas like SYS, ORDSYS, EXFSYS, MDSYS, DMSYS, CTXSYS, ORDPLUGINS, LBACSYS, XDB, SI_INFORMTN_SCHEMA, DIP, DBSNMP and WMSYS in any mode.

Solution of the Problem
1)Use original export instead of data pump export to export SYS objects/schemas.

2)First using create table as select transfer SYS objects into non-restrictive schema and using data pump export data/tables from non-restrictive schema.

So the conclusion is the SYS schema, SYS tables cannot be used as a source schema for data pump export jobs.

Related Documents

In 11g data pump export schemas=sys do export only role grants

In the post http://arjudba.blogspot.com/2009/07/ora-39165-schema-sys-was-not-found-ora.html and http://arjudba.blogspot.com/2009/07/ora-39166-object-was-not-found-sys.html it is shown that the SYS schema objects or tables cannot be used as a source schema for data pump export jobs.

In this post it is shown if we specify schemas=sys option while data pump export then what it actually does. Of course no tables, indexes, constraint, procedures, packages, triggers are exported. Only role grant are exported.

SQL> host expdp userid=\"/ as sysdba\" dumpfile=sys_test_dump.dmp schemas=sys

Export: Release 11.1.0.6.0 - Production on Saturday, 11 July, 2009 18:17:04

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": userid="/******** AS SYSDBA" dumpfile=sys_test_dump.dmp schemas=sys
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/ROLE_GRANT
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
D:\APP\ARJU\ADMIN\ARJU\DPDUMP\SYS_TEST_DUMP.DMP
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:17:23

Let's see the contents inside dumpfile.
SQL> host impdp userid=\"/ as sysdba\" dumpfile=sys_test_dump.dmp sqlfile=inside_dump.txt

Import: Release 11.1.0.6.0 - Production on Saturday, 11 July, 2009 18:18:29

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYS"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SYS"."SYS_SQL_FILE_FULL_01": userid="/******** AS SYSDBA" dumpfile=sys_test_dump.dmp sqlfile=inside_dump.txt
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Job "SYS"."SYS_SQL_FILE_FULL_01" successfully completed at 18:18:33

The contents inside_dump.txt is as follows.
-- CONNECT SYS
ALTER SESSION SET EDITION = "ORA$BASE";
-- new object type path: SCHEMA_EXPORT/ROLE_GRANT
-- CONNECT SYSTEM
ALTER SESSION SET EDITION = "ORA$BASE";
GRANT "CONNECT" TO "SYS" WITH ADMIN OPTION;

GRANT "DBA" TO "SYS" WITH ADMIN OPTION;

GRANT "SELECT_CATALOG_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "EXECUTE_CATALOG_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "DELETE_CATALOG_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "EXP_FULL_DATABASE" TO "SYS" WITH ADMIN OPTION;

GRANT "IMP_FULL_DATABASE" TO "SYS" WITH ADMIN OPTION;

GRANT "LOGSTDBY_ADMINISTRATOR" TO "SYS" WITH ADMIN OPTION;

GRANT "AQ_ADMINISTRATOR_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "AQ_USER_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "DATAPUMP_EXP_FULL_DATABASE" TO "SYS" WITH ADMIN OPTION;

GRANT "DATAPUMP_IMP_FULL_DATABASE" TO "SYS" WITH ADMIN OPTION;

GRANT "GATHER_SYSTEM_STATISTICS" TO "SYS" WITH ADMIN OPTION;

GRANT "RECOVERY_CATALOG_OWNER" TO "SYS" WITH ADMIN OPTION;

GRANT "SCHEDULER_ADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "HS_ADMIN_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "OEM_ADVISOR" TO "SYS" WITH ADMIN OPTION;

GRANT "OEM_MONITOR" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVAUSERPRIV" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVAIDPRIV" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVASYSPRIV" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVADEBUGPRIV" TO "SYS" WITH ADMIN OPTION;

GRANT "EJBCLIENT" TO "SYS" WITH ADMIN OPTION;

GRANT "JMXSERVER" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVA_ADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "JAVA_DEPLOY" TO "SYS" WITH ADMIN OPTION;

GRANT "CTXAPP" TO "SYS" WITH ADMIN OPTION;

GRANT "XDBADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "XDB_SET_INVOKER" TO "SYS" WITH ADMIN OPTION;

GRANT "AUTHENTICATEDUSER" TO "SYS" WITH ADMIN OPTION;

GRANT "XDB_WEBSERVICES" TO "SYS" WITH ADMIN OPTION;

GRANT "XDB_WEBSERVICES_WITH_PUBLIC" TO "SYS" WITH ADMIN OPTION;

GRANT "XDB_WEBSERVICES_OVER_HTTP" TO "SYS" WITH ADMIN OPTION;

GRANT "ORDADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "OLAPI_TRACE_USER" TO "SYS" WITH ADMIN OPTION;

GRANT "OLAP_XS_ADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "OLAP_DBA" TO "SYS" WITH ADMIN OPTION;

GRANT "CWM_USER" TO "SYS" WITH ADMIN OPTION;

GRANT "OLAP_USER" TO "SYS" WITH ADMIN OPTION;

GRANT "SPATIAL_WFS_ADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "WFS_USR_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "SPATIAL_CSW_ADMIN" TO "SYS" WITH ADMIN OPTION;

GRANT "CSW_USR_ROLE" TO "SYS" WITH ADMIN OPTION;

GRANT "WKUSER" TO "SYS" WITH ADMIN OPTION;

GRANT "MGMT_USER" TO "SYS" WITH ADMIN OPTION;

GRANT "OWB$CLIENT" TO "SYS" WITH ADMIN OPTION;

GRANT "OWB_DESIGNCENTER_VIEW" TO "SYS" WITH ADMIN OPTION;

GRANT "OWB_USER" TO "SYS" WITH ADMIN OPTION;
Related Documents

ORA-39166: Object was not found, SYS tables can't be exported

In case of original export we could easily export the tables those were inside under SYS schema.

But whenever you try to export a table from sys schema using expdp it fails with ORA-39166: Object was not found. With a simple example the scenario is demonstrated below.

1)Log on as sysdba.
SQL> conn / as sysdba
Connected.

2)Create a test table and insert data into it.
SQL> create table test_export_for_sys(value1 number);

Table created.

SQL> insert into test_export_for_sys values(55);

1 row created.

SQL> commit;

Commit complete.

3)Try to take a data pump export of this table.
SQL> host expdp userid=\"/ as sysdba\" dumpfile=sys_test.dmp tables=test_export_for_sys

Export: Release 11.1.0.6.0 - Production on Saturday, 11 July, 2009 15:01:39

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_01": userid="/******** AS SYSDBA" dumpfile=sys_test.dmp tables=test_export_for_sys
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
ORA-39166: Object TEST_EXPORT_FOR_SYS was not found.
ORA-31655: no data or metadata objects selected for job
Job "SYS"."SYS_EXPORT_TABLE_01" completed with 2 error(s) at 15:01:45

But in the database there exists test_export_for_sys table,

SQL> desc test_export_for_sys
Name Null? Type
----------------------------------------- -------- -------------
VALUE1 NUMBER

SQL> select * from test_export_for_sys;

VALUE1
----------
55

SQL> show user;
USER is "SYS"

If you try to export schema also no tables are exported.
SQL> host expdp userid=\"/ as sysdba\" dumpfile=sys_test_schema.dmp schemas=sys

Export: Release 11.1.0.6.0 - Production on Saturday, 11 July, 2009 19:14:56

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": userid="/******** AS SYSDBA" dumpfile=sys_test_schema.dmp schemas=sys
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/ROLE_GRANT
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
D:\APP\ARJU\ADMIN\ARJU\DPDUMP\SYS_TEST_SCHEMA.DMP
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 19:16:12


But this is not the fact in case of original export. Here is the original export output,

SQL> host exp userid=\"/ as sysdba\" file=sys_test.dmp tables=test_export_for_sys

Export: Release 11.1.0.6.0 - Production on Sat Jul 11 17:42:29 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table TEST_EXPORT_FOR_SYS 1 rows exported
Export terminated successfully without warnings.

Solution of the Problem
This is the restriction imposed in oracle data pump. A number of system schemas tables cannot be exported because they are not user schemas, they contain Oracle-managed data and metadata. As in every schemas there by default system schemas exist. Data pump utility designed for transferring data, not the database; so not the system schemas. However if you want to export sys tables like SYS.AUD$ then first transfer that table into non-restricted schema and export the table from non restricted schema.

Related Documents

Friday, July 10, 2009

Import data into an existing table-TABLE_EXISTS_ACTION(ORA-39151)

In many cases we need to import data into in existing table. A common example is you take a data pump export, truncate the table, then table undergoes for normal operation. Suddenly your manager ask to get back old data while running in tact current operation as well as leave current data in place. Just you need to append data into an existing table.

Both original export and data pump export can be used to append data into an existing table but data pump import offer flexible option.

Below is an example about the happenings to import a table which already exist in the database.

SQL> $impdp arju/a

Import: Release 11.1.0.6.0 - Production on Friday, 10 July, 2009 23:07:08

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "ARJU"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "ARJU"."SYS_IMPORT_FULL_01": arju/********
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-39151: Table "ARJU"."TEST" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "ARJU"."SYS_IMPORT_FULL_01" completed with 1 error(s) at 23:07:13

In data pump import the parameter TABLE_EXISTS_ACTION help to do the job. The default value of this parameter is SKIP which means if table to be imported already existed in the database table will be skipped and data not to be imported and continue processing next object. However if in your import job if CONTENT=DATA_ONLY is specified, the default is APPEND, and then data will be appended into existing table.

TABLE_EXISTS_ACTION can have following values.

1)SKIP: It leaves the table as is and moves on to the next object. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

2)APPEND: This option loads rows from the source and leaves existing rows unchanged. This is a default option is CONTENT=DATA_ONLY is specified.

3)TRUNCATE: This option deletes existing rows and then loads rows from the source.

4)REPLACE: This option drops the existing table in the database and then creates and loads it from the source. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

Important Note
- If you use TRUNCATE or REPLACE, make sure that rows in the affected tables are not targets of any referential constraints.

- If you use SKIP, APPEND, or TRUNCATE then existing table dependent objects in the source, such as indexes, grants, triggers, and constraints, are ignored. In case of REPLACE, the dependent objects are dropped and again created from the source, if they were not explicitly or implicitly excluded (using EXCLUDE) and they exist in the source dump file or system.

- If you use APPEND or TRUNCATE, checks are made to ensure that rows from the source are compatible with the existing table prior to performing any action. If the existing table has active constraints and triggers, it is loaded using the external tables access method. If any row violates an active constraint, the load fails and no data is loaded. You can override this behavior by specifying DATA_OPTIONS=SKIP_CONSTRAINT_ERRORS on the Import command line.

If you want data must be loaded but causes constraint voilations, you can disable constraints, import data, delete the rows which causes problems and then enable constraints.

- When you use APPEND, the data is always loaded into new space. So if you have any existing space available the space is not reused. So after the import operation, you may wish to compress your data after the load.

- TRUNCATE cannot be used on clustered tables or over network links.

In case of original import use ignore=y option to append data into an existing table. ignore=y causes rows to be imported into existing tables without any errors or messages being given.
Related Documents

Parameter comparison between oracle export and data pump

We know Oracle data pump is latest utility than oracle original export/import tool and also data pump comes with greater flexibility and more advantages. Those who are good at original export/import tool and new to oracle data pump, this post will help them specially to compare the differences between two.



Parameter Comparion between Oracle export/Import and data pump






















































































































Orginal Export Parameter Comparable Data pump Parameter
BUFFER In datapump equivalent parameter
is not needed.
COMPRESS In datapump equivalent parameter
is not needed
CONSISTENT In datapump FLASHBACK_SCN and
FLASHBACK_TIME do the job.
CONSTRAINTS EXCLUDE=CONSTRAINT
DIRECT Data pump automatically choose
direct path or external tables mode.
FEEDBACK STATUS
FILE DUMPFILE
FILESIZE FILESIZE
FLASHBACK_SCN FLASHBACK_SCN
FLASHBACK_TIME FLASHBACK_TIME
FULL FULL
GRANTS EXLUDE=GRANT
HELP HELP
INDEXES EXCLUDE=INDEX
LOG LOGFILE
OBJECT_CONSISTENT Equivalent parameter is not needed.
OWNER SCHEMAS
PARFILE PARFILE
QUERY QUERY
RECORDLENGTH Equivalent parameter is not needed.
RESUMABLE This function is automatically enabled
for user who has been granted EXP_FULL_DATABASE role.
RESUMABLE_NAME This function is automatically enabled
for user who has been granted EXP_FULL_DATABASE role.
RESUMABLE_TIMEOUT This function is automatically enabled
for user who has been granted EXP_FULL_DATABASE role.
ROWS=N CONTENT=METADATA_ONLY
ROWS=Y CONTENT=ALL
STATISTICS Not needed. Statistics are always
saved for tables.
TABLES TABLES
TABLESPACES It has TABLESPACES parameter but
behave differently than original export.


Related Documents

Wednesday, July 8, 2009

Default location of Dump, Log and SQL file

As data pump is server based, all dump files, log files and SQL files are generated and accessed from /to server-based directory paths.

In simple term, Data pump directory object is an alias of an operating system directory. There must physically exist OS directory in order to effect corresponding oracle directory. Changes permission to oracle directory does not affect any changes to OS directory and in the same way changes permission to OS directory does not affect any oracle directory. In order to read/write any oracle directory, there must explicitly have read/write permission from corresponding OS directory.

As this post is related tolocation of dump, log and sql file in the following section the order of precedence to determine a file's location is discussed in case of Data Pump Export and Import.

1)If we specify a directory name with the parameter of LOGFILE or DUMPFILE or SQLFILE then the location specified by that directory object is used. It is very good to know that the directory object must be separated from the filename by a colon(:).
An example is given below.

SQL> create table test(a number);

Table created.

SQL> create directory c_drive as 'c:';

Directory created.

SQL> create directory d_drive as 'd:';

Directory created.

SQL> host expdp dumpfile=c_drive:test.dmp logfile=d_drive:test.log tables=test

Export: Release 11.1.0.6.0 - Production on Wednesday, 08 July, 2009 19:11:06

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Username: arju/a

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "ARJU"."SYS_EXPORT_TABLE_01": arju/******** dumpfile=c_drive:test.dmp logfile=d_drive:test.log tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "ARJU"."TEST":"P1" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P2" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P3" 5.007 KB 1 rows
Master table "ARJU"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_TABLE_01 is:
C:\TEST.DMP
Job "ARJU"."SYS_EXPORT_TABLE_01" successfully completed at 19:11:39

2)If the directory object is not specified for a file which means not included with DUMPFILE/LOGFILE/SQLFILE, then the directory object named by the DIRECTORY parameter is used.

So if your command is below then the dump file will represent c_drive directory which
indicates C: drive.

SQL> host expdp directory=c_drive tables=test

Export: Release 11.1.0.6.0 - Production on Wednesday, 08 July, 2009 22:04:09

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Username: arju/a

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "ARJU"."SYS_EXPORT_TABLE_01": arju/******** directory=c_drive tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ARJU"."TEST":"P1" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P2" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P3" 5.007 KB 1 rows
Master table "ARJU"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_TABLE_01 is:
C:\EXPDAT.DMP
Job "ARJU"."SYS_EXPORT_TABLE_01" successfully completed at 22:04:50

3)If you don't provide any directory object with filename, and if no directory object was named by the DIRECTORY parameter, then the value of the environment variable DATA_PUMP_DIR is used.

Always remember that this environment variable is defined using operating system
commands on the client system where the Data Pump Export and Import utilities
are run. But this value assigned to this client-based environment variable must be the name of a server-based directory object. So you first need to create a directory in the server as a DBA user and then you need to setup in client environment variable.

Below is an exact example of this scenario.
Though in this example DATA_PUMP_DIR directory points to OS directory D:\app\Arju\admin\arju\dpdump\ but because of client environmental variable setting of DATA_PUMP_DIR to TEST(which is E: drive) create the dumpfile inside E:\ drive.
Never confuse with the name DATA_PUMP_DIR. Here there can be any directory name that reside in the database.

E:\>sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Jul 8 15:54:04 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select directory_path from dba_directories where directory_name='DATA_PUMP_DIR';

DIRECTORY_PATH
--------------------------------------------------------------------------------
D:\app\Arju\admin\arju\dpdump\

SQL> create directory test as 'E:';

Directory created.

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

E:\>set DATA_PUMP_DIR=TEST


E:\>expdp schemas=arju
Export: Release 11.1.0.6.0 - Production on Wednesday, 08 July, 2009 15:54:54

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Username: / as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": /******** AS SYSDBA schemas=arju
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 576 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/INDEX/DOMAIN_INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/POST_TABLE_ACTION
Processing object type SCHEMA_EXPORT/MATERIALIZED_VIEW
Processing object type SCHEMA_EXPORT/TABLE/MATERIALIZED_VIEW_LOG
Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
. . exported "ARJU"."C1" 5.007 KB 1 rows
. . exported "ARJU"."P3" 5.007 KB 1 rows
. . exported "ARJU"."T" 5.023 KB 2 rows
. . exported "ARJU"."TEST":"P1" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P2" 5.007 KB 1 rows
. . exported "ARJU"."TEST":"P3" 5.007 KB 1 rows
. . exported "ARJU"."TEST2" 5.406 KB 1 rows
. . exported "ARJU"."TEST3" 5.414 KB 2 rows
. . exported "ARJU"."T_LARGEST" 5.046 KB 5 rows
. . exported "ARJU"."MASTER_TEMP" 0 KB 0 rows
. . exported "ARJU"."MASTER_TEMP2" 0 KB 0 rows
. . exported "ARJU"."MLOG$_MASTER_TEMP" 0 KB 0 rows
. . exported "ARJU"."MV_MASTER" 0 KB 0 rows
. . exported "ARJU"."T1" 0 KB 0 rows
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
E:\EXPDAT.DMP
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 15:56:37


4)If none of the above three conditions yields a directory object, but you invoke data pump and you have permission on DATA_PUMP_DIR, then Data Pump attempts to use the value of the default server-based directory object, DATA_PUMP_DIR.

This DATA_PUMP_DIR directory is automatically created at database creation or when the database dictionary is upgraded.

If you don't have access to the DATA_PUMP_DIR directory object then you will get insufficient privilege error.

Related Documents

Thursday, May 7, 2009

How to cleanup orphaned datapump jobs from DBA_DATAPUMP_JOBS

In many cases you sometimes stop data pump job or in case of an abnormal end of the Data Pump job (the orphaned job) or using undocumented parameter KEEP_MASTER=Y, the master table remain in the database.

Though this topic is related to cleanup orphaned datapump jobs. But it is good to know several things before doing cleanup jobs.

1) You can check the orphaned data pump from the state column of the view dba_datapump_jobs and DBA_DATAPUMP_JOBS is based on gv$datapump_job, obj$, com$, and user$. Orphaned Data Pump jobs do not have an impact on new Data Pump jobs. If a new Data Pump job is started, a new entry will be created, which has no relation to the old Data Pump jobs.

2) For a new data pump job without any job name it is used a system generated name. From the dba_datapump_jobs it is checked for existing data pump jobs and then obtain a unique new system generated jobname.

3) Data pump jobs are different from DBMS_JOBS and they are maintained differently. Jobs created with DBMS_JOBS use there own processes. Data Pump jobs use a master process and worker process(es).

4) If you drop the master table while doing the data pump export or data pump import operation then the scenario is discussed below.

In case of export if you drop data pump export operation then export process will abort.

In case of import if you drop data pump import operation then import process will abort while it leads an incomplete import.

If the data pump job is completed and master table exist (a common if you do export operation with KEEP_MASTER=y) then it is safe to drop the master table.

Step by step cleanup orphaned datapump jobs is discussed below.

Step 01: Check the orphaned datapump jobs.

sqlplus / as sysdba
SET lines 140
COL owner_name FORMAT a10;
COL job_name FORMAT a20
COL state FORMAT a12
COL operation LIKE owner_name
COL job_mode LIKE owner_name
SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ARJU SYS_EXPORT_SCHEMA_01 EXPORT SCHEMA NOT RUNNING 0
ARJU SYS_EXPORT_SCHEMA_02 EXPORT SCHEMA NOT RUNNING 0

Step 02: Check the state field. For orphaned jobs the state will be NOT RUNNING. So from the output we can say both are orphaned jobs.

Step 03: Drop the master table.
DROP TABLE ARJU.SYS_EXPORT_SCHEMA_01;
DROP TABLE ARJU.SYS_EXPORT_SCHEMA_02;

Step 04: Check for existing data pump jobs by query issued in step 01. If objects are in recyclebin bin then purge the objects from the recyclebin.

SQL> SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED_SESSIONS
---------- -------------------- ---------- ---------- ------------ -----------------
ARJU BIN$xMNQdACzQ6yl22kj EXPORT SCHEMA NOT RUNNING 0
9U0B8A==$0
ARJU BIN$BmUy4r5MSX+ojxFk EXPORT SCHEMA NOT RUNNING 0
sw8ocg==$0

SQL> PURGE TABLE ARJU.SYS_EXPORT_SCHEMA_01;

Table purged.

SQL> PURGE TABLE ARJU.SYS_EXPORT_SCHEMA_02;

Table purged.

Check if there is any orphaned jobs again.
SQL> SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs;

no rows selected

Step 05: In this stage you did not get any orphaned jobs if the jobs have a master table. If there are still jobs listed in dba_datapump_jobs do cleanup process like below.

SET serveroutput on
SET lines 100
DECLARE
job1 NUMBER;
BEGIN
job1 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_01','ARJU');
DBMS_DATAPUMP.STOP_JOB (job1);
END;
/

DECLARE
job2 NUMBER;
BEGIN
job2 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_SCHEMA_02','ARJU');
DBMS_DATAPUMP.STOP_JOB (job2);
END;
/

Related Documents

Wednesday, May 6, 2009

Understand the Estimate parameter in data pump export

With the ESTIMATE_ONLY parameter as in discussed on http://arjudba.blogspot.com/2009/02/estimate-dumpfile-size-before-taking.html we can estimate the space in bytes per tables that would be consumed without actually performing data pump export operation or in other word without generating dump file.

With help of ESTIMATE parameter of data pump export you can specify the method that Export will use to estimate how much disk space each table in the export job will consume (in bytes) before performing actual data pump export operation.

The ESTIMATE parameter can take two parameters. Either BLOCKS (default) or STATISTICS.

The meaning of these two parameter values are specified below.

BLOCKS: The estimate is calculated by multiplying the number of database blocks used by the target objects with the appropriate block sizes.

STATISTICS: The estimate is calculated using statistics for each table. So to be accurate you must analyze table recently.

Note that the outcome specified by ESTIMATE=BLOCKS is far away from the size of the actual dumpfile. In fact, ESTIMATE=BLOCKS method generates more inaccurate result from dump file size when,

a) The table was created with a much bigger initial extent size than was needed for the actual table data.

b) Many rows have been deleted from the table, or a very small percentage of each block is used.


The outcome generated by ESTIMATE=STATISTICS is most accurate to dump file size if recently table is analyzed.

Below is an example shown both in case of ESTIMATE=STATISTICS and ESTIMATE=BLOCKS. In both cases data pump export dump file is generated after estimation of dump file.

E:\>expdp schemas=arju userid=arju/a dumpfile=arju_11_01_blocks.dmp directory=test estimate=blocks
Export: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 11:51:12

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ARJU"."SYS_EXPORT_SCHEMA_03": schemas=arju userid=arju/********
dumpfile=arju_11_01_blocks.dmp directory=test estimate=blocks
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. estimated "ARJU"."SYS_EXPORT_SCHEMA_02" 320 KB
. estimated "ARJU"."SYS_EXPORT_SCHEMA_01" 128 KB
. estimated "ARJU"."AUTHOR" 64 KB
. estimated "ARJU"."BOOKAUTHOR" 64 KB
. estimated "ARJU"."BOOKS" 64 KB
. estimated "ARJU"."BOOK_CUSTOMER" 64 KB
. estimated "ARJU"."BOOK_ORDER" 64 KB
. estimated "ARJU"."ORDERITEMS" 64 KB
. estimated "ARJU"."PROMOTION" 64 KB
. estimated "ARJU"."PUBLISHER" 64 KB
. estimated "ARJU"."T" 64 KB
Total estimation using BLOCKS method: 1024 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ARJU"."SYS_EXPORT_SCHEMA_02" 214.3 KB 1125 rows
. . exported "ARJU"."SYS_EXPORT_SCHEMA_01" 31.55 KB 12 rows
. . exported "ARJU"."AUTHOR" 5.835 KB 14 rows
. . exported "ARJU"."BOOKAUTHOR" 5.609 KB 20 rows
. . exported "ARJU"."BOOKS" 7.781 KB 14 rows
. . exported "ARJU"."BOOK_CUSTOMER" 8.234 KB 21 rows
. . exported "ARJU"."BOOK_ORDER" 8.398 KB 21 rows
. . exported "ARJU"."ORDERITEMS" 6.742 KB 32 rows
. . exported "ARJU"."PROMOTION" 5.710 KB 4 rows
. . exported "ARJU"."PUBLISHER" 6.265 KB 8 rows
. . exported "ARJU"."T" 4.914 KB 1 rows
Master table "ARJU"."SYS_EXPORT_SCHEMA_03" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_SCHEMA_03 is:
E:\ORACLE\TEST\ARJU_11_01_blocks.DMP
Job "ARJU"."SYS_EXPORT_SCHEMA_03" successfully completed at 11:51:39

E:\>expdp schemas=arju userid=arju/a dumpfile=arju_11_01_statistics.dmp directory=test estimate=statistics
Export: Release 10.2.0.1.0 - Production on Thursday, 07 May, 2009 11:52:12

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ARJU"."SYS_EXPORT_SCHEMA_03": schemas=arju userid=arju/********
dumpfile=arju_11_01_statistics.dmp directory=test estimate=statistics
Estimate in progress using STATISTICS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. estimated "ARJU"."SYS_EXPORT_SCHEMA_02" 187.0 KB
. estimated "ARJU"."SYS_EXPORT_SCHEMA_01" 36.67 KB
. estimated "ARJU"."BOOK_ORDER" 8.832 KB
. estimated "ARJU"."BOOK_CUSTOMER" 8.708 KB
. estimated "ARJU"."BOOKS" 8.156 KB
. estimated "ARJU"."ORDERITEMS" 6.808 KB
. estimated "ARJU"."PUBLISHER" 6.542 KB
. estimated "ARJU"."AUTHOR" 6.054 KB
. estimated "ARJU"."PROMOTION" 5.882 KB
. estimated "ARJU"."BOOKAUTHOR" 5.746 KB
. estimated "ARJU"."T" 5.061 KB
Total estimation using STATISTICS method: 285.5 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ARJU"."SYS_EXPORT_SCHEMA_02" 214.3 KB 1125 rows
. . exported "ARJU"."SYS_EXPORT_SCHEMA_01" 31.55 KB 12 rows
. . exported "ARJU"."BOOK_ORDER" 8.398 KB 21 rows
. . exported "ARJU"."BOOK_CUSTOMER" 8.234 KB 21 rows
. . exported "ARJU"."BOOKS" 7.781 KB 14 rows
. . exported "ARJU"."ORDERITEMS" 6.742 KB 32 rows
. . exported "ARJU"."PUBLISHER" 6.265 KB 8 rows
. . exported "ARJU"."AUTHOR" 5.835 KB 14 rows
. . exported "ARJU"."PROMOTION" 5.710 KB 4 rows
. . exported "ARJU"."BOOKAUTHOR" 5.609 KB 20 rows
. . exported "ARJU"."T" 4.914 KB 1 rows
Master table "ARJU"."SYS_EXPORT_SCHEMA_03" successfully loaded/unloaded
******************************************************************************
Dump file set for ARJU.SYS_EXPORT_SCHEMA_03 is:
E:\ORACLE\TEST\ARJU_11_01_STATISTICS.DMP
Job "ARJU"."SYS_EXPORT_SCHEMA_03" successfully completed at 11:52:25

Using ESTIMATE=BLOCKS, before data pump export size is shown as 1024 KB and using ESTIMATE=STATISTICS, before data pump export size is shown as 285.5 KB and my actual dump file size was 472KB which is far away from estimation using ESTIMATE=BLOCKS as difference is 1024-472=552. In later case difference is 186.5.

Note that if a table involves LOBs, the dump file size may vary as ESTIMATE does not take LOB size into consideration.

Related Documents