[root
@localhost ~]# su
-oracle
[oracle
@localhost ~]$
clear
[oracle
@localhost ~]$ cd $ORACLE_BASE
[oracle
@localhost oracle]$ ls
admin
archive cfgtoollogs checkpoints diag flash_recovery_area oradata pl_sql_pacakge
[oracle
@localhost oracle]$ mkdir
-p test_imp_exp
[oracle
@localhost oracle]$ cd test_imp_exp
/
[oracle
@localhost test_imp_exp]$ ls
[oracle
@localhost test_imp_exp]$ pwd
/u01
/app
/oracle
/test_imp_exp
[oracle
@localhost test_imp_exp]$
sqlplushr
/hr
@jiagulun
SQL
*Plus
:
Release
11.2.0.1.0 Production
onTue Jan
20
23
:
50
:
52
2015
Copyright
(c
)
1982
,
2009
,Oracle.
Allrights reserved.
Connected
to
:
Oracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
SQL
>
select
*
fromstudent
;
ID
NAME AGE
---------- -------------------- ----------
SQL
>
select
*
fromaddress
;
XH ZZ
---------- ----------
SQL
>
exit
;
Disconnected
fromOracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
[oracle
@localhost test_imp_exp]$
exp
help
=y
--通过这个来查看关于exp命令的解释
Export
:
Release
11.2.0.1.0
-Production
onTue Jan
20
23
:
51
:
56
2015
Copyright
(c
)
1982
,
2009
,Oracle
and
/
orits affiliates.
Allrights reserved.
You can let
Export
promptyou
for
parameters
byentering
the
EXP
command followed
byyour username
/
password
:
Example
:
EXPSCOTT
/TIGER
Or
,you can control how
Exportruns
byentering
the
EXPcommand followed
byvarious arguments.
Tospecify
parameters
,you
usekeywords
:
Format
:
EXPKEYWORD
=
value
orKEYWORD
=(value1
,value2
,...
,valueN
)
Example
:
EXPSCOTT
/TIGER GRANTS
=Y
TABLES
=(EMP
,DEPT
,MGR
)
or
TABLES
=(T1
:P1
,T1
:P2
),
ifT1
ispartitioned
table
USERID must be
the
firstparameter
on
thecommand line.
Keyword
Description
(
Default
) Keyword
Description
(
Default
)
--------------------------------------------------------------------------
USERID username
/
password
FULL
exportentire
file
(N
)
BUFFER
size
of
data
buffer OWNER
list
ofowner usernames
FILE output files
(EXPDAT.DMP
)
TABLES
list
of
tablenames
COMPRESS import
into
one
extent
(Y
)RECORDLENGTH
length
ofIO
record
GRANTS
exportgrants
(Y
) INCTYPE incremental
export
type
INDEXES
export
indexes
(Y
)
RECORD track incr.
export
(Y
)
DIRECT
direct
path
(N
)
TRIGGERS
export
triggers
(Y
)
LOG
log
file
of
screenoutput
STATISTICS
analyzeobjects
(
ESTIMATE
)
ROWS
export
data
rows
(Y
) PARFILE parameter filename
CONSISTENT
cross
-
tableconsistency
(N
)
CONSTRAINTS
export
constraints
(Y
)
OBJECT_CONSISTENT
transaction
set
to
read
onlyduring
object
export
(N
)
FEEDBACK display progress every x
rows
(
0
)
FILESIZE
maximum
size
of
each
dump
file
FLASHBACK_SCN
SCNused
to
set
session
snapshotback
to
FLASHBACK_TIME
timeused
to
get
the
SCNclosest
to
thespecified
time
QUERY
selectclause used
to
exporta subset
ofa
table
RESUMABLE
suspend
whena
spacerelated
error
isencountered
(N
)
RESUMABLE_NAME text
stringused
toidentify
resumable
statement
RESUMABLE_TIMEOUT
wait
time
for
RESUMABLE
TTS_FULL_CHECK perform
full
orpartial dependency
check
forTTS
VOLSIZE
number
ofbytes
to
write
to
eachtape volume
TABLESPACES
list
oftablespaces
to
export
TRANSPORT_TABLESPACE
exporttransportable
tablespacemetadata
(N
)
TEMPLATE
template
namewhich invokes iAS
mode
export
[oracle
@localhost test_imp_exp]$
exphr
/hr
@jiagulun
tables
=student
file
=/u01
/app
/oracle
/test_imp_exp
/hr_student_file.dbf
log
=/u01
/app
/oracle
/test_imp_exp
/hr_student_log.log
Export
:
Release
11.2.0.1.0
-Production
onWed Jan
21
00
:
05
:
42
2015
--上面的命令为通过导出表的模式导出student表
Copyright
(c
)
1982
,
2009
,Oracle
and
/
orits affiliates.
Allrights reserved.
Connected
to
:Oracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
Exportdone
inZHS16GBK
character
set
andAL16UTF16
NCHAR
character
set
About
to
exportspecified
tablesvia Conventional
Path...
. . exporting
table STUDENT
4
rowsexported
Exportterminated successfully
withoutwarnings.
[oracle
@localhost test_imp_exp]$
!ls
-a
ls
-a
. .. expdat.dmp hr_student_file.dbf hr_student_log.log
[oracle
@localhost test_imp_exp]$
exphr
/hr
@jiagulun tablespaces
=
users
file
=/u01
/app
/oracle
/test_imp_exp
/hr_tbs_users_file.dbf
log
=/u01
/app
/oracle
/test_imp_exp
/hr_tbs_users_log.log
Export
:
Release
11.2.0.1.0
-Production
onWed Jan
21
00
:
08
:
23
2015
--导出表空间
Copyright
(c
)
1982
,
2009
,Oracle
and
/
orits affiliates.
Allrights reserved.
Connected
to
:Oracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
EXP
-
00023
:must be a
DBA
todo
Full
Database
or
Tablespace
export
--假如是导出数据库或者恶表空间需要dba来做
(
2
)U
(sers
),
or
(
3
)T
(ables
):
(
2
)U
>u
--自动跳到了交互提示符模式:exp
Exportgrants
(
yes
/
no
):
yes
>
yes
Export
table
data
(
yes
/
no
):
yes
>
yes
Compress
extents
(
yes
/
no
):
yes
>
yes
Exportdone
inZHS16GBK
character
set
andAL16UTF16
NCHAR
character
set
About
to
exportselected tablespaces ...
. exporting referential integrity
constraints
. exporting
triggers
Exportterminated successfully
withwarnings.
[oracle
@localhost test_imp_exp]$ ls
expdat.dmp hr_student_file.dbf hr_student_log.log hr_tbs_users_file.dbf hr_tbs_users_log.log
[oracle
@localhost test_imp_exp]$ ll
total
40
-rw
-r
--r-- 1 oracle oinstall 0 Jan 21 00:02 expdat.dmp
-rw
-r
--r-- 1 oracle oinstall 16384 Jan 21 00:05 hr_student_file.dbf
-rw
-r
--r-- 1 oracle oinstall 427 Jan 21 00:05 hr_student_log.log
-rw
-r
--r-- 1 oracle oinstall 16384 Jan 21 00:10 hr_tbs_users_file.dbf
-rw
-r
--r-- 1 oracle oinstall 463 Jan 21 00:10 hr_tbs_users_log.log
[oracle
@localhost test_imp_exp]$
sqlplus
/
as
sysdba
SQL
*Plus
:
Release
11.2.0.1.0 Production
onWed Jan
21
00
:
11
:
22
2015
Copyright
(c
)
1982
,
2009
,Oracle.
Allrights reserved.
Connected
to
:
Oracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
SQL
>
create
usertest1
identified
bytest1
;
Usercreated.
SQL
>
grant
connect
,
resource
totest1
;
Grantsucceeded.
SQL
>
create
tabletest_export_tab
(
id
number
(
20
),
name
varchar2
(
20
));
Tablecreated.
SQL
>
insert
intotest_export_tab
values
(
1
,
'zhangsan'
);
1
rowcreated.
SQL
>
exit
;
Disconnected
fromOracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
[oracle
@localhost test_imp_exp]$
exphr
/hr
@jiagulun
tables
=test1.test_export_tab
file
=/u01
/app
/oracle
/test_imp_exp
/hr_test1_tab_file.dbf
log
=/u01
/app
/oracle
/test_imp_exp
/hr_test1_tab_log.log
Export
:
Release
11.2.0.1.0
-Production
onWed Jan
21
00
:
20
:
07
2015
--导出不同用户的表
Copyright
(c
)
1982
,
2009
,Oracle
and
/
orits affiliates.
Allrights reserved.
Connected
to
:Oracle
Database
11g
EnterpriseEdition
Release
11.2.0.1.0
-
64bit Production
With
thePartitioning
,OLAP
,
Data
Mining
and
RealApplication Testing options
Exportdone
inZHS16GBK
character
set
andAL16UTF16
NCHAR
character
set
About
to
exportspecified
tablesvia Conventional
Path...
EXP
-
00009
:
no
privilege
to
exportTEST1
's table TEST_EXPORT_TAB
Export terminated successfully with warnings.
--导出不同用户的数据信息必须有权限
[oracle@localhost test_imp_exp]$ exp system/oracle@jiagulun tables=test1.test_export_tab file=/u01/app/oracle/test_imp_exp/hr_test1_tab_file.dbf log=/u01/app/oracle/test_imp_exp/hr_test1_tab_log.log
Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:23:48 2015
--system用户可以导出不同用户数据
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
Current user changed to TEST1
. . exporting table TEST_EXPORT_TAB 1 rows exported
Export terminated successfully without warnings.
|