【rman,1】经典的增量备份案例
一.备份策略: 1.星期天晚上 -level 0 backup performed(全备份) 2.星期一晚上 -level 2 backup performed 3.星期二晚上 -level 2 backup performed 4.星期三晚上 -level 1 backup performed 5.星期四晚上 -level 2 backup performed 6.星期五晚上 -level 2 b
一.备份策略:
1.星期天晚上 -level 0 backup performed(全备份) 2.星期一晚上 -level 2 backup performed 3.星期二晚上 -level 2 backup performed 4.星期三晚上 -level 1 backup performed 5.星期四晚上 -level 2 backup performed 6.星期五晚上 -level 2 backup performed 7.星期六晚上 -level 2 backup performed 如果星期二需要恢复的话,只需要1+2, 如果星期四需要恢复的话,只需要1+4, 如果星期五需要恢复的话,只需要1+4+5, 如果星期六需要恢复的话,只需要1+4+5+6. 自动备份:备份脚本+crontab bakl0 bakl1 bakl2
二.执行的脚本:
1.执行脚本:
rman target / msglog=bakl0.log cmdfile=bakl0 (/表示需要连接的目标数据库,msglog表示日志文件,cmdfile表示的是脚本文件) rman target / msglog=bakl1.log cmdfile=bakl1 rman target / msglog=bakl2.log cmdfile=bakl2 实例:rman target system/oracle@ora10g(/) msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/bakl0
完整的命令:/u01/oracle/product/10.2.0/bin/rman target system/oracle@ora10g(/) msglog=/u01/rmanbak/bakl1.log cmdfile=/u01/rmanbak/bakl0
2.编写rman备份脚本: 0级备份脚本:
把备份脚本放到/u01/rmanbak/script目录下面,vi bakl0,bakl0的内容为: run{ allocate channel cha1 type disk; backup incremental level 0 format '/home/oracle/rmanbackup/inc0_%u_%T'(u表示唯一的ID,大T是日期,小t是时间) tag monday_inc0 //标签可以顺便起,没关系 database plus archivelog delete input; release channel cha1; } 1级备份脚本: run{ allocate channel cha1 type disk; backup incremental level 1 format '/home/oracle/rmanbackup/inc1_%u_%T'(u表示唯一的ID,大T是日期,小t是时间) tag monday_inc1 //标签可以顺便起,没关系 database plus archivelog delete input; release channel cha1; }
2级备份脚本: run{ allocate channel cha1 type disk; backup incremental level 2 format '/home/oracle/rmanbackup/inc2_%u_%T'(u表示唯一的ID,大T是日期,小t是时间) tag monday_inc2 //标签可以顺便起,没关系 database plus archivelog delete input; release channel cha1; }
3.编写调用rman脚本的shell脚本:
调用0备份的shell脚本 rmanbak0.sh为: #!/bin/bash source /home/oracle/.bash_profile /u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl0 msglog=/home/oracle/bakl0.log
调用1备份的shell脚本 rmanbak0.sh为: #!/bin/bash source /home/oracle/.bash_profile /u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl1 msglog=/home/oracle/bakl0.log 调用2备份的shell脚本 rmanbak0.sh为: #!/bin/bash source /home/oracle/.bash_profile /u01/app/oracle/11.2.0/db_home_1/bin/rman target / nocatalog cmdfile=/home/oracle/script/bakl2 msglog=/home/oracle/bakl0.log
4.编写Linux定时任务执行自动备份
[root@gc2 ~]#crontab -e -u oracle(该命令的意思是编辑oracle用户的定时执行(-e,edit -u oracle,oracle用户)) 分 时 日 月 星期(0代表星期天) 45 23 * * 0 /home/oracle/script/rmanbak0.sh(星期天的23:45会以oracle用户的身份来执行命令) 45 23 * * 1 /home/oracle/script/rmanbak2.sh 45 23 * * 2 /home/oracle/script/rmanbak2.sh 45 23 * * 3 /home/oracle/script/rmanbak1.sh 45 23 * * 4 /home/oracle/script/rmanbak2.sh 45 23 * * 5 /home/oracle/script/rmanbak2.sh45 23 * * 6 /home/oracle/script/rmanbak2.sh
或者(用于测试): 使用oracle用户添加例行任务: crontab -e 新打开的窗口中添加一下内容: 0 24 * * * /home/oracle/bin/rmanbak0.sh (*/3 * * * * /home/oracle/bin/rmanbak0.sh) 注,括号内的可以是做测试的时候用的,每三分钟执行一次备份,例为每天凌晨24点执行备份
#然后启动crontab ,启动crontab的命令: [root@gc2 ~]# service crond restart Stopping crond: [ OK ] Starting crond: [ OK ] #监控定时任务是否执行 [root@gc2 ~]# tail -f /var/log/cron
Mar 10 21:28:04 gc2 crond[4435]: (CRON) STARTUP (V5.0) Mar 10 21:30:01 gc2 crond[4445]: (root) CMD (/usr/lib/sa/sa1 1 1) Mar 10 21:39:08 gc2 crond[4486]: (CRON) STARTUP (V5.0)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to backup Google Chrome extension? For most Google Chrome users, more or less plug-ins are installed during daily use. The existence of plug-ins can improve our usage experience. When we reinstall the system or browser, these plug-ins cannot be retained, and it is troublesome to download and install them again. So is there a way to back up the currently installed plug-ins? Here’s how to do it. The tutorial method of backing up chrome plug-ins first opens Google Chrome, click the menu in the upper right corner, and select More Tools - Extensions. Click Package extension above the extensions page. In C:UsersAdministratorAppDataLocalGoogleChromeUserDataDe

If you wish to hide the "Start Backup" option in Windows 11's File Explorer, here's what you can do. There are several ways to disable or hide the startup backup option in File Explorer, and we'll briefly list some methods to help you accomplish this task quickly. Before you get started, you need to understand that this option is closely tied to OneDrive. Once you open a library folder (such as Document, Pictures, Music, etc.), it will immediately appear in the file explorer's path. How to delete startup backup in Windows 11’s File Explorer To delete startup backup in Windows 11’s File Explorer, follow the steps below

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

Title: How to restore the hosts file after deletion Summary: The hosts file is a very important file in the operating system and is used to map domain names to IP addresses. If you accidentally delete the hosts file, you may be unable to access certain websites or have other network problems. This article will introduce how to recover accidentally deleted hosts file in Windows and Mac operating systems. Text: 1. Restore hosts file in Windows operating system. Hosts file in Windows operating system

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

Recently, many friends have asked the editor how to back up the system with ghost. Next, let us learn the tutorial on how to back up the system with ghost. I hope it can help everyone. 1. After running Ghost, click "OK", as shown in the figure. 2. Click "Local" → "Partition" → "ToImage" (meaning: local → partition → to image file), as shown in the figure. 3. The Select Local Hard Disk window appears, click the hard disk where the partition to be backed up is located, and then click "OK", as shown in the figure. 4. The Select Source Partition window appears (the source partition is the partition you want to back up), click on the partition where the system is located (usually Zone 1, be sure to get it right), and then click "OK", as shown in the figure. 5. Play at this time

Key points of price strategy and promotion design in PHP flash sale system In a flash sale system, price strategy and promotion design are very important parts. Reasonable price strategies and well-designed promotions can attract users to participate in flash sale activities and improve the user experience and profitability of the system. The following will introduce the key points of price strategy and promotional activity design in the PHP flash sale system in detail, and provide specific code examples. 1. Key points in price strategy design: Determine the benchmark price: In the flash sale system, the benchmark price refers to the price of the product when it is normally sold. exist

GitLab is an open source code hosting platform that provides rich features, including code base backup and recovery. Code base backup is one of the important steps to ensure the security of the code and it can help us recover the data when unexpected things happen. This article will introduce GitLab's code base backup and recovery functions, and provide corresponding implementation steps and code examples. GitLab's code base backup function GitLab provides two types of backup: incremental backup and full backup. Incremental backup: Incremental backup means backing up only the latest changed data
