{"id":19694742,"url":"https://github.com/simulot/oracle_trc","last_synced_at":"2025-02-27T10:48:30.330Z","repository":{"id":75014340,"uuid":"172670325","full_name":"simulot/oracle_trc","owner":"simulot","description":"Extract SQL queries from oracle trc files","archived":false,"fork":false,"pushed_at":"2020-11-18T16:03:57.000Z","size":2871,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T23:49:53.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simulot.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-26T08:33:28.000Z","updated_at":"2020-11-18T16:04:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"00e9767c-94e7-4007-bcb9-554f4169b36b","html_url":"https://github.com/simulot/oracle_trc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulot%2Foracle_trc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulot%2Foracle_trc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulot%2Foracle_trc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulot%2Foracle_trc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simulot","download_url":"https://codeload.github.com/simulot/oracle_trc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241005474,"owners_count":19892795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T19:24:21.020Z","updated_at":"2025-02-27T10:48:30.304Z","avatar_url":"https://github.com/simulot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oracle_trc\n\n**WORK IN PROGRESS**\n\nI wrote this program to extract sql queries from trc files generated on client side.\n\n## trc_dump\nDump packets from trc files.\n\nSee cmd/trc_dump/readme.md for details\n\n## queries\nDump SQL queries found in trc file\n\nExemple \n\n``` sql\nclient_2548.trc(275031),05-NOV-2020 06:54:51:729, cliebt.exe(2548), Socket(1284), nsbasic_bsd:\nselect 'NO DUPLICATES' from DUAL where 0 = nvl(( \nselect \n  sum( case when FL.ACTION_INDEX = 3 then 0 else 1 end) as C \nfrom \n  (select :1 DOC_ID, :2 SUPPLIER_NUM, :3 INVOICE_NUM, :4 INVOICE_DATE, :5 COMP_NO from DUAL )REF join  \n  DOCS D on REF.DOC_ID \u003c\u003e D.DOC_ID and REF.INVOICE_NUM = D.INVOICE_NUM and REF.COMP_NO = D.COMP_NO and REF.SUPPLIER_NUM = D.SUPPLIER_NUM and D.STATUS_INDEX \u003c\u003e 4 \n    and D.INVOICE_DATE between REF.INVOICE_DATE-180 and REF.INVOICE_DATE+180  \n  left outer join (  \n    select FL.DOC_ID, FL.ACTION_INDEX  from FLOW_LOG FL where FL.ACTION_INDEX = 3  \n      and FL.SENDED_TO_TIMESTAMP = (select max(FL2.SENDED_TO_TIMESTAMP) from FLOW_LOG FL2 where FL.DOC_ID = FL2.DOC_ID ) \n    )FL on FL.DOC_ID = D.DOC_ID \n),0) \n\n  :1 = '50FEEB8B33844E69BF8C'\n  :2 = '992_4189'\n  :3 = 'TEST1234'\n  :4 = 2020-11-04T00:00:00Z\n  :5 = '992'\n```\n\n## Enabling trace files\nAdd following lines to SQLNET.ORA file\n\n```\nadr_base=off\nTRACE_LEVEL_CLIENT = 16\nTRACE_FILE_CLIENT = CLIENT\nTRACE_DIRECTORY_CLIENT = d:\\logs\\oracle\n```\n\n## Do do\n\n- [X] Display queries after a given date\n- [X] Display executable associated with pid\n- [X] Write tests independent from trace files (confidentiality) \n- [X] Sort outputs from several trace file in time order\n- [ ] Understand binary format of packets (help wanted)\n- [X] Determine bind parameters value (help wanted)\n- [ ] Decode responses (help wanted)\n\n\n\n# Some information\n\nFindings on TNS packets\n- https://blog.pythian.com/repost-oracle-protocol/\n- https://flylib.com/books/en/2.680.1/the_oracle_network_architecture.html\n- https://github.com/wireshark/wireshark/blob/master/epan/dissectors/packet-tns.c\n- https://github.com/sijms/go-ora\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulot%2Foracle_trc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimulot%2Foracle_trc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulot%2Foracle_trc/lists"}