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

Sunday 25 November 2018

ORA-31693 ORA-02354: error in exporting/importing data ORA-01555: snapshot too old


Error:

ORA-31693: Table data object "MIS"."MASTER_MISDB" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-01555: snapshot too old: rollback segment number 4 with name "_SYSSMU4_4250244621$" too small


[oracle@said]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 26 10:15:18 2018

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

Enter user-name: /as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show parameter undo

NAME      TYPE VALUE
------------------------------------ ----------- ------------------------------
temp_undo_enabled      boolean FALSE
undo_management      string AUTO
undo_retention      integer 7200
undo_tablespace      string UNDOTBS1
SQL>

SQL> select max(maxquerylen) from v$undostat;

MAX(MAXQUERYLEN)
----------------
  204662
 
Solution:
 
1. Modify the current UNDO_RETENTION for the database:
 

SQL> ALTER SYSTEM SET UNDO_RETENTION = 205000 scope=both sid='*';

SQL> show parameter undo

NAME      TYPE VALUE
------------------------------------ ----------- ------------------------------
temp_undo_enabled      boolean FALSE
undo_management      string AUTO
undo_retention      integer 205000
undo_tablespace      string UNDOTBS1

2. Perform the export again.

Thursday 16 March 2017

Export/Import in Datapump using query parameter


Purpose
Enables you to filter the data that is exported by specifying a clause for a SELECT statement, which is applied to all/multiple tables in the export job or to a specific table.
Solution
[oracle@said ~]$ cat bak.sh
expdp system/passwd@orcl parfile=/home/oracle/parameter.par
[oracle@said ~]$


[oracle@said ~]$ cat parameter.par
tables=SCOTT.EMP
query=SCOTT.EMP:"WHERE (liability_issued - nvl(liability_reversed, 0) != 0
or  paid_margin_amount_lcy - nvl(refunded_margin_lcy, 0) != 0
or  indem_liability_issued - nvl(indem_liability_reversed, 0) != 0)"
directory=dpump
dumpfile=emp.dmp
logfile=emp.log
[oracle@said ~]$  ./back.sh

