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

标签 linux oracle shell database-backups rman

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

脚本

[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

最佳答案

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.

关于linux - RMAN 命令未在 .sh 文件中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54568273/

相关文章:

sql - Oracle SQL - 在不知道列名的情况下选择列

file - 如何在同一时间shell中读取两个文件

c - 实现条目超时的 C 哈希表的最有效方法是什么?

c - linux C 字符串转int

linux - 如何通过限制 bash shell 脚本中的线程数来一次复制五个文件而不是一个文件?

regex - 特定日期格式的正则表达式

sql - 从字符串中修剪整数

mysql - 如何在mysql中保存大数据?

在 git shell 中时的 GitHub 错误 "fatal: bad config file line 1 in .git/config"

linux - 用于在 ubuntu 上运行 sublime text 3 的终端命令