添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

To monitor RMAN job progress:
1. Before starting the RMAN job, create a script file (called, for this example,
longops) containing the following SQL statement:
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
2. Start RMAN and connect to the target database and recovery catalog (if used).
3. Start an RMAN job. For example, enter:
RMAN> RESTORE DATABASE;
4. While the RMAN job is running, start SQL*Plus and connect to the target
database, and execute the longops script to check the progress of the RMAN job. If
you repeat the query while the RMAN job progresses, then you see output such as
the following:
SQL> @longops
SID SERIAL# CONTEXT SOFAR TOTALWORK %_COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
8 19 1 10377 36617 28.34
SQL> @longops
SID SERIAL# CONTEXT SOFAR TOTALWORK % COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
8 19 1 21513 36617 58.75
SQL> @longops
SID SERIAL# CONTEXT SOFAR TOTALWORK % COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
8 19 1 29641 36617 80.95

SQL> @longops
SID SERIAL# CONTEXT SOFAR TOTALWORK % COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
8 19 1 35849 36617 97.9
SQL> @longops
no rows selected
5. If you run the longops script at intervals of 2 minutes or more and the %_COMPLETE
column does not increase, then RMAN is encountering a problem. See "Monitoring
RMAN Interaction with the Media Manager" on page 23-7 to obtain more
information.
If you frequently monitor the execution of long-running tasks, then you could create a
shell script or batch file under your host operating system that runs SQL*Plus to
execute this query repeatedly.

#写一个shell
[oracle@oel ~]$ cat longops
sqlplus / as sysdba <<EOF
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
exit
EOF
#用watch实时查看
[oracle@oel ~]$ watch sh longops
#报错是因为V$SESSION_LONGOPS的$,可以转译一下
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>   2    3    4    5    6    7  FROM V
*
ERROR at line 3:
ORA-04044: procedure, function, package, or type is not allowed here
#用斜杠转译
[oracle@oel ~]$ cat longops
sqlplus / as sysdba <<EOF
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V\$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
exit
EOF
[oracle@oel ~]$ watch sh longops
# 2 3 4 5 6 7是脚本里的sql这样看着不爽再改一下,把sql单独拿出来
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>   2    3    4    5    6    7
SID    SERIAL#    CONTEXT      SOFAR  TOTALWORK %_COMPLETE
---------- ---------- ---------- ---------- ---------- ----------
100         29          1     175000     314480      55.65

#单独拿出来的脚本$也不用转译了,方便
[oracle@oel ~]$ cat longops
sqlplus / as sysdba <<EOF
@/home/oracle/progress.sql
exit
EOF
[oracle@oel ~]$ cat progress.sql
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
[oracle@oel ~]$
#再次watch查看顺眼多了
[oracle@oel ~]$ watch sh longops
Every 2.0s: sh longops                                                                                       Tue Feb  6 05:00:33 2018


SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 6 05:00:33 2018


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

#sofar totalwork 是block数

SQL>
SID    SERIAL#    CONTEXT      SOFAR  TOTALWORK  %_COMPLETE
----------   ----------   ----------     ----------      ----------    ----------
156             77               1         95448     314480          30.35

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

To monitor RMAN job progress:1. Before starting the RMAN job, create a script file (called, for this example,longops) containing the following SQL statement:SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTA... 在有的情况下我们可能需要监控 RMAN Job 的运行情况,这个时候我们可能需要通过以下几个视图对相关的信息进行收集和确认: V$Process:包含正在运行的进程的相关信息; V$ Session :包含当前数据库的 session ,可以通过此视图获取到各个channel对应的进程; V$ Session _ Long ops :包含 long -running operati
pl/sql程序基础知识:   pl/sql(procedural language/sql)oracle在标准sql上面的扩展,不仅简单的sql语句,还具有一般语言的特性:变量,常量,流程控制和循环,错误处理机制.是一个功能完善强大的过程化语言.   它的编程基本单位是块,复杂的功能都是多个块组成     我们来看看它的实列代码: declear --定义...
GRANT EXECUTE ON SYS.KILL_ SESSION TO wsj; *ERROR at line 1: ORA-04042: procedure, function, package, or package body does not exist 报错信息显示,某个存储过程,函数,package,package body不 执行带这dual虚表就报 :PL/SQL:ORA:04044:此处不允许过程、函数、程序包或类型; 通过查询: select * from all_objects where  object_name='DUAL'; 发现,有一个存储过程名也叫dual,将该存储过程删除后,就OK了。