The Oracle tutorial you are looking at is about backup of Oracle databases. One, meaning:
When we use a database, we always want the contents of the database to be reliable and correct, but due to computer system failure (hardware failure, network failure, process
Fault and system fault) affect the operation of database system, affect the correctness of the data in the database, and even destroy the database, so that all or part of the data in the database is lost
Lost. Therefore, when the above fault occurs, we hope to re-establish a complete database, which is called database recovery. Recovery subsystem is a database management system
An important part of it. Recovery processing varies with the structure that is affected by the type of failure that occurs.
Second, the method of backup
There are three standard backups of Oracle databases. Export/import (Export/import), cold backup, hot backup.
Exporting a backup is a logical backup, which involves reading a series of database logs and writing to the file, where the read is independent of the location of the log.
Cold and hot backups are physical backups (also called low-level backups) that involve the files that make up the database, but do not consider logical content.
Here are a few of the three backup methods and their features:
(i), export/import (Export/import)
Export/import is used to move data out/move into the database in Oracle.
1. Export database data back into a binary system file called Export dump file, and the database will be rebuilt to write
into the file.
It has three different modes:
A. User mode: Export all user objects and data in the object;
B. Table mode: Export all the user tables or specified tables;
C. Entire database: Export all objects in the database.
It has three types of backups:
A. Complete type (COMPLETE EXPORT): Back up the entire database;
B. Accumulation type (comulative erport): Back up the data that was changed by the last cumulative backup;
C. Incremental (Increamental EXPORT): Backs up data that has changed since the last backup.
EXPORT commands can be interactive, the specific meaning of each parameter see appendix.
One thing to consider when exporting a backup is the consistency of the export, which, when exported, reads a table every time it is read, so that although the export
It starts at one feature, but different tables read differently, so when the export begins to read a table, the data in the table is the number of exports.
As a result, when most tables are interconnected by internal keywords and external keywords, changes in these associated tables during the export process can lead to inconsistent export
, to avoid this, we can schedule the export process to take place when the table is not being manipulated. In addition, when Oracle restrictep consistent option
You can guarantee that data consistency is exported.
2, Import imports:
The process of importing is an inverse process of exporting, which reads the exported dump binaries and runs the files to recover the object users and data. The
Import command executes a method related to the export scheme.
1, if export is implemented a complete scheme (full) in the import of all data objects, including table space, data files, users will be created in the import
, but given the physical layout of the database, it is useful to create a table space and users in advance.
2, if export is using the Incremental/cumulative method, you need to set up the table space, users, data files beforehand.
(b): Cold backup
Cold backup occurs when the database has been shut down properly and provides us with a complete database when it shuts down. Each file used by the
database is backed up, including:
☆ All data Files
☆ All control files
☆ All online redo LOG files
☆init.ora files (optional)
It is noteworthy that the cold backup must be done in the case of database shutdown, when the database is open, the execution of the database file system backup is invalid.
for cold backup The general steps are:
1: Normal shutdown of the instance to be backed up (instance);
2: Back up the entire database to a directory
3: Start the database
1:sqldba>connect internal
Sqldba>shutdown normal
2:sqldba>! CP
or
Sqldba>!tar cvf/dev/rmt/0/wwwdg/oracle
3:sqldba>startup
The
(iii) Hot Backup (achirelog)
Database takes 24 hours to run and new data is added at any time. Data loss will affect the entire company. Use Archivelog mode physical backup.
? Set the database to Automatic archivelog mode,
#su-oracle
%SVRMGRL
Svrmgrl>connect Internal
Svrmgrl>startup Mount
Svrmgrl>alter Database archivelog
Svrmgrl>shutdown
svrmgrl>exit
%vi Initoracle7.ora
Join Log_archive_start = true # If you want automatic archiving
Log_archive_dest = $ORACLE _home/dbs/arch
Log_ Archive_format = Log%s.arc
%dbstart
%ps-ef|grep Arch
Oracle 1743 1 0 15:20:20? 0:00 ora_arch_oracle7
Note: ORAC Le database is in automatic archivelog mode
? full offline entire database backup, which is the basis for future backups when the databases are initially completed. It provides all copies of the database about
.
%dbshut
%cp/oracle/oradata/oracle7/system.dbf
/oracle/oradata/oracle7/rbs.dbf
/oracle/oradata/ ORACLE7/TEMP.DBF
/oracle/oradata/oracle7/tools.dbf
/oracle/oradata/oracle7/users.dbf
/oraclecle/app/ ORACLE/PRODUCT/7.3.2/DBS/APPLICATION.DBF
/ORACLE/APP/ORACLE/PRODUCT/7.3.2/DBS/APPTMPSP.DBF
/oracle/app/ ORACLE/PRODUCT/7.3.2/DBS/APPRLBKSP.DBF
/oracle/oradata/oracle7/redooracle.log
/oracle/oradata/oracle7/ Control1.ctl
/oracle/oradata/oracle7/control2.ctl
/oracle/oradata/oracle7/control3.ctl
%dbstart
Note: The above *.dbf files are data files, *.log files are log files, *.ctl files are control files
%exit
%tar uvf/dev/rmt/0
Note: If Oracle 7.2, copy the corresponding data files,relog files,control files.
6.3. Do one partial online with archiving backups every day.
#su-oracle
%svrmgrl
%svrmgrl>connect Internal
%svrmgrl>alter tablespace BILLSP begin Backup
%svrmgrl>alter tablespace BILLTMPSP begin Backup
%svrmgrl>alter tablespace BILLRLBKSP begin Backup
%svrmgrl>alter tablespace System begin Backup
%svrmgrl>alter tablespace RBS begin backup
%svrmgrl>alter tablespace Temp Begin Backup
%svrmgrl>alter tablespace Tools Begin Backup
%svrmgrl>alter tablespace users begin Backup
%svrmgrl>host CP all datafile to the backup storage. #文件名如第一步中以 the end of DBF.
%svrmgrl>alter tablespace BILLSP End Backup
%svrmgrl>alter tablespace BILLTMPSP End Backup
%svrmgrl>alter tablespace b
[1] [2] [3] Next page
The Oracle tutorial you are looking at is about backup of Oracle databases. Illrlbksp End Backup
%svrmgrl>alter tablespace System End Backup
%svrmgrl>alter tablespace RBS End Backup
%svrmgrl>alter tablespace Temp End Backup
%svrmgrl>alter tablespace Tools End Backup
%svrmgrl>alter tablespace users End Backup
Make an SQL file, as written above.
The billing system can recover to the "point of failure" when the failure occur.
Vii. Recovery of Backup files:
7.1 Recovery files:
The following is a recovery of the "/etc/passwd" file
(, put the correct tape
(, run the following command to restore the "/etc/passwd" file
# rsh www mt-f/dev/rmt/0 rew
(Find the nearest tape and move forward to the nearest "/etc/passwd", such as looking for the Wednesday "/etc/passwd" file, run the following command)
#rsh www mt-f/dev/rmt/0n FSF 2
# Ufsrestore If www:/dev/rmt/0n
Ufsrestore > ls
. :
etc/
Ufsrestore > CDs etc
Ufsrestore > ls
. /ETC:
passwd
Ufsrestore > Add passwd
Warnign:. /etc:file exists
Ufsrestore > Verbose
Verbose mode on
Ufsrestore > Extract
Extract Requested Files
You are have not read any volumes yet.
Unless you know which volume your file (s) are on your should start witch the last volume and work to wards
The i.
Specify next volume #:1
Extract file. /etc/passwd
Add Links
Set directory mode, Ower,and times.
Set Owner/mode for.? (yn) n
Directories already exit, set mode anyway? (yn) y
Ufsrestore >quit
A hot backup can take place when the database is turned on, typically by using the ALTER command to change the state of the table space to begin the backup, after the backup is completed,
To restore its original state, otherwise redo log will be mismatch, causing the next time the database is started on the affected table space for full coverage. The requirements for hot backup are:
1. The hot back-up work must request the database to operate in the Archivelog mode, under the SQLDBA state uses ALTER DATABASE Archivelog|noarchivelog the life
Allows you to change the mode of the backup.
2. Hot backup can only happen if the database is not used or the usage rate is low.
3. Hot backup requires a large amount of file space.
In general, Oracle writes the online redo log file in a circular fashion and writes the second one after filling the first redo log file until the last one, the most
After the last one is filled, the background process LGWR the first, in Archivelog mode, the background process arch in every redo log file is overwritten before, give
It makes a copy, in general, the Redo log files of these documents are written to disk or tape. If you have enough disk space, it is recommended that you use disk, which greatly reduces
The time required to complete the backup less.
Setting the Log_archive_start in the Config.ora file to true before making a hot backup log_archive_dest
Specify the location of the archive redo log file:
Log_archive_dest=/wwwdg/oracle/arch/arch
Log_archive_start=true
Once the database is running in Archivelog state, it can be backed up. The command file for hot backup consists of three parts:
1, data file a table space to backup a space:
A. Set table space to backup state.
B. A data file that backs up the table space.
C. Restore the tablespace to a normal state.
2, Backup archive to make log file:
A. Temporary cessation of the archiving process
B.log the files in the archive redo log target directory
C. Restarting the archive process
D. Backup archived redo log files
3. Use ALTER DATABASE backup Controlfile command to back up copy files
The Log_archive_dest directory may be full before the hot backup runs, and then you need to back up the directory and then delete the files to free up space, and this process has the following steps
Sudden:
1, temporarily stop archive process.
2, recorded in the Log_archive_dest directory of documents.
3, restart the archive process.
4, Backup archive redo log file.
5, delete the files in the directory.
SQLDBA Lmode=y <
Archive log stop;
Exit
EOF Arch1
FILES=LS/WWWDG/ORACLE/ARCH/ARCH*.DBF;
SQLDBA lmode=y<
Connect Internal
Archive log start;
Exit
EOF ARCH2
tar-rvf/dev/rmt/0 FILES
Rm-f $files
A combination of logical backups and physical backups.
The previous three methods of backup, when the database backup, should be the data of the three kinds of backup features flexible use, we first compare the three methods of
Characteristics.
Method
Type
Recovery attribute
Export
Logical
You can restore any database object to its state when it was exported
乻 hutdown
? Copies the nearest Copyes of DataFile to $oracle _home/dbs directory.
?%SVRMGRL
? svrmgrl>connect internal
... svrmgrl>startup Mount Pfile=filename exclusive
? svrmgrl >alter database recover;
Note: Automatically restores data to the point of failure;
? svrmgrl>alter database open;
? When there are too many archive log files, after a partial backup, you can delete the Log***.arc before the current log sequence.
#su-oracle
%SVRMGRL
Svrmgrl>connect internal;
Svrmgrl>archive log list;
#此处标有current log sequence. The assumption is 360.
Svrmgrl>exit
$CD/billdg/oracle/app/oracle/product/7.3.2/dbs/arch
$ rm ... # Will log360.arc before the file such as Log359.arc,log358.arc ..... Delete.
Cold backup
Physical
can put the database to its shutdown state
Hot backup
Physical
To restore the database to any point in time
When the database is relatively hours, processing business is also hours, cold backup export can be. If you are backing up exports to only one or two tables, that's enough. Generally a good, backup most
Final execution includes both logic and physics, and exporting confirms that the database is logically correct while physical backup ensures physics.
In addition, some storage media is required for backup and should be managed for these media
1: According to the contents of the backup, the date will be unified number of media, so as to avoid the backup and recovery of the wrong media, resulting in the original backup lost.
2: The media should be stored in a different location from the computer equipment, in order to avoid accidents in the room, backup and computer equipment damaged together.
Appendix:
Tar command
Tar option [arguments] filename ...
Option
C: Create a new tarfile specified by the command line
T: List the contents of the Tarfile
x: Open tarfile;
F: Use subsequent filename or/dev/rmt/0|1
V: Lists the recovered filename;
P: Recovering files
Example
#tar cvf/dev/rmt/0/oracle
Back up all the content under/root
#tar tvf/dev/rmt/0
List all content on tape
#tar XVF
prev [1] [2] [3] Next page
The Oracle tutorial you are looking at is about backup of Oracle databases. /dev/rmt/0/oracle
Restores the contents of the/oracle directory on the tape to the current directory
The
Export options
keyword content
USERID the username/password of the account that runs the Export command. The size of the buffer that the
Buffeer uses to fetch data rows.
File export dump file name
COMPRESS Export should compress a range of fragmented Cheng, which affects the storage
clause,
grants whether to export authorization on database objects when exporting
INDEXES Whether you want to export the indexes on the table
rows should export rows. If it is ' N ', then only the database
object's DDL
is generated in the export file consstraints whether the table's old contract condition is exported
Full if set to ' Y ', then an entire database export operation
OWNER to export a series of database accounts , and then execute the user export of these accounts to
make
a series of tables to be exported; the length, in bytes, of the table export operation
RecordLength dump of the exported file log that performs these tables, usually using the default, except
To pass the export file in two different operating systems
Inctype the type of export operation being performed (valid values are "COMPLETE" (default),
Cumulative "and" Ivcremental ")
Record A tag in the incremental export type that indicates whether to store the log in the data dictionary
in the Log exported table
Parfile The name of the parameter file to be passed to the export. This file will contain all the parameters in the
Port entry
ANALYZE to indicate whether the statistics of the moved objects are written to the export dump file
Consistent indicate whether to retain read consistent replication for all exported objects.
Log Export Log the name of the file to be written
MLS to indicate whether to export the MLS label
Mls_label_ the MLS label format
Import Selection
USERID the username/password of the account that is running the import command. The size of the buffer that the
Buffeer uses to fetch data rows. The
file import dump file name
shows whether the contents of the file are displayed, not executed. The
Egore indicates whether to ignore errors encountered when executing the ' CREATE ' command. You should use this parameter if you are
when an imported object already exists.
Full is set to ' Y ', then an entire database import operation will be performed
Fromuser in the case of full=n, only arguments are available. It is a series of database accounts whose
objects should be read from the export dump file. The
Touser a series of database accounts, and the objects that export the dump file buckle will import those accounts.
Whether you want to import authorization on a database object when importing grants
INDEXES whether you want to import indexes on the table
rows should import rows. If it is ' N ', then executing the database in the import file to
like DDL
Full is set to ' Y ', then perform an entire database export operation
Tables the series of tables to import
RecordLength dump the length of the import file log ( In bytes, usually by default, except for the type of import operation that is being performed by the
not to be passed in two different operating systems
Inctype (valid values have "COMPLETE" (default),
cumulative "and" Ivcremental ")
Parfile the name of the parameter file to pass to the import. This file will contain all the parameters in the
Port entry
ANALYZE to indicate whether to write statistics for the moved object to the import dump file, the name of the file that the
log import log will write to
MLS to indicate whether to import the MLS label
Hot backup command file:
Oracle_sid=oracle7
Oracle_home=/wwwdg/oracle
SQLDBA lmode=y<
Connect Internal
Alter tablespace SYSTEM begin backup;
!tar-cvf/dev/rmt/0/wwwdg/oracle/dbms/sys01.dbf
Alter tablespace SYSTEM end backup;
Alter tablespace BWT begin backup;
!tar-cvf/dev/rmt/0/wwwdg/oracle/dbms/bwt1.dbf
Alter tablespace BWT end backup;
Archive Log Stop
Exit
EOF Arch1
FILES=LS/WWWDG/ORACLE/ARCH/ARCH*.DBF;
SQLDBA lmode=y<
Connect Internal
Archive log start;
Exit
EOF ARCH2
tar-rvf/dev/rmt/0 $FILES
Rm-f $files
SQLDBA lmode=y<<>
ALTER DATABASE backup Controlfile to
/wwwdg/oracle/dbms/bwtcontrfile.backup;
Exit
EOF Arch3
tar-rvf/dev/rmt/0/wwwdg/oracle/bwt/bwtcontrofile.backup
previous page [1] [2] [3]