NFS Chapter for Oracle centralized backup scenarios

Source: Internet
Author: User
Tags sqlplus

1. Programme Overview

NFS, which utilizes Linux operating systems, provides disk space for UNIX, uses the Rman tools of the database to perform a backup of the database, and the backup data is stored in the disk space on the backup server.

Database server: DBSERVER0 ~ N, database backup server 10.1.251.133

2. Build Backup Server

1. Backup server-provided disk space

Ø The backup server provides the disk space for the database backup through the local disk;

Ø Create Ext3 file system on disk space;

Ø file system is provided to UNIX database server through NFS system;

Ø file systems are provided to the Windows Database server through an SMB system.

Ø It is recommended to configure a stable and high-speed disk system with a separate disk subsystem for better.

2, the directory structure of the backup server

For each database server to be backed up, we create the appropriate directory on the backup server

3, the directory structure of each database

4. Create backup management user on backup server

• Create user orabackup and group Orabackup on Server for NFS.

• For example

– User: Orabackup [UID = 501]

– Group: orabackup [GID = 502]

• All directories under/data will be managed by orabackup

# Cd/data

# chown–r Orabackup.orabackup *

5. Configure NFS

Ønfs–network File System

ØNFS allows a host system to share directories and files with other people on the network. By using NFS, users and programs can access files on the remote system as they would access local files;

File sharing access standards supported by Øunix/linux systems;

The solution is to use the NFS system to centralize the backup management of Oracle databases on Unix/linux.

Create/orabackup directory and grant permissions 772

Open/etc/exports file add:/orabacku p10.1.252.152 (rw,sync,all_squash,anonsid=501,anongid=502)

Start/etc/init.d/portmap Restart

Start/etc/init.d/nfs Restart

To see if the launch succeeded: Netstat-ultn

* Portmap-activating port at 111;

* NFS-inspired port at 2049;

* Other rpc.daemons that are active are required to be registered with Port 111.

Client settings

Start/etc/init.d/portmap Restart

Start/etc/init.d/nfs Restart

sudo mount-t NFS 10.1.252.20:/orabackup/home/oracle/orabackup-o rw,bg,rsize=32768,wsize=32768,hard,vers=3,nointr, Timeo=600,proto=tcp

Set NFS to boot, mount

Into the 10.1.252.152 to increase in the/etc/fstab

10.1.252.153:/orabackup/orabackup NFS rw,hard,nointr,tcp,noac,vers=3,timeo=600,rsize=32768,wsize=32768 0 0

3. Create an Rman backup script

Create tablespace rman_tbs datafile '/oradata/luke/rman_tbs01.dbf ' size 1024M;
Create user Rman identified by rman default tablespace rman_tbs temporary tablespace temp;
Grant Connect,resource, Recovery_catalog_owner to Rman;
Rman Catalog Rman/rman
Create catalog tablespace Rman_tbs;
Connect Target SYS/CONGQING@ORCL
Register database;
a schema;
Configure retention policy to redundancy 2;
Configure retention policy to recovery windows of 7 days;


Export Rman User Data script Exp_rman.par (that is, backup catalog library)
Userid=rman/rman
File=/home/oracle/backup/export/rman.dmp
Log=/home/oracle/backup/log/rman.log
Export Rman Data shell script exp_rman.sh
#!/bin/bash
CD $HOME
. . bash_profile
CD $HOME/backup/script
Exp Parfile=exp_rman.par

Level 0 Backup Rman script LEVEL0_BACKUP.RCV
Connect Catalog Rman/rman
Connect Target SYS/CONGQING@ORCL

Run {

CONFIGURE RETENTION POLICY to RECOVERY WINDOW of the days;
CONFIGURE Controlfile autobackup on;
Allocate channel D1 type disk;
Allocate channel D2 type disk;
Backup incremental Level 0 database format '/home/oracle/rman_backup/level0_%d_%s_%p_%u.bak '
Tag= ' Level 0 ' include the current controlfile;
SQL ' alter system archive log current ';
Backup Archivelog all format '/home/oracle/rman_backup/log_%d_%s_%p_%u.bak ' deletes all input;
Release channel D2;
Release channel D1;
}

Crosscheck backup;
Delete noprompt expired backup;
Delete NoPrompt obsolete;
Resync Catalog;

Level0_backup.sh of level 0 backup shell scripts
#!/bin/bash
CD $HOME
. . bash_profile
CD $HOME/backup/script
Rman CMDFILE=LEVEL0_BACKUP.RCV msglog= $HOME/backup/log/level0_backup.log
. /home/oracle/backup/script/exp_rman.sh