Export: Release 11.2.0.3.0 - Production on Thu Mar 16 14:39:45 2017

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/********@orcl parfile=/home/oracle/parameter.par
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 683.1 GB
Processing object type TABLE_EXPORT/TABLE/TABLE
.
.
.
.
.
.

Thursday 12 May 2016

Export Backup exclude table in Data Pump Error: ORA-39071


Error :

ORA-39001: invalid argument value
ORA-39071: Value for EXCLUDE is badly formed.
ORA-00911: invalid character


Solution:

[oracle@saidrasel]$ expdp system/password schemas= "exclude=TABLE:\"IN ('OUTWDCLR','INWARD_IMAGE')\"" directory=DATA_P dumpfile=MICR-20160512.dmp logfile=MICR-20160512.log EXCLUDE=STATISTICS CONTENT=ALL


Thursday 24 March 2016

ORA-31634 job already exists ORA-31664 unable to construct unique job name when defaulted

Error :

With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31634: job already exists

ORA-31664: unable to construct unique job name when defaulted

Reason:

DBA_DATAPUMP_JOBS table become equals to 99  for any particular schema thats why the error is coming

Solution:

Step 1: Execute the following query

select owner_name,job_name,operation,state from DBA_DATAPUMP_JOBS;

Step 2: If the output of the above query return 99 rows like as follows

SYSTEM SYS_EXPORT_SCHEMA_97 EXPORT                         NOT RUNNING
SYSTEM SYS_EXPORT_SCHEMA_98 EXPORT                         NOT RUNNING
SYSTEM SYS_EXPORT_SCHEMA_99 EXPORT                         NOT RUNNING

Step 3: Execute the following script

select 'DROP TABLE '||owner||'.'||table_name||';'
from dba_tables
where table_name like '%SYS%EXPORT%';

---Output Sample---

DROP TABLE SYSTEM.SYS_EXPORT_SCHEMA_01;
DROP TABLE SYSTEM.SYS_EXPORT_SCHEMA_02;
DROP TABLE SYSTEM.SYS_EXPORT_SCHEMA_03;
DROP TABLE SYSTEM.SYS_EXPORT_SCHEMA_04;

Step 4: Drop table from above output


Step 5: Re execute the backup script now.

If found any issues ...Please give me a buzz.....

Wednesday 12 November 2014

How to Prevent ORA-39000 ORA-31640 ORA-27037 Errors When Performing DataPump Export/Import

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.1 and later Information in this document applies to any platform.

GOAL:

This article documents a resolution for errors ORA-39000, ORA-31640 and ORA-27037 when performing DataPump export/import. DataPump Import can fail with the following errors:

Import: Release 10.2.0.1.0 - Production on Friday, 30 January, 2009 15:10:33
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
ORA-39000: bad dump file specification
ORA-31640: unable to open dump file "/oracle/u01/app/oracle/oracle/product/10.2.0/db_2/admin
/dpdump/expdat.dmp" for read
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

SOLUTION:

The parameter DIRECTORY specifies the location to which the DataPump Export or Import  is not properly created or having permission issues.
Drop  and re-create a new oracle directory object and change the expdp/impdp command to point to the new directory to resolve this issue.  You must have the DBA Privilege to create a Directory.
For example to create a directory object named expdp_dir located at /u01/backup/exports enter the following sql statement:

SQL> drop directory expdp_dir;
SQL> create directory expdp_dir as '/u01/backup/exports';
Then grant read and write permissions to the users who will be performing the data pump export and import.
SQL> grant read, write on directory expdp_dir to system, user1, user2, user3;

REFERENCES:  Doc ID 784566.1

DataPump Import (IMPDP) Fails With Errors ORA-39001 ORA-39000 ORA-31640 ORA-27037

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.2.0.4 [Release 10.1 to 11.2]
Information in this document applies to any platform.


ERROR SYMPTOMS:

DataPump import fails with the following errors:
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31640: unable to open dump file "/u01/bkups/exports/EXPORT.dmp" for read
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

The parameters used are:

userid=system/
DIRECTORY=my_dir
DUMPFILE=EXPORT.dmp
LOGFILE=my_logdir:EXPORT.log
CHANGES

DataPump export with parameters:
userid=username/
DIRECTORY=my_dir
DUMPFILE=EXPORT.DMP
LOGFILE=EXPORT.log
content=metadata_only
VERSION=10.2.0

was successful:
Master table "EXPORT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for EXPORT.SYS_EXPORT_SCHEMA_01 is:
/spare/clone/EXPORT.DMP
Job "EXPORT"."SYS_EXPORT_SCHEMA_01" successfully completed at 20:41:12

CAUSE:

At first glance, this appears to be an exact match to the note 784566.1 How to Prevent ORA-39000 ORA-31640 ORA-27037 Errors When
Performing Data Pump Export/Import

If you have already read that note, tried the solution and are still getting the errors, then the problem may be with the actual
export.dmp file.

In this case, as you can see from the export par file and import par file the name of the export dump is not the same:

Export: DUMPFILE=EXPORT.DMP
Import: DUMPFILE=EXPORT.dmp

SOLUTION:

Once the import parameter was changed to DUMPFILE=EXPORT.DMP the import completes successfully.


Reference : Doc ID 1228194.1

Sunday 7 September 2014

Export/Import specific tablespace using Data Pump in Oracle 10g Database


1.  Tablespace Export

expdp system/ TABLESPACES=USERS,UNDOTBS1 directory=DATA_PUMP_DIR dumpfile=test.dmp LOGFILE=exp.log    parallel=2  

In the above example, expdp takes a backup of the contents of USERS,UNDOTBS1. The expdp also runs quickly because of the parallel=2 option (provided there are more CPUs available in the database server). 

2. Transportable tablespace

expdp system/ transport_tablespaces=test_user_tbs transport_full_check=y directory= DATA_PUMP_DIR dumpfile=test.dmp logfile=exp.log

Transportable tablespaces export and import is manageable across platforms and only Meta data will be exported. In Cross platform transportable tablespace the data movement is simpler and faster.

This mode requires that you have the EXP_FULL_DATABASE role.

Please note that

1. source and target database must use the same character set/national character set
2. You cannot transport a tablespace to a target database which already exists.
3. Transportable tablespace exports cannot be restarted once stopped
4. Target database must at same or higher release level as the source database.

Transportable tablespace export and import on same endian platforms 
Step 1: Find the Operating system byte order on Source and Target Database
SQL > select * from v$transportable_platform order by platform_id;

1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
3 HP-UX (64-bit) Big
4 HP-UX IA (64-bit) Big
5 HP Tru64 UNIX Little
6 AIX-Based Systems (64-bit) Big
7 Microsoft Windows IA (32-bit) Little
8 Microsoft Windows IA (64-bit) Little
9 IBM zSeries Based Linux Big
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
12 Microsoft Windows 64-bit for AMD Little
13 Linux 64-bit for AMD Little
15 HP Open VMS Little
16 Apple Mac OS Big
17 Solaris Operating System (x86) Little

18 IBM Power Based Linux Big


3. Tablespace Import

impdp system/ TABLESPACES=USERS directory=DATA_PUMP_DIR dumpfile=test.dmp LOGFILE=imp.log

Above example imports all tables that have data in tablespaces USERS and it assumes that the tablespaces already exist.















Tuesday 24 June 2014

ORA-39068 ORA-01950: no privileges on tablespace ORA-39097: Data Pump job encountered unexpected error -1950

Error:

ORA-39006: internal error
ORA-39068: invalid master table data in row with PROCESS_ORDER=-3
ORA-01950: no privileges on tablespace 'FCAT_NRB'
ORA-39097: Data Pump job encountered unexpected error -1950

Reason: The user executing data pump job has not privilege on "FCAT_NRB" tablespace

Solution: Please execute the following privilege and try to execute the data pump job again.

alter user NRBAPP_NRB quota unlimited on FCAT_NRB;

Please try again...and buzz me please if required anything..

Thursday 3 October 2013

EXP-00026: conflicting modes specified


Problem:

exp scott/tiger@orcl owner=hr FULL=Y ROWS=N file=D:\as_03102013.dmp log=D:\as_03102013.log statistics=none buffer=10000


Description: 
Try to do the export in anyone of the mode (Table, User or Database). I guess, your problem might be because of using 2 or more such options at the same time.


 Solution:

exp scott/tiger@orcl owner=hr  ROWS=N file=D:\as_03102013.dmp log=D:\as_03102013.log statistics=none buffer=10000

Copying Database Structure Without Data Using exp/imp

This is a very good way to get the DDL of your database objects so that you can re-create a view or stored procedure without having to perform an incomplete restore.

exp userid=system file=full_03102013.dmp rows=n


When I need to see the contents, I use the import utility with the SHOW=Y parameter to see the DDL, similar to the following:


imp userid=system file=full_03102013.dmp show=y  log=create_ddl_03102013.sql full=y


For instance, to see just the SCOTT.EMP table, use the following:


imp userid=system file=full_03102013.dmp show=y  log=create_emp.sql tables=scott.emp




The imp utility will skip all other objects in the dump file. The resulting log file will need some slight text editing to get the correct command.
Finally, the INDEXFILE parameter is much more readable than SHOW=Y for the imp utility. However, the INDEXFILE parameter will only show the CREATE TABLE and CREATE INDEX statements. If you need to see CREATE VIEW or CREATE PROCEDURES statements, the only option is the SHOW=Y parameter.

Wednesday 18 September 2013

Oracle Data Pump (expdp and impdp) in Oracle Database 10g

Oracle Data Pump (expdp and impdp) in Oracle Database 10g


For the examples to work we must first unlock the SCOTT account and create a directory object it can access. The directory object is only a pointer to a physical directory, creating it does not actually create the physical directory on the file system of the database server.
CONN / AS SYSDBA
ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;

CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
GRANT READ, WRITE ON DIRECTORY test_dir TO scott;
Existing directories can be queried using the ALL_DIRECTORIES view.
Note. Data Pump is a server-based technology, so it typically deals with directory objects pointing to physical directories on the database server. It does not write to the local file system on your client PC.

Table Exports/Imports

The TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax.
expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log

impdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.log
For example output files see expdpEMP_DEPT.log and impdpEMP_DEPT.log.
The TABLE_EXISTS_ACTION=APPEND parameter allows data to be imported into existing tables.

Schema Exports/Imports

The OWNER parameter of exp has been replaced by the SCHEMAS parameter which is used to specify the schemas to be exported. The following is an example of the schema export and import syntax.
expdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log

impdp scott/tiger@db10g schemas=SCOTT directory=TEST_DIR dumpfile=SCOTT.dmp logfile=impdpSCOTT.log
For example output files see expdpSCOTT.log and impdpSCOTT.log.

Database Exports/Imports

The FULL parameter indicates that a complete database export is required. The following is an example of the full database export and import syntax.
expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log

impdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=impdpDB10G.log

INCLUDE and EXCLUDE

The INCLUDE and EXCLUDE parameters can be used to limit the export/import to specific objects. When the INCLUDE parameter is used, only those objects specified by it will be included in the export/import. When the EXCLUDE parameter is used, all objects except those specified by it will be included in the export/import. The two parameters are mutually exclusive, so use the parameter that requires the least entries to give you the result you require. The basic syntax for both parameters is the same.
INCLUDE=object_type[:name_clause] [, ...]
EXCLUDE=object_type[:name_clause] [, ...]
The following code shows how they can be used as command line parameters.
expdp scott/tiger@db10g schemas=SCOTT include=TABLE:"IN ('EMP', 'DEPT')" directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log

expdp scott/tiger@db10g schemas=SCOTT exclude=TABLE:"= 'BONUS'" directory=TEST_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
If the parameter is used from the command line, depending on your OS, the special characters in the clause may need to be escaped, as follows. Because of this, it is easier to use a parameter file.
include=TABLE:\"IN (\'EMP\', \'DEPT\')\"
A single import/export can include multiple references to the parameters, so to export tables, views and some packages we could use either of the following approaches.
INCLUDE=TABLE,VIEW,PACKAGE:"LIKE '%API'"

or

INCLUDE=TABLE
INCLUDE=VIEW
INCLUDE=PACKAGE:"LIKE '%API'"
Multiple objects can be targeted in once statement using the LIKE and IN operators.
EXCLUDE=SCHEMA:"LIKE 'SYS%'"

EXCLUDE=SCHEMA:"IN ('OUTLN','SYSTEM','SYSMAN','FLOWS_FILES','APEX_030200','APEX_PUBLIC_USER','ANONYMOUS')

Network Exports/Imports (NETWORK_LINK)

The NETWORK_LINK parameter identifies a database link to be used as the source for a network export/import. The following database link will be used to demonstrate its use.
CONN / AS SYSDBA
GRANT CREATE DATABASE LINK TO test;

CONN test/test
CREATE DATABASE LINK remote_scott CONNECT TO scott IDENTIFIED BY tiger USING 'DEV';
In the case of exports, the NETWORK_LINK parameter identifies the database link pointing to the source server. The objects are exported from the source server in the normal manner, but written to a directory object on the local server, rather than one on the source server. Both the local and remote users require the EXP_FULL_DATABASE role granted to them.
expdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR dumpfile=EMP.dmp logfile=expdpEMP.log
For imports, the NETWORK_LINK parameter also identifies the database link pointing to the source server. The difference here is the objects are imported directly from the source into the local server without being written to a dump file. Although there is no need for a DUMPFILE parameter, a directory object is still required for the logs associated with the operation. Both the local and remote users require theIMP_FULL_DATABASE role granted to them.
impdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR logfile=impdpSCOTT.log remap_schema=SCOTT:TEST

Oracle Data Pump using Database link in Oracle Database 10g

Oracle Data Pump using Database link in Oracle Database 10g


Network Exports/Imports (NETWORK_LINK)

The NETWORK_LINK parameter identifies a database link to be used as the source for a network export/import. The following database link will be used to demonstrate its use.
CONN / AS SYSDBA
GRANT CREATE DATABASE LINK TO test;

CONN test/test
CREATE DATABASE LINK remote_scott CONNECT TO scott IDENTIFIED BY tiger USING 'DEV';
In the case of exports, the NETWORK_LINK parameter identifies the database link pointing to the source server. The objects are exported from the source server in the normal manner, but written to a directory object on the local server, rather than one on the source server. Both the local and remote users require the EXP_FULL_DATABASE role granted to them.
expdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR dumpfile=EMP.dmp logfile=expdpEMP.log
For imports, the NETWORK_LINK parameter also identifies the database link pointing to the source server. The difference here is the objects are imported directly from the source into the local server without being written to a dump file. Although there is no need for a DUMPFILE parameter, a directory object is still required for the logs associated with the operation. Both the local and remote users require theIMP_FULL_DATABASE role granted to them.
impdp test/test@db10g tables=SCOTT.EMP network_link=REMOTE_SCOTT directory=TEST_DIR logfile=impdpSCOTT.log remap_schema=SCOTT:TEST