【问题标题】:RMAN commands not executing in .sh fileRMAN 命令未在 .sh 文件中执行
【发布时间】:2019-07-01 06:30:00
【问题描述】:

我一直在尝试实现 .sh 文件,该文件打开 RMAN 提示并显示上次数据库备份的备份摘要。

脚本

[apex@idmhost ~]$ cat b1.sh
ls
rman target / catalog rman/rman123@apexdb
list backup summary;

输出

sh b1.sh
0            db.rsp      Music            script_bkp.sh    Templates
apache.env   Desktop     Pictures        scripts          test
apexdb.env   Documents   Public           sendattatch.py   Videos
b1.sh        Downloads   rman_backup.sh   Softwares

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Feb 7 12:50:06 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: APEXDB (DBID=2757487913)
connected to recovery catalog database

RMAN>

如您所见,它正在执行该 linux 命令并连接到 RMAN。但是第三个没有被执行。卡在哪里了?

【问题讨论】:

    标签: linux oracle shell database-backups rman


    【解决方案1】:
    ORACLE_BASE=/opt/ora/app/oracle; export ORACLE_BASE;
    ORACLE_HOME=/opt/ora/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME;
    NLS_LANG=american_america.cl8mswin1251; export NLS_LANG;
    ORACLE_OWNER=oracle; export ORACLE_OWNER;
    ORACLE_SID=elbrus; export ORACLE_SID;
    
    $ORACLE_HOME/bin/rman target / nocatalog  <<EOF
    list backup summary;
    EOF
    
    
    oracle@krw-sql-elbrus-2 scripts]$ ./list_backups.sh
    
    Recovery Manager: Release 11.2.0.4.0 - Production on Thu Feb 7 11:16:10 2019
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    connected to target database: ELBRUS (DBID=1050971541)
    using target database control file instead of recovery catalog
    
    RMAN>
    
    List of Backups
    ===============
    Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
    ------- -- -- - ----------- ------------------- ------- ------- ---------- ---
    3931    B  A  A DISK        2019-02-07 07:31:29 1       1       NO         FULL_ARCHIVELOGS_BACKUP
    3932    B  F  A DISK        2019-02-07 07:36:38 1       1       NO         FULL_DATABASE_BACKUP
    3933    B  F  A DISK        2019-02-07 07:36:45 1       1       NO         FULL_DATABASE_BACKUP
    3934    B  A  A DISK        2019-02-07 07:36:47 1       1       NO         FULL_ARCHIVELOGS_BACKUP
    
    RMAN>
    
    Recovery Manager complete.
    

    【讨论】:

      猜你喜欢
      • 2015-06-07
      • 1970-01-01
      • 2010-11-16
      • 1970-01-01
      • 2020-08-19
      • 2022-11-04
      • 2018-02-26
      • 2019-11-17
      • 2021-01-07
      相关资源
      最近更新 更多