概述
有时您可能需要终止挂起且没有响应的 RMAN 会话。为此,您有两个选择。第一个选项是使用 alter system kill session 命令。您需要从 v$process 和 v$sessions 视图中获取 sid 和 serial# 值。请参阅以下示例:
1. 连接到 RMAN 并运行备份数据库命令:
RMAN> backup database;
2. 使用以下查询获取已连接 RMAN 会话的 sid 和 serial# 值:
SQL>
select b.sid, b.serial#, a.spid, b.client_info
from
v$process a, v$session b
where
a.addr=b.paddr and client_info
like
'rman%';
SID SERIAL# SPID CLIENT_INFO
---------- ---------- ------------ ---------------------------------
141 22 976 rman channel=ORA_DISK_1
3. 使用 alter system kill session 命令终止正在运行的备份会话:
SQL>
alter
system kill session '141,22' immediate;
system altered.
SQL>
终止会话后,您会在 RMAN 输出中收到以下消息:
input datafile fno=00004
name=C:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF
channel ORA_DISK_1: starting piece 1 at 20-JUL-10
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/20/2010
18:47:39
ORA-00028: your session has been killed
ORA-00028: your session has been killed
continuing other job steps, job failed will not be re-run
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/20/2010
18:47:39
ORA-00028: your session has been killed
ORA-00028: your session has been killed
RMAN>
您也可以直接从 OS 中杀死 RMAN 会话。请参阅以下示例。在这里,您备份数据库并从操作系统获取 RMAN 进程的进程 ID,然后使用 kill -9 命令将其杀死:
RMAN> backup database plus archivelog;
[oracle@locahost ~]$ ps -ef | grep rman
oracle 4669 4513 3 01:28 pts/1 00:00:00 rman target /
oracle 4712 4689 0 01:28 pts/2 00:00:00 grep rman
[oracle@locahost ~]$ kill -9 4669
[oracle@locahost ~]$
终止会话后,您会从 RMAN 获得以下输出:
input datafile fno=00004
name=/u01/oracle/product/10.2.0/db_1/oradata/db3/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-JUL-10
Killed
最后
以上就是朴素大象为你收集整理的杀死挂起的 RMAN 会话的全部内容,希望文章能够帮你解决杀死挂起的 RMAN 会话所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复