Oracle Backup and Recovery
Frank
20040730
Backup and recovery is an important job of database systems. The purpose is to prevent data from being destroyed from the normal operation of the database system. Although backup and recovery can not guarantee 100% loss, but as a means of preventive means, it is necessary to truly master.
1, library and unloading backup
IMP and Exp are two important commands
Express is responsible for quickly copying the data in the database to another place to prevent data loss.
When querying the help of the EXP command: Exp Help = y will detail the parameters meaning of the Exp command.
IMP is an anti-processes of Exp, both in combination to complete the backup work.
Unloading method:
a) Table mode unloading
b) User mode unloading
c) Full storage mode unloading
Instructions:
SQL> $ EXP or C> EXP
"$" Characters indicate that the operating system command is called in the SQLPLUS state.
Two ways: interactive and parameter driver
Interactive:
The database used must be opened before using the unobstructure.
C: /> eXP
Parameter driver
Exp userid = system / manager buffer = 10240 file = Tables.dmp
Compress = yes grants = yes indexes = yes rows = yes
Tables = (Persons, Check_Body, DePts)
......
Direct = yes.
Simplified format:
Exp userid = system / manager file = tables.dmp table = (Persons, Check_Body, DePts)
Use a PARFILE file method:
Users who often do unloading libraries can create a parameter file, put all parameter settings to change files, when calling the exp command, you need to specify this parameter file with the PARFILE parameter.
Example: The following is: my.txt file content
Userid = system / manager
Buffer = 10240
File = Tables.dmp
Log = Tables.log
Tables = (Persons, Check_Body, DePts)
Statistics = compute
C: /> exp parfile = c: /my.txt
Note: Parfile parameters cannot be placed in the parameter file, this is the only parameter that cannot be placed in the parameter file.
User mode Unloading:
All data of one or more users can be poured out, including the view, synonyms, and process functions.
Full storage mode unloading:
Unload the data and files of the entire system and use the whole library. Prerequisites: Users used for the full storage mode unloading must be granted unloading the entire library role (exp_full_database).
SQL> Grant "exp_full_database" to "jxl";
Unloading failed:
Table mode unloading
Users must have pour the object permissions.
2. Global Pattern Unloading
Grant this user DBA role or exp_full_database role
The database used must be opened before using the unobstructure.
SQL> ALTER DATABASE OPEN
Base method:
• Interactive call library program IMP.
• Use the parameter driver, that is, specify some parameters when the library program IMP is called.
• Use the PARFILE to specify a parameter file to call IMP.
1, table mode library
The table mode library corresponds to the unload file generated by all unobstructure mode, as long as the user and the table to be loaded can be specified. 2, user mode library
The user mode library can be loaded into files that are unloaded by user mode and library mode. Note: For files that are unloaded by user mode, it is best to choose a user mode library, which is very useful when recovering all objects of the entire user.
3, the full storage mode library
Due to load a large amount of data and documents, it costs longer, so it is not common. Other ways to pay attention to, not to note that users used for the library of libraries must grant "IMP_FULL_DATABASE" role.
example:
SQL> GRANT "IMP_FULL_DATABASE" to "www";
Base failure processing:
1. Ordinary users require imported files fused by DBA
Workaround: Grant the user DBA authority
2. The user requests to fall out of the unloading files fused by other users: I need to use the original user to go to the library.
Example: Warning: This object is poured out by SWJ, not the current user.
Solution:
Take the user's SWJ library, specify Touser = WWW (HSMAN-purpose user)
IMP userid = swj / swj files = users.dmp fromuser = 'swj' Touser = 'www'