Oracle databases are usually the first choice for large databases and large enterprises for the stability, high availability, cross-platform and massive database processing. Despite this, many small and medium-sized enterprises still want to taste Oracle, so there are also many small and medium databases in the Oracle environment. For cost consideration, it is usually possible to build a Standard Edition and run on Linux. Who is Oracle too expensive? For small and medium-sized enterprises, the best choice is reasonable. For those of us who are engaged in DB, there must be a high price. We can also make a few more fights. Haha... the mentality of a typical migrant worker. To put it bluntly, the cost of small and medium-sized enterprises limits our high availability, and RAC and DG are also relatively less. Recently, we have encountered such a situation that we can simulate a replica uard to protect the database. We know that DataGuard can switch the database from the master database to the slave database in real time, or switch the database from the slave database to the master database to achieve seamless connection, so as to avoid data loss caused by hardware faults. The following describes how to use the rman catalog method to simulate the upload uard to protect data to a greater extent based on the above situation.
Small and Medium databases rman catalog Backup Recovery Solution Series:
- Backup and recovery solution for small and medium databases rman catalog (1)
- Backup and recovery solution for small and medium databases rman catalog (2)
- Backup and recovery solution for small and medium databases rman catalog (III)
1. Feasibility Analysis of simulated tracing uard
A. Can I store the entire structure of the production database on the backup server with the same structure? Yes, hot standby, cold standby, and RMAN backup. Initialize the database with cold backup for the first time.
B. Consider the logical physical Standy of DG, that is, do not consider implementing automatic or manual failover. Only the hardware fault of the Prod machine is considered, and the DB is available on the backup server. Feasible.
C. Can I minimize database losses? DG can regularly send archivelog and apply automatically, so we can also regularly send archivelog, but it is difficult to apply it automatically.
D. Can archivelog be applied to the backup server? Yes. No matter how many tablespaces or data files are added or reduced, there is no problem with data changes.
E. The degree of data loss depends on the remaining archivelog and Prod redo logs that are not transmitted in time. This will cause loss. There is no way to do this. After all, it is not DG.
2. Backup Recovery Plan Planning
The following is the database backup solution plan
System Environment: Linux, Oracle 10g Standard
Database environment: the primary database is on the Prod server, and the backup database is on the Bak server. The database capacity is <= 200 GB.
Backup Frequency: perform a level 0 backup every day, or perform a level 0 backup every two days as needed. Of course, if it is medium or large, we recommend that you use or 2-level Incremental backup.
Backup location: place the backup file on the Prod server and ftp the backup file to the Bak server.
Archive logs: regularly ftp archived logs to the same archive location as the original database on the Bak Server
Restoration frequency: regularly use new backup files to restore on the Bak server every day.
Recovery frequency: no recovery operation is performed, because the recovery operation is incomplete and you need to use resetlogs to open the database, a new incarnation will be generated.
Troubleshooting: if the primary database of the Prod server is damaged, copy the remaining archivelog and redo to Bak (if possible). Then, manually restore the database on the Bak server and open
Recover a directory database: We recommend that you back up a directory database in a variety of scenarios.
3. Create and restore a directory database and its scripts
Due to the large number of Prod Server databases, you can create a recovery directory database. If your environment library is small, you can directly use the control file instead of restoring the directory.
Create a global script for backup and recovery based on the recovery directory database for scheduling of all databases.
For details about how to create a recovery directory database and Restore directory scripts, refer:
Create and use RMAN catalog
Create RMAN storage script based on catalog
Catalog-based RMAN backup and recovery
Bytes -------------------------------------------------------------------------------------------------------
-- All scripts deployed in the recovery directory are listed below.
-- Note: The backup path is not specified and the default flash back area is used.
RMAN> list global script names;
List of Stored Scripts in Recovery Catalog
Global Scripts
Script Name
Description
-----------------------------------------------------------------------
Global_arch
Global_del_obso
Global_inc0
Global_restore
RMAN> print global script global_arch;
Printing stored global script: global_arch
{
Allocate channel category type disk maxpiecesize = 2g;
Allocate channel ch2 type disk maxpiecesize = 2g;
Set limit channel ready readrate = 10240;
Set limit channel limit kbytes = 2048000;
Set limit channel ch2 readrate = 10240;
Set limit channel ch2 kbytes = 2048000;
Crosscheck archivelog all;
Delete noprompt archivelog all;
SQL "alter system archive log current ";
Backup as compressed backupset archivelog all delete input tag = 'archbk ';
Release channel identifier;
Release channel ch2;
}
-- Author: Robinson Cheng
-- Blog: http://www.bkjia.com
RMAN> print global script global_del_obso;
Printing stored global script: global_del_obso
{
Allocate channel specified device type disk;
Delete noprompt obsolete redundancy 1;
Release channel identifier;
}
RMAN> print global script global_inc0;
Printing stored global script: global_inc0
{
Configure retention policy to redundancy 1;
Configure backup optimization on;
Configure controlfile autobackup on;
Allocate channel specified device type disk maxpiecesize = 5g;
Allocate channel ch2 device type disk maxpiecesize = 5g;
Set limit channel ready readrate = 10240;
Set limit channel limit kbytes = 4096000;
Set limit channel ch2 readrate = 10240;
Set limit channel ch2 kbytes = 4096000;
Backup as compressed backupset incremental level 0 database tag = 'inc ';
Release channel identifier;
Release channel ch2;
Execute global script global_arch;
Execute global script global_del_obso;
}
RMAN> print global script global_restore;
Printing stored global script: global_restore
{
Restore controlfile;
SQL 'alter database mount ';
Crosscheck backup;
Delete noprompt expired backup;
Crosscheck copy;
Delete noprompt expired copy;
Allocate channel category type disk;
Allocate channel ch2 type disk;
Restore database;
Release channel identifier;
Release channel ch2;
Shutdown immediate;
}