• 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

  • 相关阅读:
    Android SDK
    1055
    清除浮动的三种方式
    解决块状元素垂直外边距的塌陷问题
    drf 验证接口权限
    Linux常用指令
    Linux安装python3,virtualenv和virtualenvwrapper
    Linux基本命令2
    Linux之文档与目录结构
    Linux基本命令
  • 原文地址:https://www.cnblogs.com/hxlasky/p/10246394.html
Copyright © 2020-2023  润新知