cid pid client_pid os id

在Oracle数据库环境中,为了生成RFS(RecoveryFileServer)过程的跟踪文件,首先从主数据库的alert日志中找到最近启动的归档进程(如ARC6),然后在备用数据库中确定与ARC6通信的RFS进程ID。接着,在备用数据库中使用SQLPlus查询v$managed_standby视图以找到对应RFS进程的详细信息,最后使用oradebug工具设置事件10046进行跟踪,收集SQL、等待事件等信息。

To generate a trace file of the RFS process we need to implement the following:


1. In the alert log of a primary database, we find the ARC (archiver) process which was most recent to start the archiver's heartbeat. For example:

...
Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST
...
ARC6 started with pid=42, OS id=415
...
Thu Jun 14 13:08:02 EST 2012
ARC6: Becoming the heartbeat ARCH
...

In this example the heartbeat archiver process is ARC6, as seen in the primary database's alert log above.


2. In the standby database we find the ID of the RFS process which is communicating with the ARC6 process on the primary. Example:

[yourmachine ~]$ ps -ef | grep arc
oracle 5352 1 0 Jul25 ? 00:00:00 ora_arc0_dg112i1
oracle 5356 1 0 Jul25 ? 00:00:00 ora_arc1_dg112i1
oracle 5358 1 0 Jul25 ? 00:00:08 ora_arc2_dg112i1
oracle 5360 1 0 Jul25 ? 00:00:00 ora_arc3_dg112i1
oracle 5357 1 0 Jul25 ? 00:00:00 ora_arc4_dg112i1
oracle 5359 1 0 Jul25 ? 00:00:08 ora_arc5_dg112i1
oracle 415 1 0 Jul25 ? 00:00:00 ora_arc6_dg112i1

In this example we found that the ARC6 process id is 415. This confirms what we have seen in the primary database's alert log ("id=415").

3. In the standby database we connect to SQLPlus as a user who can query the data dictionary view v$managed_standby. We have to find the RFS process ID corresponding with the archiver process 415. Example:

SQL> select process,pid,client_pid from v$managed_standby;

PROCESS PID CLIENT_PID
--------- ---------- ----------------------------------------
ARCH 10451 10451
ARCH 10453 10453
ARCH 10455 10455
ARCH 10457 10457
RFS 10627 5358
RFS 10597 6201
RFS 10601 23000
RFS 10653 415 <---
RFS 10529 1193
RFS 10603 5360
MRP0 10643 N/A

11 rows selected.

In this example the PID (process ID) is 10653.


4. We have to attach to that RFS using the 'oradebug' utility and set event 10046 trace name context forever to get the SQL/waits, internal queries and other information:

SQL> oradebug setospid 10653
Oracle pid: 25, Unix process pid: 10653, image: oracle@<host machine.com> (ARC6)
SQL> oradebug unlimit
Statement processed.
SQL> oradebug event 10046 trace name context forever, level 12;
Statement processed.
SQL> -- Keep tracing for some time while the problem is occurring
SQL> -- as required by Oracle Support.
SQL> -- To stop tracing:
SQL> oradebug event 10046 trace name context off;
Statement processed.
SQL>

在mysql数据里有一张表,建表语句如下: ``` CREATE TABLE `audit_bin_info` ( `BIN_PID` int(8) NOT NULL, `HOST_NAME` varchar(100) DEFAULT NULL , `SOCK_ID` int(8) DEFAULT NULL , `BIN_STS` tinyint(2) DEFAULT NULL , `BOOT_NAME` varchar(100) DEFAULT NULL, `CHANNEL_ID` tinyint(2) DEFAULT NULL , `START_DATE` datetime DEFAULT NULL , `UPDATE_DATE` datetime DEFAULT NULL, `MODULE_NAME` varchar(100) DEFAULT NULL, `BUSI_CONTENT` varchar(4000) DEFAULT NULL, `TASK_STS` smallint(4) DEFAULT NULL , `ID` bigint(15) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`ID`) USING BTREE, KEY `IDX_BIN_INFO` (`BOOT_NAME`,`MODULE_NAME`,`CHANNEL_ID`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=16766000 DEFAULT CHARSET=utf8 ``` 帮我写一个c++的函数,函数定义如下: ```void CMonitorBase::binlogToDb( const AISTD string & strBinName, const AISTD string & strBinType, const CClientList & listClient, const AISTD string &m_strChannelId, otl_connect& ocDbConn) ``` 它需求实现以下功能: 1、使用otl_stream查询audit_bin_info表,查询语句为```select id, bin_pid, host_name, sock_id from audit_bin_info where boot_name='"+strBinName+"' and module_name='"+strBinType+"' and channel_id = " + m_strChannelId```;将查到数据保存在一个vector结构中; 2、将查到的表数据跟listClient中的数据做比较,比较条件为表数据中的bin_pid, host_name, sock_id分别和CClient结构中的m_iAppId,m_strHostName,m_iSockId,都相等,则认为找到数据。 3、如果在listClient中找到相等的数据,则根据找到的数据update表中的数据,需要更新的字段为BIN_STS, START_DATE, BUSI_CONTENT,TASK_STS,UPDATE_DATE,前4个字段对别对应CClient结构中的m_nClientSts,dtmBoot,m_strBusiContent,m_nTaskSts,UPDATE_DATE取系统时间; 如果在listClient中没找到相等的数据,则根据id值删除audit_bin_info表中的数据; 最后如果是listClient中多出来的数据,需要插入到audit_bin_info表中; 其中CClient和CClientList的定义如下: ``` class CClient { public: long m_idx; int32 m_iSockId; int32 m_iAppId; int64 m_llTaskId; int16 m_nTaskSts; int16 m_nClientSts; int16 m_nMaxTask; int16 m_nChannelId; AISTD string m_strBusiContent; AISTD string m_strHostName; INT64LIST m_listDetail; AISTD string m_strSpecSts; CBSDateTime dtmBoot; AISTD string m_strRetMsg; int16 m_nStatus; int16 m_nDispEsc; CClient() : m_idx(0), m_iSockId(0), m_iAppId(0), m_llTaskId(0), m_nTaskSts(0), m_nClientSts(1), m_nMaxTask(1), m_nChannelId(0), m_strSpecSts("0"), m_nStatus(0), m_nDispEsc(0) { dtmBoot = CBSDateTime::currentDateTime(); }; }; typedef AISTD vector<CClient*> CClientList; ```
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值