RMAN中set command id to 'rman'是什么意思?主要起什么作用?

解决方案 »

  1.   

    完整的命令行如下:
    run{
       allocate channel ch1 type disk;
       set command id to 'rman';
       copy datafile 4 to 'c:\rman\backup\users01.dbf.bk';
       release channel ch1;
    }
    我就是不理解其中的set command id to 'rman'是什么意思,rman是我的恢复目录数据库.
      

  2.   

     set command id to 'rman'; 
    这个命令我也之前也没见过,刚查了一文档,说:set command id to 'rman'; 这个命令之后,从v$session的CLIENT_INFO列可以看到这个值,即可以查看session是哪个命令的
      

  3.   

    Correlating Server Sessions with Channels by Using SET COMMAND ID
    In this method, you specify a command ID string in the RMAN backup script. You can then query V$SESSION.CLIENT_INFO for this string.To correlate a process with a channel during a backup:In each session, set the COMMAND ID to a different value after allocating the channels and then back up the desired object. For example, enter the following in session 1: 
    RMAN> RUN 
    {
      ALLOCATE CHANNEL c1 TYPE sbt;
      SET COMMAND ID TO 'sess1';
      BACKUP DATABASE;
    }
    Set the command ID to a string such as sess2 in the job running in session 2:RUN 
    {
      ALLOCATE CHANNEL c1 TYPE sbt;
      SET COMMAND ID TO 'sess2';
      BACKUP DATABASE;
    }
    Start a SQL*Plus session and then query the joined V$SESSION and V$PROCESS views while the RMAN job is executing. For example, enter: 
    SQL> SELECT SID, SPID, CLIENT_INFO 
      FROM V$PROCESS p, V$SESSION s 
      WHERE p.ADDR = s.PADDR 
      AND CLIENT_INFO LIKE '%id=sess%';
    If you run the SET COMMAND ID command in the RMAN job, then the CLIENT_INFO column displays in the following format:id=command_id,rman channel=channel_id
    For example, the following shows sample output: SID SPID         CLIENT_INFO
    ---- ------------ ------------------------------
      11 8358         id=sess1
      15 8638         id=sess2
      14 8374         id=sess1,rman channel=c1
       9 8642         id=sess2,rman channel=c1
    The rows that contain the string rman channel show the channel performing the backup. The remaining rows are for the connections to the target database.