国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

Oracle中用腳本跟蹤存儲過程實例講解

瀏覽:41日期:2023-11-24 17:58:49
一、用腳本啟動并設(shè)置跟蹤的示例 我們可以用腳本進行跟蹤存儲過程,當(dāng)然要了解這些存儲過程的具體語法和參數(shù)的含義,至于這些語法和參數(shù)含義請查詢聯(lián)機幫助。下面請看一實例: /****************************************************//* Created by: SQL Profiler *//* Date: 2004/06/19 16:50:05 *//****************************************************/-- Create a Queuedeclare @rc intdeclare @TraceID intdeclare @maxfilesize bigintset @maxfilesize = 5 -- Please replace the text InsertFileNameHere, with an appropriate-- filename prefixed by a path, e.g., c:MyFolderMyTrace. The .trc extension-- will be appended to the filename automatically. If you are writing from-- remote server to local drive, please use UNC path and make sure server has-- write Access to your network shareexec @rc = sp_trace_create @TraceID output, 0, N'c:test', @maxfilesize, NULL if (@rc != 0) goto error-- Client side File and Table cannot be scripted-- Writing to a table is not supported through the SP's-- Set the eventsdeclare @on bitset @on = 1exec sp_trace_setevent @TraceID, 12, 1, @onexec sp_trace_setevent @TraceID, 12, 12, @onexec sp_trace_setevent @TraceID, 12, 14, @on-- Set the Filtersdeclare @intfilter intdeclare @bigintfilter bigintexec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler'set @intfilter = 100exec sp_trace_setfilter @TraceID, 22, 0, 4, @intfilterset @intfilter = 1exec sp_trace_setfilter @TraceID, 23, 1, 0, @intfilterexec sp_trace_setfilter @TraceID, 35, 1, 6, N'pubs'-- Set the trace status to startexec sp_trace_setstatus @TraceID, 1-- display trace id for future referencesselect TraceID=@TraceIDgoto finisherror: select ErrorCode=@rcfinish: go二、生成跟蹤腳本的最簡式 事件探查器建立跟蹤, 并設(shè)置好各種選項, 完成后運行跟蹤,然后生成腳本。 事件探查器--文件--導(dǎo)出跟蹤定義的文件--選擇合適的版本。這樣就會生成一個跟蹤的腳本, 打開生成的腳本, 修改里面的:exec @rc = sp_trace_create部分, 設(shè)置跟蹤結(jié)果的保存文件(用語句跟蹤的時候, 跟蹤結(jié)果只能保存到文件)。然后, 在需要跟蹤的時候, 運行這個腳本來啟動跟蹤。啟動跟蹤后, 跟蹤自動進行, 所以你可以關(guān)閉查詢分析器做其他事情去了。 三、已知的問題 1.跟蹤記錄不是實時寫入跟蹤文件的, 因此, 可能會到你停止跟蹤的時候, 跟蹤信息才寫入跟蹤文件 2.查看當(dāng)前已經(jīng)進行的跟蹤可以用(關(guān)于結(jié)果集的解釋, 請看聯(lián)機幫助): SELECT * FROM ::fn_trace_getinfo(0)3. 停止某個跟蹤, 可以在sp_trace_create 語句中設(shè)置自動停止時間, 也可以手動停止跟蹤, 用下面的語句: EXEC sp_trace_setstatus @traceid = 1 , -- 跟蹤的id @status = 0 -- 停止, 這樣以后還可能指定此項為來啟用EXEC sp_trace_setstatus @traceid = 1 , @status = 2 -- 關(guān)閉, 徹底釋放
標(biāo)簽: Oracle 數(shù)據(jù)庫
主站蜘蛛池模板: 利辛县| 武义县| 会理县| 宜昌市| 上栗县| 临汾市| 西峡县| 改则县| 青阳县| 大同县| 永嘉县| 承德县| 兰溪市| 北碚区| 普安县| 昂仁县| 乌拉特前旗| 盐亭县| 于都县| 奈曼旗| 揭东县| 博客| 龙口市| 铜川市| 新竹县| 当涂县| 句容市| 石城县| 桐庐县| 融水| 桦南县| 呼伦贝尔市| 泰州市| 修文县| 永善县| 青冈县| 永顺县| 赤城县| 济南市| 衡东县| 萝北县|