Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ RM Environment Database RMAN Backup Strategy Formulation     - Nagios plugin installation tutorial of Nrpe (Linux)

- grep command usage (Linux)

- Recent Consolidation Using Linux security module (Linux)

- Use OpenSSL to generate a certificate detailed process (Linux)

- How SSHfs mount a remote file system on Linux (Linux)

- Postgres-X2 deployment steps (Database)

- Java framework for parallel study - ForkJoin (Programming)

- Cooling solutions Ubuntu system (Linux)

- Ubuntu 14.10 / Linux Mint 17.1 Win10 compiler install rdesktop 1.8.3 Remote Desktop connection (Linux)

- Using a proxy method under Linux terminal (Linux)

- Read the official GNU Make manual one (chapter 1-2) (Programming)

- Oracle SDE and maintain common commands - Display space (Database)

- Python function arguments * args and ** kwargs usage (Programming)

- Dom4j change XML coding (Programming)

- Linux process management related content (Linux)

- Database Blob data type conversion String (Programming)

- Android media library of analysis: MediaProvider (Programming)

- LNMP summary of the issues common 502 Bad Gateway (Server)

- How to override the plain text files and directories soft connection in linux (Linux)

- JITwatch installation under Linux (Linux)

 
         
  RM Environment Database RMAN Backup Strategy Formulation
     
  Add Date : 2017-08-31      
         
       
         
  DG environment database RMAN backup strategy formulation:
Primary

Full library backup
Archive backup
Delete the history folder
Standby

Delete the archive
Reference

Primary
$ Crontab -l

0 1 * * * /usr2/backupsh/full_backup.rman
0 * / 2 * * * /usr2/backupsh/arch_backup.rman
0 3 * * * /usr2/backupsh/del_old.sh Full library backup
More /usr2/backupsh/full_backup.rman

#! / Bin / bash
Foldername = `date +% Y% m% d`
Cd / usr2 / BACKUP
If [-d $ foldername]
Then
        Echo 'go on'
Else
        Echo 'need mkdir'
        Mkdir $ foldername
Fi

Export Oracle_SID = jyzhao
Export ORACLE_BASE = / opt / app
Export ORACLE_HOME = / opt / app / oracle / product / 11.2.0 / db_1
Export PATH = $ PATH: $ ORACLE_HOME / bin: $ HOME / bin
#export LD_LIBRARY_PATH = $ ORACLE_HOME / lib
#export NLS_LANG = "simplified chinese_china.ZHS16GBK"
#export NLS_DATE_FORMAT = "YYYY-MM-DD HH24: Mi: SS"

Rman target / log = / usr2 / BACKUP / $ foldername / LOG_full_ $ foldername.log < < EOF
Run {
Configure retention policy to recovery window of 5 days;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '/ usr2 / BACKUP / $ foldername / controlfile% F';
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Allocate channel c3 device type disk;
Allocate channel c4 device type disk;
#backup database skip inaccessible
Backup incremental level = 0 database
        Format '/ usr2 / BACKUP / $ foldername / full_BACK_% U';
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
}}
Allocate channel for maintenance device type disk;
Crosscheck backupset;
Delete noprompt expired backupset;
Delete noprompt obsolete;
Exit
EOF archive backup
More /usr2/backupsh/arch_backup.rman

#! / Bin / bash
Foldername = `date +% Y% m% d`
Cd / usr2 / BACKUP
If [-d $ foldername]
Then
        Echo 'go on'
Else
        Echo 'need mkdir'
        Mkdir $ foldername
Fi

Export ORACLE_SID = jyzhao
Export ORACLE_BASE = / opt / app
Export ORACLE_HOME = / opt / app / oracle / product / 11.2.0 / db_1
Export PATH = $ PATH: $ ORACLE_HOME / bin: $ HOME / bin
#export LD_LIBRARY_PATH = $ ORACLE_HOME / lib
#export NLS_LANG = "simplified chinese_china.ZHS16GBK"
#export NLS_DATE_FORMAT = "YYYY-MM-DD HH24: Mi: SS"

