Oracle Database Backup and Recovery Summary -exp/imp
$ Exp help = y
$ Imp help = y
2.
(1) an interactive way
$ Exp
(2) command line mode
$ Exp user / pwd @ dbname file = / oracle / test.dmp full = y
(3) parameters of papers
$ Exp parfile = username.par
Parameter file username.par content userid = username / userpassword buffer = 8192000
compress = n grants = y
file = / oracle / test.dmp full = y
3.
(1) Table means the table will specify the data export / import.
Export:
Export one or a few table:
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log tables = table1, table2
Export of a portion of the data tables
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log tables = table1 query = \ "where col1 = \ '... \'
and col2 \ <... \ "
Import:
Import one or a few tables
$
(2) user mode, all objects in the specified user and data export / import.
Export:
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log owner = (xx, yy)
Export only the data objects, non-export data
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log owner = user rows = n
Import:
$
commit = y ignore = y
(3) Full library way, all objects in the database export / import
Export:
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log full = ycommit = y ignore = y
Import:
$ Imp user / pwd file = / dir / xxx.dmp log = xxx.log fromuser = dbuser touser = dbuser2
1.2
1.
Of a number of fixed-size papers Export: This is usually a larger amount of data used in the table, a single dump file may be
Would exceed the limit of the file system
$ Exp user / pwd file = 1.dmp, 2.dmp, 3.dmp, ... filesize = 1000m
Of a number of fixed-size papers into
$
2.
/ / Oracle 9i
Must
Incremental Export:
(1) "full" incremental export (Complete)
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log inctype = complete
(2) "incremental" incremental export
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log inctype = incremental
(3)
$ Exp user / pwd file = / dir / xxx.dmp log = xxx.log inctype = cumulative
Incremental Import:
$ Imp usr / pwd FULL = y inctype = system / restore / inct ype
Of which:
SYSTEM:
RESTORE:
3.
1.
2.
Example:
$
$
"Datafile = (c: tempapp_data, c: tempapp_index)"
4.
Table space transmission is
1. With regard to transfer the table space in a number of rules
?
?
?
?
?
?
?
(The same byte order the file cross-platform data files can replace the header of the method)
(10g
2.
SQL> exec sys.dbms_tts.transport_set_check ( 'tablespace_name', true); SQL> select * from sys.transport_set_violations;
If no row selection, indicating that the table space contains only the table data, and is a self-contained. For some non-self-packets
Containing the table space, such as data table space and index table spaces, and you can transfer.
3.
If you want to refer in detail to use, you can also refer to ORACLE online help.
1. Set tablespace read-only (assuming the table space name is APP_Data
SQL> alter tablespace app_data read only; SQL> alter tablespace app_index read only;
2. To issue EXP command
SQL> host exp userid = "" "sys / password as sysdba" "" transport_tablespace = y tablespaces = (app_data, app_index)
Note that the above
In order to execute SQL * EXP, USERID must be three quotes, in UNIX, must also be taken to avoid "/" Use of
In 816 and beyond must use sysdba in order to operate
* This command in the SQL must be placed in the line (in this case because the display problem on two lines)
3. Copy. Dbf data files (and. Dmp files) to another location, that is the target database
Can be cp (unix) or cop y (windows) or by ftp to transfer files (must be in the bin method)
4. To the local tablespace set to read and write
$ Alter tablespace app_data read write;
$ Alter tablespace app_index read write;
5. In the target database, attach the data file
(Table space can not exist, we must establish the appropriate user name or use fromuser / touser)
$ Imp file = expdat.dmp userid = "" "sys / password as sysdba" "" transport_tablespace = y
6. Set target database table space for reading and writing
$ Alter tablespace app_data read write;
$ Alter tablespace app_index read write;
1.3
Increase large_pool_size, can improve the speed of exp using direct path method (direct = y), the data did not require the integration of memory and checks. To set a larger buffer, if the exporting large objects, small buffer will fail.
export file is not used on the drive ORACLE not export to the NFS file system
UNIX Environment: pipe model directly into lead out to improve imp / exp performance
2.
The establishment of a indexfile, after the completion of the data import indexing
The import file on a different drive to increase DB_BLOCK_BUFFERS
Increase LOG_BUFFER
Archiving run a non-ORACLE: ALTER DATABASE NOARCHIVELOG; the establishment of a large table space and rollback segments, OFFLINE other rollback segments, rollback segment size of the largest table 1 / 2 to use
Use ANALYZE = N
Single-user mode to import
UNIX Environment: pipe model directly into lead out to improve imp / exp performance
3.
Through pipelines to export data:
1. Through establishment of pipe mknod-p
$ Mknod / home / exppipe p
2. By exp, and gzip export data to build the pipeline and compression
$ Exp test / test file = / home / exppipe & gzip </ home / exppipe> exp.dmp.gz
$ Exp test / test tables = bitmap file = / home / newsys / test.pipe &
gzip </ home / newsys / test.pipe> bitmap.dmp.gz
3. Export to delete the establishment of the successful completion of the pipeline
$ Rm
Export script:
# # # UNIX pipes under the ORACLE database, back up through the PIPE
###### Using "export" and "tar" command to bakup oracle datebase #######
trap "" 1 # nohup
LOGFILE = / opt / bakup / log / bakup_ora.log
export LOGFILE
DUMPDIR = / archlog_node1
export DUMPDIR
exec> $ LOGFILE 2> & 1
echo
echo 'Begin at' `date`
echo
# clear old result file
cd $ DUMPDIR
if [-f exp.dmp.Z]
then
echo "clear old result file"
rm exp.dmp.Z
fi
# make pipe
mkfifo exp.pipe
chmod a + rw exp.pipe
# gain the dmp.Z file
compress <exp.pipe> exp.dmp.Z &
su-u oracle-c "exp userid = ll / ll file = $ DUMPDIR / exp.pipe full = y buffer = 20000000"
echo
echo '
echo
# Rm pipe
rm exp.pipe
#
mt-f / dev/rmt/0 rew
tar cvf / dev/rmt/0 exp.dmp.Z
echo
echo '
echo
Through pipelines to import generated file:
1. Through establishment of pipe mknod-p
$ Mknod / home / exppipe p
2. To import the generated compressed file
$ Imp test / test file = / home / exppipe fromuser = test touser = macro &
gunzip <exp.dmp.gz> / home / exppipe
3. Remove the pipe
$ Rm-fr / home / exppipe
4.
Note: In the export, you need through toad or any other tool to extract a source database to create the primary key and indexes in the script
1.
$ Imp system / manager file = exp.dmp log = imp.log full = y rows = n indexes = n
2.
spool drop_pk_u.sql
select 'alter table' | | table_name | | 'drop constraint' | | constraint_name ||';'
from user_constraints
where constraint_type in ( 'P', 'U');
/
spool off
spool disable_trigger.sql
select 'alter trigger' | | trigger_name | | 'disable;'
from user_triggers;
/
spool off
@ drop_pk_u.sql
@ disable_trigger.sql
3.
$ Imp system / manager file = exp.dmp log = imp.log full = y ignore = y
4.
And indexes. To trigger the entry into force.
1.3
Increase large_pool_size, can improve the speed of exp using direct path method (direct = y), the data did not require the integration of memory and checks. To set a larger buffer, if the exporting large objects, small buffer will fail.
export file is not used on the drive ORACLE not export to the NFS file system
UNIX Environment: pipe model directly into lead out to improve imp / exp performance
2.
The establishment of a indexfile, after the completion of the data import indexing
The import file on a different drive to increase DB_BLOCK_BUFFERS
Increase LOG_BUFFER
Archiving run a non-ORACLE: ALTER DATABASE NOARCHIVELOG; the establishment of a large table space and rollback segments, OFFLINE other rollback segments, rollback segment size of the largest table 1 / 2 to use
Use ANALYZE = N
Single-user mode to import
UNIX Environment: pipe model directly into lead out to improve imp / exp performance
3.
Through pipelines to export data:
1. Through establishment of pipe mknod-p
$ Mknod / home / exppipe p
2. By exp, and gzip export data to build the pipeline and compression
$ Exp test / test file = / home / exppipe & gzip </ home / exppipe> exp.dmp.gz
$ Exp test / test tables = bitmap file = / home / newsys / test.pipe &
gzip </ home / newsys / test.pipe> bitmap.dmp.gz
3. Export to delete the establishment of the successful completion of the pipeline
$ Rm
Export script:
# # # UNIX pipes under the ORACLE database, back up through the PIPE
###### Using "export" and "tar" command to bakup oracle datebase #######
trap "" 1 # nohup
LOGFILE = / opt / bakup / log / bakup_ora.log
