Export the whole library with exp, which must be exported with the system or DBA user.
The specific script is implemented as follows
Full-Library Export (fullbackup):
#!/bin/Bashbname=`Date+%y%m%d ' CD/backup/Fullbackupsu-Oracle-c"/oracle/product/11.2.0/bin/exp System/manager file=/backup/fullbackup/db$bname.dmp log=/backup/fullbackup/log /log$bname.log Inctype=complete full=y"Tar-zcvf/backup/fullbackup/db$bname.dmp.Tar. gz/backup/fullbackup/db$bname.dmpRM-rf/backup/fullbackup/db$bname.dmpFind/backup/fullbackup/-name"*.*"-mtime + the|Xargs RM-RFFind/backup/fullbackup/log/-name"*.*"-mtime + the|Xargs RM-rf
Incremental Export (Increatbackup):
#!/bin/Bashbname=`Date+%y%m%d ' CD/backup/Fullbackupsu-Oracle-c"/oracle/product/11.2.0/bin/expSystem/managerfile=/backup/increatbackup/db$bname.dmp log=/backup/increatbackup/log/log$bname.log inctype=incremental FULL= Y"
Tar-zcvf/backup/increatbackup/db$bname.dmp.Tar. gz/backup/increatbackup/db$bname.dmpRM-rf/backup/increatbackup/db$bname.dmp
Find/backup/increatbackup/-name"*.*"-mtime + the|Xargs RM-RF
Find/backup/increatbackup/log/-name"*.*"-mtime + the|Xargs RM-rf
Cumulative Export ():
#!/bin/Bashbname=`Date+%y%m%d ' CD/backup/Fullbackupsu-Oracle-c"/oracle/product/11.2.0/bin/expSystem/managerfile=/backup/cumulativebackup/db$bname.dmp Log=/backup/cumulativebackup/log/log$bname.log inctype= Incremental Full=y"
Tar-zcvf/backup/cumulativebackup/db$bname.dmp.Tar. gz/backup/cumulativebackup/db$bname.dmpRM-rf/backup/cumulativebackup/db$bname.dmp
Find/backup/cumulativebackup/-name"*.*"-mtime + the|Xargs RM-RF
Find/backup/cumulativebackup/log/-name"*.*"-mtime + the|Xargs RM-rf
Then add the scheduled task to the crontab:
, 5 * * * /backup/scripts/cumulativebackup. SH5 * * * /backup/scripts/increatbackup. SH5 * * * /backup/scripts/fullbackup. SH
Oracle Incremental Export/import
First, export/import (Export/import)
----Use export to extract data from the database and import the extracted data back to the Oracle database.
----1. Simple Export data (exports) and imported data (import)
----Oracle supports three types of output:
----(1) Table mode (t) to export the data for the specified table.
----(2) User mode (U-mode) to export all objects and data of the specified user.
----(3) Whole-Library mode (full mode) to export all objects in the database.
The process of----data export (import) is the inverse process of data import (export), and their data flow is different.
----2. Incremental Export/Import
----Incremental export is a common method of data backup that can only be implemented for the entire database and must be exported as system. When such an export is made, the system does not require any questions to be answered. The exported file name defaults to Export.dmp, and if you do not want your output file to be named Export.dmp, you must indicate the name of the file you want to use on the command line.
----Incremental export consists of three types:
----(1) "Full" incremental export (complete)
----is to back up the entire database, such as:
----$exp System/manager inctype=complete file=990702.dmp
----(2) "Incremental" incremental export
----Back up the data that was changed since the last backup. Like what:
----$exp System/manager inctype=incremental file=990702.dmp
----(3) "Cumulative" incremental export (cumulative)
----Cumulative export is simply exporting information that has changed in the database since the last "full" export. Like what:
----$exp System/manager inctype=cumulative file=990702.dmp
----Database administrator can schedule a backup schedule that is reasonably and efficiently done in three different ways of exporting data.
----such as database backup tasks can be arranged as follows:
----Monday: Full export (A)
----Tuesday: Incremental export (B)
----Wednesday: Incremental export (C)
----Thursday: Incremental export (D)
----Friday: Cumulative export (E)
----Saturday: Incremental export (F)
----Sunday: Incremental export (G)
----If the database was accidentally damaged in Sunday, the database administrator can recover the database by following these steps:
----The first step: Create database with the command to regenerate the data structure;
----The second step: Create an additional back segment that is large enough.
----Step Three: Fully incremental import a:
----$imp System./manager inctype= rectore full=y file=a
----Fourth Step: Cumulative incremental Import E:
----$imp System/manager inctype= rectore full=y FILE =e
----Fifth Step: Recent incremental import F:
----$imp System/manager inctype=restore full=y file=f
----second, cold backup
----Cold backup occurs when the database has been shut down properly and provides us with a complete database when it shuts down normally. Cold backup is a statement that copies critical files to another location. Cold backup is the fastest and safest way to back up Oracle information. The advantages of cold backup are:
----1. is a very fast backup method (just copy files)
----2. Easy to archive (simple copy)
----3. Easy to recover to a point in time (just copy the file back)
----4. Can be combined with the archiving method to restore the database "up-to-date state".
----5. Low maintenance, high safety.
----But cold backup also has the following disadvantages:
----1. When used alone, it can only be provided to "a point in time" recovery.
----2. In the whole process of implementing the backup, the database must be backed up and not be able to do other work. In other words, during a cold backup, the database must be off state.
----3. If disk space is limited, it can only be copied to other external storage devices such as tapes, which can be very slow.
----4. cannot be recovered by table or by user.
----if possible (mostly efficiency), you should back up the information to disk, then start the database (making the user work) and copy the information you backed up to tape (the database works as well). Files that must be copied in a cold backup include:
----1. All data files
----2. All control files
----3. All online redo log files
----4. Init.ora file (optional).
----It is important to note that a cold backup must be done in the case of a database shutdown, and that performing a database file system backup is not valid when the database is in an open state
----The following is a complete example of a cold backup:
----(1) Close the database $sqldba lmode=y
----SQLDBA > Connect internal;
----SQLDBA > Shutdown normal;
----(2) use copy command to back up all time files, redo log files, control files, initialize parameter files
----SQLDBA >! CP < file > < backup directory >
----(3) Restart Oracle database
----$SQLDBA Lmode=y
----SQLDBA > Connect internal;
----SQLDBA > startup;
----Three, hot backup
----Hot backup is the way to back up data using Archivelog mode when the database is running. So if you have a cold backup of last night and you have today's hot backup files, you can use this data to recover more information in the event of a problem. Hot backup requires the database to operate in Archivelog mode and requires a large amount of file space. Once the database is running in the Archivelog state, it can be backed up. The command file for a hot backup consists of three parts:
----1. Data files A table space is backed up in a tablespace.
----(1) Set table space as backup state
----(2) Backing up tablespace data files
----(3) Restore table space to normal state
----2. Back up the archive log file.
----(1) Temporarily stop the archive process
----(2) Log those files in the archive redo log target directory
----(3) Restarting the archive process
----(4) backing up an archived redo log file
----3. Use the ALTER DATABASE backup Controlfile command to back up the copy file
The advantages of----hot backup are:
----1. Backup at table space or data file level with short backup times.
----2. The database can still be used when backing up.
----3. Can reach a second level of recovery (to a point in time).
----4. Recovery is possible for almost all database entities.
----5. Recovery is fast and in most cases resumes when the database is still working.
The disadvantages of----hot backup are:
----1. No mistakes, otherwise serious consequences.
----2. If the hot backup is unsuccessful, the resulting results are not available for point-in-time recovery.
----3. It is difficult to maintain, so be careful not to allow "failure to end".
Oracle Backup Scripts