100% found this document useful (1 vote)
277 views7 pages

Export Import For Students

The document describes the different modes of the Oracle export and import utilities: - Table mode exports or imports specific tables. User mode exports or imports all objects belonging to a user. Full database mode exports or imports all objects in the entire database. - The export utility can export table definitions, table data, grants, indexes and constraints. It has parameters for specifying the file, tables, and whether to export rows, grants or indexes. - The import utility can import objects exported by the export utility. It has parameters for specifying the file, tables to import, the original owner, and whether to import rows or ignore existing objects.

Uploaded by

Mithun Sarker
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
277 views7 pages

Export Import For Students

The document describes the different modes of the Oracle export and import utilities: - Table mode exports or imports specific tables. User mode exports or imports all objects belonging to a user. Full database mode exports or imports all objects in the entire database. - The export utility can export table definitions, table data, grants, indexes and constraints. It has parameters for specifying the file, tables, and whether to export rows, grants or indexes. - The import utility can import objects exported by the export utility. It has parameters for specifying the file, tables to import, the original owner, and whether to import rows or ignore existing objects.

Uploaded by

Mithun Sarker
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Export/Import has two mode :

a) Parameter mode
(exp SYSTEM/password FILE=myexp.dmp FULL=y LOG=myexp.log
b) Interactive mode
(exp SYSTEM/password)

EXPORT

4 Modes of export utility:

1. Table Mode:

In table mode, you can export table data or the table definitions. (If no rows are exported,
the CREATE TABLE statement is placed in the export file, with grants and indexes, if they
are specified.)

A user with the EXP_FULL_DATABASE role can use table mode to export tables from any
user's schema by specifying TABLES=schemaname.tablename.

exp SYSTEM/password FILE=expdat.dmp TABLES=(scott.emp,blake.dept)


GRANTS=y INDEXES=y

exp blake/paper FILE=blake.dmp TABLES=(dept, manager) ROWS=y COMPRESS=y

Pattern matching is used to export various tables for users scott and
blake.
exp SYSTEM/password FILE=misc.dmp TABLES=(scott.%P%,blake.%,scott.%S%)

Table definitions, table data (all or selected rows), Owner tables (grants, indexes), Table
Constraints.
.

2. User Mode:

User mode exports can be used to back up one or more database users. For example, a
DBA may want to back up the tables of deleted users for a period of time. User mode is
also appropriate for users who want to back up their own data or who want to move
objects from one owner to another. In this example, user scott is exporting his own
tables.

exp scott/tiger FILE=scott.dmp OWNER=scott GRANTS=y ROWS=y COMPRESS=y

Table definitions, table data, Owner tables (grants, indexes), Table constraints.
3. Full Database Mode:

Only users with the DBA role or the EXP_FULL_DATABASE role can export in full database
mode. In this example, an entire database is exported to the file dba.dmp with all GRANTS
and all data. All objects are exported.

Table definitions, table data, grants, indexes, Table constraints.

exp SYSTEM/password FULL=y FILE=dba.dmp GRANTS=y ROWS=y

4. Tablespace mode:

Table definitions, grants, indexes, Table constraints, triggers.

 All users can export into table and user mode.


 Users with the EXP_FULL_DATABASE role (privileged users) can export in all modes.
 You can use conventional path Export or direct path Export to export in any of the
first three modes.

Some parameters values:

Grants: Export grants (Y is default)


Indexes: Export Indexes (Y is default)
Rows: Export rows (Y is default)
Constraints: Export Constraints (Y is default)
Full: Must be Y to do a full export (N is default)
Owner: list of owner usernames.
Tables: list of table names.
parfile: parameter file.

Examples:

exp userid=scott/tiger full=Y file='c:/test.dmp' ['N is default']

exp userid=scott/tiger grants=N tables=(emp,dept) 'Exporting specific tables ['Y is


default']

exp hr/hr tables=emp,dept rows=y file=test.dmp

exp system/manager owner=hr direct=y file=test.dmp


exp \'username/password as sysdba'\' transport_tablespace=y tablespaces=ts_emp
log=ts.log

exp parfile=<parameter file>

IMPORT

Modes:
Table mode: import specified table
User mode: import all objects that belong to a user.
Tablespace: import all objects within the tablespace.
Full database: import all objects of the database.

Some parameters values:

Show: Show file contents(N is default)


Grants : import grants (Y is default)
Indexes: import Indexes (Y is default)
Rows: import rows (Y is default)
Full: import entire file(N is default)
fromuser: list of owner user.
touser:list of user names.
Tables: list of tablenames.
parfile: parameter file.

Examples:

imp hr/ hr TABLES= employees, departments rows= y file= exp1. dmp

imp system/ manager FROMUSER= hr file= exp2. dmp

