还是找点事情做吧。这个项目做下来,我发现现场的测试人员普遍都不会前台抓SQL(就是指点击一下前台界面的操作,然后去数据库追查
还是找点事情做吧。这个项目做下来,我发现现场的测试人员普遍都不会前台抓SQL(就是指点击一下前台界面的操作,然后去数据库追查刚刚这个动作 操作了哪些表)。后来和做测试的几个其它朋友聊天,也基本不知道这几个视图,感觉很诧异,这个应该是每一个测试人员,以及实施人员(没参与项目数据库开发,不熟悉每个业务具体操作那些表)常用的技能。因此决定总结下,把这小技巧给大家推荐下。
其实很简单,就两个Oracle 自带的视图:v$sql_bind_capture 和 v$sql.
1、先点击下系统前台操作,然后去数据库查询
select distinct sql_text, sql_id, address
from v$sql
where module = 'JDBC Thin Client' --数据库的链接方式
and last_active_time>sysdate-0.0005 --很短的一个时间,不然太多不好区分
and parsing_schema_name like 'INVENTORY%'; --数据库用户名
2、 通个这个查询我们可以知道,刚刚数据库进行操作的SQL(如果语句很长就得看SQL_FULLTEXT这个字段),如果你还想看详细参数,就得继续了。
select t.NAME, t.VALUE_STRING, t.*
from gv$sql_bind_capture t
where t.address = '0700000916BF5110';
Value_string就是你传进去执行的变量值。很不幸的告诉你时间这样显示不了,但我们有办法啊,,继续下面的查询。
select t.value_string,
t.NAME,
t.datatype_string,
DUMP(t.value_anydata),
ANYDATA.accesstimestamp(t.value_anydata)
from gv$sql_bind_capture t
where address = '000000015E3964A8';
具体我就不解释了。
关于v$sql_bind_capture视图大家得注意下,由于数据库参数配置的不同,这个保存绑定变量的值刷新时间是不同的,隐含参数 _cursor_bind_capture_interval,这个就是控制绑定变量抓取频率的参数,默认值是900(15min)。修改参数值很小,可以快速获取绑定变量的值: alter system set "_cursor_bind_capture_interval"=5 scope=both; 不过这个得根据你数据库的具体情况来设置了。如果你抓取到的参数老是没变化,你就要注意下这个抓取刷新的频率是多高了。
select * from v$parameter t where t.name like '%bind%';
还有一点也需要注意,如果你的数据库是RAC多点集群的话,v$sql_bind_capture这个表的数据并没有存到共享存储区,它是在被你链接的单点数据库上面,所以有时候你可能查不到,这时就得单点登录一个个单点数据库去试运气了。
当你刚刚接触别人的二手代码,或作为一个测试人员、实施人员、数据割接人员,不知道每个业务具体操作的是哪些表时,这两视图这样查询是不是很爽。哈哈

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
