当前位置:网站首页>Oracle database backup and recovery
Oracle database backup and recovery
2022-07-07 23:21:00 【Mr. Li, a genius】
It is not the last blow that breaks the stone , It's the one in front 99 One hit
Articles are constantly updated , You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .

List of articles
Data is a very important asset , However, there are certain security risks in the daily operation of any database , Especially like banks 、 Securities and other financial units , During daily operation , To prevent system failure 、 Data loss caused by virus or improper user operation , There must be a good preparatory plan , To recover the data . Database backup and recovery is a very effective means to prevent disasters , Database backup and recovery is an important management responsibility of database administrators , The success of database backup is crucial to data recovery .
One 、 Backup and recovery overview
In order to ensure the backup and high availability of the computer system , Many high-performance servers often adopt a variety of backup strategies , for example RAID technology 、 hot standby 、 Cluster technology, etc , These backup strategies are considered from the perspective of hardware , These strategies can partially solve the problem of database backup . If the disk media is damaged , You can quickly do simple recovery on the image . However , This kind of hardware backup cannot meet the needs of reality , For example, the data table is deleted by mistake .
Database backup and recovery are opposite operations . Backup is to save a copy of the data in the database , In fact, it is to copy the database to the dump device ( Disk or tape ) The process of ; Recovery refers to when various faults occur ( Hardware failure 、 Software failure 、 Network failure 、 System failure, etc ) Cause database paralysis or errors , Use backup to restore the database to the state at the time of failure , Rebuild the complete database . Database recovery can be divided into database repair and database recovery based on database repair .
1、 The type of backup
According to different data backup methods , Backup can be divided into physical backup and logical backup . Physical backup is the data file that will form the database 、 Redo log file 、 Control documents 、 Copy system files such as initialization parameter files , Save the formed copy to a disk or tape independent of the current system . Logical backup refers to the use of oracle The provided export tool extracts the data from the database , Stored in a binary file .
2、 Type of recovery
Depending on the backup used during database recovery , Recovery can be divided into physical recovery and logical recovery . Physical recovery refers to the use of physical backup to recover the database , That is, use physical backup files to restore damaged files , At the operating system level . And logical recovery is to use binary files of logical backup , Use oracle The import tool provided imports some or all of the information into the database , Recover lost data . According to the degree of database recovery, it can be divided into full recovery and incomplete recovery . After the database fails , If backup can be used to restore the database to the state of failure , Called full recovery , Otherwise, it is called incomplete recovery .
Two 、 Data export and import
When exporting, the selected objects in the database or logical copies of the data dictionary are stored in the operating system in the form of binary files ,dmp File format storage ; When you recover , from dmp Restore the format file to the database .
1、 Data export
oracle11g Database usage exp Tools realize logical backup of data , The tool has 3 Ways of working .
Command line mode : Specify parameter settings directly on the command line .
Parameter file mode : Store the parameter setting information in a parameter file , Use... On the command line parfile Parameter specifies the parameter file .
Interactive mode : Manage export jobs through interactive commands .
Exp The tool provides 4 Export mode .
Full library export mode : Export the entire database .
Mode export mode : Export all objects in the specified mode .
Table export mode : Export all tables specified in the specified schema 、 Partitions and their dependent objects and data .
Tablespace export mode : Export all tables and their dependent objects in the specified tablespace .
this 4 These modes are mainly set by selecting parameters .
The following mainly introduces the command line mode and interaction mode .
Command line mode :
export scott Under the user emp Table and dept surface , The name of the storage file is output.dmp, The log file is output.log
First, enter the directory where the specified files are stored , Suppose the directory name is C Discoid backup, Then execute the corresponding command .
cd backup
exp scott/tiger dumpfile=output.dmp logfile=output.log tables=scott.emp,scott.dept
export scott All objects under the user
cd backup
exp scott/tiger dumpfile=user.dmp
Interactive mode
First, you need to prepare a directory for data backup , Suppose now D:\backup Directory as backup path .
Need to enter into backup Directory ( Operate as a command line ).
cd backup;
Input exp Instructions , Derived data , Enter the user name and password ( for example scott/tiger);
2、 Data import
oracle11g Database usage imp The tool realizes the import of backup data , This tool and the export tool exp There are also 3 Working in : Command line mode 、 Interaction mode and parameter file mode .
Command line mode :
scott Under the user emp and dept Table data missing , Use the backup file exported above to restore .
First, enter the directory where the specified files are stored , Suppose the directory name is C Discoid backup, Then execute the corresponding command .
cd backup
imp scott/tiger dumpfile=output.dmp tables=scott.emp,scott.dept;
hypothesis scott The object under the user is missing , Restore with the previously backed up files scott All objects under the user .
cd backup
imp scott/tiger dumpfile=user.dmp
3、 ... and 、 Cold backup and recovery of database
The cold backup of database is strictly called archive backup , It means that the database needs to shut down the service , All transactions need to be committed . Practically speaking , If you want to back up, you need to back up the following .
Control documents : Control the whole oracle Example information of , have access to v c o n t r o l f i l e Count According to the word Dian look for To . heavy do Japan Records writing Pieces of : through too v controlfile Data dictionary found . Redo log file : adopt v controlfile Count According to the word Dian look for To . heavy do Japan Records writing Pieces of : through too vlogfile Data dictionary found
Data files : adopt v d a t a f i l e Count According to the word Dian look for To . nucleus heart with Set up writing Pieces of ( p f i l e ) : send use “ s h o w p a r a m e t e r p f i l e ” look for To . cold To prepare Share fuck do Count According to the library Of To prepare Share fuck do from tube The reason is member Into the That's ok , because this The first First With tube The reason is member body Share deng record . 1 、 send use s y s deng record c o n n s y s / c h a n g e o n i n s t a l l a s s y s d b a ; 2 、 check look for control system writing Pieces of Of Letter Rest s e l e c t ∗ f r o m v datafile Data dictionary found . Core profile (pfile): Use “show parameter pfile” find . Cold backup operation The backup operation of the database is carried out by the administrator , So first log in as an administrator . 1、 Use sys Sign in conn sys/change_on_install as sysdba; 2、 Find information about the control file select * from v datafile Count According to the word Dian look for To . nucleus heart with Set up writing Pieces of (pfile): send use “showparameterpfile” look for To . cold To prepare Share fuck do Count According to the library Of To prepare Share fuck do from tube The reason is member Into the That's ok , because this The first First With tube The reason is member body Share deng record .1、 send use sys deng record connsys/changeoninstallassysdba;2、 check look for control system writing Pieces of Of Letter Rest select∗fromvcontrolfile;
3、 Find redo log file information .
select * from v l o g f i l e ; 4 、 look for To the Yes Count According to the writing Pieces of Letter Rest s e l e c t ∗ f r o m v logfile; 4、 Find all data file information select * from v logfile;4、 look for To the Yes Count According to the writing Pieces of Letter Rest select∗fromvdatafile;
5、 find PFILE file
show parameter pfile;
6、 Keep a record 2、3、4、5 The file path displayed after the command is executed .
7、 close oracle service .
shutdown immediate
8、 Copy out all backup files .
9、 Restart the service ;
startup
This backup is a backup that allows you to shut down your computer .
Cold recovery
When there is an error in the database system , Cold backup files can be used for recovery .
Steps are as follows
1、 close oracle service .
shutdown immediate
2、 Copy all backup files copied during backup to the original directory .
3、 Restart the service .
startup
Four 、 summary
The relevant contents here have not been sorted out yet , The article continues to be updated later , Recommended collection .
The commands involved in the article must be typed several times each like me , Only in the process of knocking can you find out whether you really master the command .
You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .
边栏推荐
- JMeter-接口自动化测试读取用例,执行并结果回写
- Unity3D学习笔记4——创建Mesh高级接口
- Puce à tension stabilisée LDO - schéma de bloc interne et paramètres de sélection du modèle
- GEE(四):计算两个变量(影像)之间的相关性并绘制散点图
- Inftnews | the wide application of NFT technology and its existing problems
- Vulnerability recurrence ----- 49. Apache airflow authentication bypass (cve-2020-17526)
- 漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)
- ROS2专题(03):ROS1和ROS2的区别【01】
- Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
- USB(十四)2022-04-12
猜你喜欢