imp \'username/ password AS SYSDBA\ ' TRANSPORT_ TABLESPACE= y


TABLESPACES= ts_ employees

Complete Example of Export utility:

Exporting table only:

$ exp userid= tappu/tappu grants=N indexes=N constraints=N tables=(emp)


[File will be created in \oracle\ora92\bin as expdat.dmp]
$ exp userid=tappu/tappu file=c:/exp.dmp grants=N indexes=N constraints=N
tables=(emp)

Export table without rows: [Only table structure will be send]

$ exp userid=tappu/tappu file= c:/exp.dmp grants=N indexes=N constraints=N rows=N


tables=(emp)

Export in full Mode:

$ exp userid=tappu/tappu file= c:/exp.dmp full=yes

[Export everything that has make the user such as: tablespace, profiles, roles, dblinks,
sequences, user definitions, tables, data dictionary tables etc]

Exporting a USER:

$ exp system/manage owner=tappu file=c:/exp.dmp


$ exp tappu/tappu owner=tappu file=c:/exp.dmp

Use of log file:

$ exp scott/tiger file=c:/exp.dmp log=c:/info.log tables=emp


[Log file gives information regarding export]

Use of parameter file:

$ exp userid=scott/tiger parfile=c:/export.txt

$ exp userid=scott/tiger parfile=export.txt

[exp PARFILE=filename
exp username/password PARFILE=filename]

Inside export file:

FILE= account.dmp # c:/account.dmp


FULL=n
OWNER= scott [Tables=emp,dept]
GRANTS=y
COMPRESS=y

DBA exporting of tables for 2 or more users:

$ exp system/manager file=c:/test.dmp tables=(scott.emp, tanvir.test)

$ exp scott/tiger file=c:/test.dmp tables= (scott.emp, tanvir.test)


[ Will be able to export emp table only not test table]

Pattern Matching to export various tables:

TABLES=(scott.%P%,blake.%,scott.%S%)
$ exp scott/tiger file=c:/test.dmp tables=e%,d%

Export as Sysdba:

exp \'username/password AS SYSDBA\'

Use of log file:

$ exp scott/tiger file=c:/exp.dmp log=c:/info.log tables=emp


[ Log file gives information regarding export]

Use of parameter file:

$ exp scott/tiger parfile=c:/export.txt


[exp PARFILE=filename
exp username/password PARFILE=filename]

Inside export.txt file:

File=c:/emp.dmp
Tables=dept,salgrade # ( used for comments)

Export as Sysdba:

exp \'username/password AS SYSDBA\'

$ imp raayan/raayan file=c:/exp.dmp full=yes


$ imp raayan/raayan file=c:/exp.dmp tables=emp
$ imp userid=raayan/raayan file=c:/exp.dmp tables=emp

Complete Example of Import utility:

Import of selected tables from a specific user:

$ imp tappu/tappu file=c:/exp.dmp fromuser=scott tables=dept


$ imp system/manage file=c:/exp.dmp fromuser=scott touser=tappu tables=emp

$ imp tappu/tappu file=c:/exp.dmp tables=dept

Importing all tables:

$ imp tappu/tappu file=c:/exp.dmp tables=(*)

Importing tables without rows:

$ imp tappu/tappu file=c:/exp.dmp tables=(dept) rows=N

Pattern matching imports:

$ imp SYSTEM/password FROMUSER=scott FILE=scott.dmp TABLES=(%d%,b%s)

Importing with object already exists:

$ imp tappu/tappu file=c:/exp.dmp tables=(dept) ignore=Y

(ignore specifies if the table exist then also it will be imported. By


default ignore=N)

Importing as Sysdba:

imp \'username/password AS SYSDBA\'

$ imp \”tappu/tappu as sysdba\” file=c:/exp.dmp tables=(dept) ignore=Y


Importing using logfiles:

$ imp tappu/tappu file=c:/exp.dmp tables=(dept) rows=N log=c:/test.txt

Import in Full mode:

$ imp tappu/tappu file=c:/exp.dmp full=yes

(imports a full database export dump file.)

Import in owner mode:

$ imp tappu/tappu fromuser=scott file=c:/exp.dmp

Use of Show:

Default: n
When SHOW=y, the contents of the export file are listed to the display and not imported.
The SQL statements contained in the export are displayed in the order in which Import
will execute them.

The SHOW parameter can be used only with the FULL=y, FROMUSER, TOUSER, or TABLES
parameter.

Parameter Files:

imp SYSTEM/password PARFILE=params.dat

The params.dat file contains the following information:

FILE=dba.dmp
SHOW=n
IGNORE=n
GRANTS=y
FROMUSER=scott
TABLES=(dept,emp)

You might also like