zoukankan      html  css  js  c++  java
  • rman备份例子

    1.全备份例子

    #!/bin/sh

    RMAN_OUTPUT_LOG=/home/oracle/rman_output.log
    RMAN_ERROR_LOG=/home/oracle/rman_error.log
    rman target / log=/home/oracle/rman_output.log<<EOF
    run
    {
    allocate channel ch1 device type disk;
    backup full database format '/home/oracle/rman_bakckup/db_fullbackup_%d_%s_%p_%T';
    backup current controlfile format '/home/oracle/rman_bakckup/ctl_%d_%s_%p_%T';
    backup archivelog all format '/home/oracle/rman_bakckup/arch_%d_%s_%p_%T';

    backup spfile format '/home/oracle/rman_bakckup/backup/spfile_%d_%s_%p_%T';
    release channel ch1;
    }
    EOF

     

    #!/bin/sh

    RMAN_OUTPUT_LOG=/home/oracle/rman_output.log
    RMAN_ERROR_LOG=/home/oracle/rman_error.log
    rman target / << EOF 1>>$RMAN_OUTPUT_LOG 2>>$RMAN_ERROR_LOG
    run
    {
    allocate channel ch1 device type disk;
    backup full database format '/home/oracle/rman_bakckup/db_fullbackup_%d_%s_%p_%T';
    backup current controlfile format '/home/oracle/rman_bakckup/ctl_%d_%s_%p_%T';
    backup archivelog all format '/home/oracle/rman_bakckup/arch_%d_%s_%p_%T';

    backup spfile format '/home/oracle/rman_bakckup/backup/spfile_%d_%s_%p_%T';
    release channel ch1;
    }
    EOF

     

    2.压缩备份

     

    ##非归档备份数据库
    rman target / <<EOF
    run
    {
    allocate channel ch1 device type disk;
    backup as compressed backupset full filesperset 5 database format '/home/oracle/rman_bakckup/db_fullbackup_%d_%s_%p_%T';
    backup current controlfile format '/home/oracle/rman_bakckup/ctl_%d_%s_%p_%T';
    backup spfile format '/home/oracle/rman_bakckup/spfile_%d_%s_%p_%T';
    release channel ch1;
    crosscheck backup;
    delete noprompt expired backup;
    delete noprompt obsolete;
    }
    EOF

     

    3.压缩备份数据文件和归档日志文件

    [oracle@cyz-server scripts]$ more rman_backup.sh
    #!/bin/sh
    backup_date=`date +%Y-%m-%d`

    rman target / log=/home/oracle/scripts/logs/rmanbackup_log_${backup_date}.log<<EOF
    run
    {
    allocate channel ch1 device type disk;
    backup as compressed backupset full filesperset 5 database format '/home/oracle/rman_backup/db_fullbackup_%d_%s_%p_%T';
    sql 'alter system archive log current';
    backup as compressed backupset archivelog all delete input format '/home/oracle/rman_backup/arch_%d_%s_%p_%T';
    backup current controlfile format '/home/oracle/rman_backup/ctl_%d_%s_%p_%T';
    backup spfile format '/home/oracle/rman_backup/spfile_%d_%s_%p_%T';
    release channel ch1;
    crosscheck backup;
    delete noprompt expired backup;
    delete noprompt obsolete;
    }
    EOF

  • 相关阅读:
    转 Wireshark和TcpDump抓包分析心得
    ubuntu tomcat的安装与配置
    好久之前就看到的,这次必须转了
    【1】记一次破解wifi
    aircrack加reaver破解带有wps的wifi
    hydra 密码破解工具详解
    树莓派上手常见问题处理[转]
    破解邻居家的wifi密码
    完全教程 Aircrack-ng破解WEP、WPA-PSK加密利器
    Ubuntu中启用关闭Network-manager网络设置问题! 【Server版本】
  • 原文地址:https://www.cnblogs.com/hxlasky/p/10246394.html
Copyright © 2011-2022 走看看