Wechat forum exchange applet system graduation design (3) background function

LDO voltage stabilizing chip - internal block diagram and selection parameters

ROS2专题(03):ROS1和ROS2的区别【02】

Wechat forum exchange applet system graduation design completion (7) Interim inspection report
![Ros2 topic (03): the difference between ros1 and ros2 [01]](/img/20/39d47c93400050a7bc8ad7efea51b3.png)
Ros2 topic (03): the difference between ros1 and ros2 [01]

成年人只有一份主业是要付出代价的,被人事劝退后,我哭了一整晚

Oracle-数据库的备份与恢复

三问TDM

When copying something from the USB flash disk, an error volume error is reported. Please run CHKDSK

Talk about the design and implementation logic of payment process
随机推荐
js 获取对象的key和value
USB (十七)2022-04-15
智慧社区和智慧城市之间有什么异同
CAIP2021 初赛VP
Matlab-SEIR传染病模型预测
About idea cannot find or load the main class
USB (十八)2022-04-17
Network security - information query of operating system
Adrnoid开发系列(二十五):使用AlertDialog创建各种类型的对话框
Unity3D学习笔记4——创建Mesh高级接口
位运算(Bit Operation)
RE1 attack and defense world reverse
Exploratory data analysis of heartbeat signal
Puce à tension stabilisée LDO - schéma de bloc interne et paramètres de sélection du modèle
网络安全-安装CentOS
The 19th Zhejiang Provincial Collegiate Programming Contest 2022浙江省赛 F.EasyFix 主席树
648. 单词替换
微信论坛交流小程序系统毕业设计毕设(7)中期检查报告
php 使用阿里云存储
Adrnoid Development Series (XXV): create various types of dialog boxes using alertdialog