First-level differential incremental backup Rman script LEVEL1_BACKUP.RCV
Connect Catalog Rman/rman
Connect Target SYS/CONGQING@ORCL
Run {
Allocate channel D1 type disk;
Backup incremental Level 1 format '/home/oracle/rman_backup/level1_%d_%s_%p_%u.bak ' tag = ' Level 1 ' database;
SQL ' alter system archive log current ';
Backup Archivelog all format '/home/oracle/rman_backup/log_%d_%s_%p_%u.bak ' deletes all input;
Release channel D1;
}
Crosscheck backup;
Delete noprompt expired backup;
Delete NoPrompt obsolete;
Resync Catalog;

First-level differential incremental backup shell script level1_backup.sh

#!/bin/bash
CD $HOME
. . bash_profile
Cd/home/oracle/backup/script
Rman CMDFILE=LEVEL1_BACKUP.RCV msglog= $HOME/backup/log/level1.log
. /home/oracle/backup/script/exp_rman.sh

Second-level differential incremental backup Rman script LEVEL2_BACKUP.RCV
Connect Catalog Rman/rman
Connect Target SYS/CONGQING@ORCL
Run {
Allocate channel D1 type disk;
Backup incremental Level 2 format '/home/oracle/rman_backup/level2_%d_%s_%p_%u.bak ' tag = ' Level 2 ' database;
SQL ' alter system archive log current ';
Backup Archivelog all format '/home/oracle/rman_backup/log_%d_%s_%p_%u.bak ' deletes all input;
Release channel D1;
}
Crosscheck backup;
Delete noprompt expired backup;
Delete NoPrompt obsolete;
Resync Catalog;

Second-level differential incremental backup shell script level2_backup.sh
#!/bin/bash
CD $HOME
. . bash_profile
Cd/home/oracle/backup/script
Rman CMDFILE=LEVEL2_BACKUP.RCV msglog= $HOME/backup/log/level2.log
. /home/oracle/backup/script/exp_rman.sh

Improve Rman Incremental backup performance

ALTER DATABASE enable block change tracking using file
'/u01/app/oracle/admin/devdb/bdump/luke.log ';

Desc v$block_change_tracking;

Linux performs backup scripts on a regular basis

CRONTAB-E-U Oracle
Shell=/bin/bash--The following script executes under bash
Mailto=oracle--The execution log is emailed to Oracle users, and can be/var/spool/mail/oracle.
1 * * 0/home/oracle/backup/script/level0_backup.sh
1 * * 1/home/oracle/backup/script/level2_backup.sh
1 * * 2/home/oracle/backup/script/level2_backup.sh
1 * * 3/home/oracle/backup/script/level1_backup.sh
1 * * 4/home/oracle/backup/script/level2_backup.sh
1 * * 5/home/oracle/backup/script/level2_backup.sh
1 * * 6/home/oracle/backup/script/level2_backup.sh

One-week differential backup strategy:

Backup target library and catalog library, Sunday level 0 fully prepared, Monday Tuesday Wednesday to 2, Thursday 1, Friday Saturday to 2. Backup starts 1:10 A.M. every day.

The recovery window is set to 7 days and the database can be restored to any point in time within seven days. A weekly backup set is marked as an expired backup set, the backup set is checked after each backup completes, and an expired backup set is deleted, and all previous backup sets are deleted after the Sunday level 0 backup, with automatic backup control files and parameter files. Automatically back up the database structure whenever it is changed, including control files, parameter files, and archive logs in addition to backing up data files, automatically deleting backed-up archived logs and expired backup sets after the backup is completed, and automatically checking the integrity of the backup set after the backup is completed, and the problem is reflected in the log.

4. Feasibility Test

1. See if backup sets are available

List backupset Summary;

Validate Backupset 118,130,164,177;

Validate backupset 118,130,164,177 Check logical– analog restore.

2. Simulate non-system table space damage (delete data files directly)

First create a table, and then insert a data submission

Then delete the corresponding data file

Executes alter system flush Buffer_cache and prompts you to query the table again;

ERROR at line 1:

Ora-01116:error in opening database file 4

Ora-01110:data file 4: '/HOME/ORACLE/ORADATA/OCM/USERS.DBF '

Ora-27041:unable to open File

Linux error:2: No such file or directory

Additional Information:3

Performing a recovery script

Run {

Allocate channel D1 device type disk;

SQL "ALTER DATABASE datafile 4 offline";

Restore DataFile 4;

Recover DataFile 4;

SQL "ALTER DATABASE datafile 4 online";

}

3. Simulated undo Tablespace Destroyed (delete undo data file directly)

Undo Tablespace cannot be online offline readonly so you do not need to execute these statements when you restore

The database Undo table space is lost explicitly prior to recovery. To execute orders in Sqlplus,

Alter database datafile 2 online;

Alter database datafile 2 offline;

Run {

Allocate channel D1 device type disk;

Restore DataFile 2;

}

Recover may fail and be done directly inside sqlplus, if you fail to try a few more times

4. Simulation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.