RMAN命令未在.sh文件中执行

时间:2019-02-07 07:27:54

标签: linux oracle shell database-backups rman

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

脚本

[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。但是第三个并没有执行。卡在哪里?

enter image description here

1 个答案:

答案 0 :(得分:0)

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.