Beruflich Dokumente
Kultur Dokumente
database. You Export tool to export data from source database, and Import tool to load
data into the target database. When you export tables from source database export tool
will extracts the tables and puts it into the dump file. This dump file is transferred to
the target database. At the target database the Import tool will copy the data from
dump file to the target database.
From Ver. 10g Oracle is recommending to use Data Pump Export and Import tools,
which are enhanced versions of original Export and Import tools.
The export dump file contains objects in the following order:
1.
2.
3.
4.
5.
6.
Type definitions
Table definitions
Table data
Table indexes
Integrity constraints, views, procedures, and triggers
Bitmap, function-based, and domain indexes
When you import the tables the import tool will perform the actions in the following
order, new tables are created, data is imported and indexes are built, triggers are
imported, integrity constraints are enabled on the new tables, and any bitmap,
function-based, and/or domain indexes are built. This sequence prevents data from
being rejected due to the order in which tables are imported. This sequence also
prevents redundant triggers from firing twice on the same data
Invoking Export and Import
Keyword
Description (Default)
-------------------------------------------------------------USERID
BUFFER
FILE
username/password
size of data buffer
output files (EXPDAT.DMP)
COMPRESS
GRANTS
INDEXES
DIRECT
LOG
ROWS
CONSISTENT
cross-table consistency(N)
FULL
OWNER
TABLES
RECORDLENGTH
length of IO record
INCTYPE
RECORD
TRIGGERS
STATISTICS
PARFILE
parameter filename
CONSTRAINTS
OBJECT_CONSISTENT
FEEDBACK
FILESIZE
FLASHBACK_SCN
FLASHBACK_TIME
QUERY
RESUMABLE
RESUMABLE_NAME
RESUMABLE_TIMEOUT
TTS_FULL_CHECK
TABLESPACES
TRANSPORT_TABLESPACE
TEMPLATE
Objects exported by export utility can only be imported by Import utility. Import
utility can run in Interactive mode or command line mode.
You can let Import prompt you for parameters by entering the IMP command
followed by your username/password:
Example: IMP SCOTT/TIGER
Or, you can control how Import runs by entering the IMP command followed
by various arguments. To specify parameters, you use keywords:
Format: IMP KEYWORD=value or
KEYWORD=(value1,value2,...,valueN)
Example: IMP SCOTT/TIGER IGNORE=Y TABLES=(EMP,DEPT)
FULL=N
or TABLES=(T1:P1,T1:P2), if T1 is
partitioned table
USERID must be the first parameter on the command line.
Keyword
USERID
BUFFER
FILE
SHOW
IGNORE
GRANTS
INDEXES
ROWS
LOG
FULL
FROMUSER
TOUSER
TABLES
RECORDLENGTH
INCTYPE
COMMIT
PARFILE
CONSTRAINTS
DESTROY
INDEXFILE
SKIP_UNUSABLE_INDEXES
FEEDBACK
Description (Default)
username/password
size of data buffer
input files (EXPDAT.DMP)
just list file contents (N)
ignore create errors (N)
import grants (Y)
import indexes (Y)
import data rows (Y)
log file of screen output
import entire file (N)
list of owner usernames
list of usernames
list of table names
length of IO record
incremental import type
commit array insert (N)
parameter filename
import constraints (Y)
overwrite tablespace data file (N)
write table/index info to specified file
skip maintenance of unusable indexes (N)
display progress every x rows(0)
TOID_NOVALIDATE
FILESIZE
STATISTICS
RESUMABLE
RESUMABLE_NAME
RESUMABLE_TIMEOUT
COMPILE
STREAMS_CONFIGURATION
STREAMS_INSTANITATION
"DEPT"
4 rows imported
. . importing table
"EMP"
14 rows imported
Example, Importing Tables of One User account into another User account
For example, suppose Ali has exported tables into a dump file mytables.dmp. Now
Scott wants to import these tables. To achieve this Scott will give the following
import command
$imp scott/tiger FILE=mytables.dmp
FROMUSER=ali TOUSER=scott
Then import utility will give a warning that tables in the dump file was exported by
user Ali and not you and then proceed.
The Export and Import utilities are the only method that Oracle supports for moving
an existing Oracle database from one hardware platform to another. This includes
moving between UNIX and NT systems and also moving between two NT systems
running on different platforms.
The following steps present a general overview of how to move a database between
platforms.
1. As a DBA user, issue the following SQL query to get the exact name of all tablespaces. You will
need this information later in the process.
Using IGNORE=y instructs Oracle to ignore any creation errors during the import and permit the import
to complete.
7.8.
Using Data Pump Export Utility
8.9.
To Use Data Pump, DBA has to create a directory in Server Machine
and create a Directory Object in the database mapping to the directory created
in the file system.
9.10.
The following example creates a directory in the filesystem and creates a
directory object in the database and grants privileges on the Directory Object to
the SCOTT user.
10.11. $mkdir my_dump_dir
$sqlplus
Enter User:/ as sysdba
SQL>create directory data_pump_dir as
/u01/oracle/my_dump_dir;
11.12. Now grant access on this directory object to SCOTT user
12.13. SQL> grant read,write on
directory data_pump_dir to scott;
13.14. Example of Exporting a Full Database
14.15. To Export Full Database, give the following command
15.16. $expdp scott/tiger FULL=y
DIRECTORY=data_pump_dir DUMPFILE=full.dmp
LOGFILE=myfullexp.log JOB_NAME=myfullJob
16.17. The above command will export the full database and it will create the
dump file full.dmp in the directory on the server /u01/oracle/my_dump_dir
17.18. In some cases where the Database is in Terabytes the above command
will not feasible since the dump file size will be larger than the operating
system limit, and hence export will fail. In this situation you can create multiple
dump files by typing the following command
18.19. $expdp scott/tiger FULL=y
DIRECTORY=data_pump_dir DUMPFILE=full%U.dmp
FILESIZE=5G LOGFILE=myfullexp.log
JOB_NAME=myfullJob
19.20. This will create multiple dump files named full01.dmp, full02.dmp,
full03.dmp and so on. The FILESIZE parameter specifies how much larger the
dump file should be.
21. Example of Exporting a Schema
22.To export all the objects of SCOTTS schema you can run the following export
data pump command.
23.$expdp scott/tiger
DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp
SCHEMAS=SCOTT
24.You can omit SCHEMAS since the default mode of Data Pump export is
SCHEMAS only.
25.If you want to export objects of multiple schemas you can specify the following
command
26.$expdp scott/tiger
DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp
SCHEMAS=SCOTT,HR,ALI
27. Exporting Individual Tables using Data Pump Export
28.You can use Data Pump Export utility to export individual tables. The
following example shows the syntax to export tables
29. $expdp hr/hr DIRECTORY=dpump_dir1 DUMPFILE=tables.dmp
30.
TABLES=employees,jobs,departments
31.
32. Exporting Tables located in a Tablespace
33.If you want to export tables located in a particular tablespace you can type the
following command
34.
35. $expdp hr/hr DIRECTORY=dpump_dir1 DUMPFILE=tbs.dmp
36. TABLESPACES=tbs_4, tbs_5, tbs_6
37.
38.The above will export all the objects located in tbs_4,tbs_5,tbs_6
39.
40. Excluding and Including Objects during Export
41.You can exclude objects while performing a export by using EXCLUDE option
of Data Pump utility. For example you are exporting a schema and dont want
to export tables whose name starts with A then you can type the following
command
42.$expdp scott/tiger
DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp
SCHEMAS=SCOTT EXCLUDE=TABLE:like A%
43.Then all tables in Scotts Schema whose name starts with A will not be
exported.
44.Similarly you can also INCLUDE option to only export certain objects like this
45.$expdp scott/tiger
DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp
SCHEMAS=SCOTT INCLUDE=TABLE:like A%
46.This is opposite of EXCLUDE option i.e. it will export only those tables of
Scotts schema whose name starts with A
60. The job is placed in a stopped state and exits the client.
61. After finishing his other work, the DBA wants to resume the export job and the client
machine from where he actually started the job is locked because, the user has locked
his/her cabin. So now the DBA will go to another client machine and he reattach to the
job by typing the following command
the client.
66. Note: After reattaching to the Job a DBA can also kill the job by typing KILL_JOB, if he
doesnt want to continue with the export job.
What are the parameters to be provided while executing Export and Import commands?
The parameters that need to be provided while executing IMPORT or EXPORT commands are: ..................
Read answer
Oracle processes
User process User process is used in invocation of application software, Data writing process - A database writer process is used to write buffer
content into a datafile. They are specifically used to write dirty block to data files from the buffer...............
Read answer
7.
UNION: The UNION operator is used to combine the result-set of two or more SELECT statements Tables of both the select statement
must have the same number of columns with similar data types. It eliminates duplicates..........
Read answer