Rman target / log = / usr2 / BACKUP / $ foldername / LOG_arch_ $ foldername.log append < < EOF
Run {
Configure retention policy to recovery window of 5 days;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '/ usr2 / BACKUP / $ foldername / controlfile% F';
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
Allocate channel c1 device type disk;
Allocate channel c2 device type disk;
Allocate channel c3 device type disk;
Allocate channel c4 device type disk;
#backup database skip inaccessible
Backup archivelog all delete input
        Format '/ usr2 / BACKUP / $ foldername / arch_BACK_% U';
Release channel c1;
Release channel c2;
Release channel c3;
Release channel c4;
}}
Allocate channel for maintenance device type disk;
Crosscheck backupset;
Delete noprompt expired backupset;
Delete noprompt obsolete;
Exit
EOF Deletes the history folder
More /usr2/backupsh/del_old.sh

#! / Bin / bash
#del old folders
Cd / usr2 / BACKUP
Find. -mtime +7 | xargs rm -rf standby (Standby)
$ Crontab -l

0 3 * * * /usr2/del_arch/del_arch.sh Delete the archive
More /usr2/del_arch/del_arch.sh

#! / Bin / bash
Export ORACLE_SID = jyzhao_s
Export ORACLE_HOME = / opt / app / oracle / product / 11.2.0 / db_1
Export ARCHIVE_DIR = / usr2 / oradata / archivelog
Export LOG_FILE = / usr2 / oradata / archivelog / del_archive.log
 
Echo "Start deleting archived logs:` date` ...... ">> $ LOG_FILE
If [ `whoami`! = 'Oracle']
Then
Echo "Error: You must be oracle to execute." >> $ LOG_FILE
Exit 99
Fi
 
Del_seq = `ls -tr $ ARCHIVE_DIR / | grep -v stdarch | head -1 | cut -f2 -d_`
$ ORACLE_HOME / bin / sqlplus -silent "/ as sysdba" < < XFF> tmp.log
Set pagesize 0 feedback off verify off heading off echo off
Select max (sequence #) from v \ $ ARCHIVED_LOG where APPLIED = 'YES';
Exit;
XFF
Max_sn = `cat tmp.log`
Rm tmp.log
Max_sn = $ (($ max_sn - 20))
# I keep here is the last 20 archives, the specific circumstances of their own decisions
 
While [[$ {del_seq} -lt $ {max_sn}]]
Do
  Echo "$ {ARCHIVE_DIR} / 1 _ $ {del_seq} _830355509.dbf" >> $ LOG_FILE
  Rm $ {ARCHIVE_DIR} / 1 _ $ {del_seq} _830355509.dbf
  # Here is my definition of the archive file format, according to their own archive file format to match, the key is to match the log sequence no.
  Del_seq = $ (($ del_seq + 1))
Done
Echo "Delete archived log end:` date` ...... ">> $ LOG_FILE
 
# Clear the controlfile information
$ ORACLE_HOME / bin / rman target / < < XIFENFEI >> $ LOG_FILE
Crosscheck archivelog all;
Delete expired archivelog all;
YES
Exit;
XIFENFEI
 
Echo "......................................................................................................................................." >> $ LOG_FILE
     
         
       
         
  More:      
 
- How to write a new Git protocol (Linux)
- CentOS achieve trash mechanism (Linux)
- Java memory-mapped file MappedByteBuffer (Programming)
- Linux iptables firewall settings (Linux)
- Linux character device - automatically creates the device nodes and devices (Linux)
- CentOS 6.5 three ways to configure the IP address (Linux)
- C # and JavaScript arrays to re-summary (Programming)
- Will Laravel become the most successful PHP framework? (Programming)
- Docker in the development and practice of IFTTT (Server)
- Linux Network Programming - raw socket programming (Programming)
- Python function arguments * args and ** kwargs usage (Programming)
- MongoDB relations, references, index query coverage (Database)
- Eight kinds of techniques to solve hard problems Linux (Linux)
- Shell Programming points to note about the function (Programming)
- Linux environment has been running Tomcat how to deploy the new Tomcat (Server)
- To learn from scratch OpenWrt perfect tutorial (Linux)
- Java memory area Explanation (Programming)
- hadoop 2.7.1 High Availability Setup Deployment (Server)
- In addition to wget and curl, what better alternatives (Linux)
- Teach you how to protect the Linux operating system security tips (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.