Oracle与MySQL中“可串行化”的对比测试
Oracle与MySQL中“可串行化”的对比测试
Thomas Kyte 在“Oracle 9i&10g编程艺术”一书中为了说明事务的隔离级别,提供了一些例子。这里我们来看看“可串行化”级别下的表现。
以普通用户登录系统,并创建测试用的表。
idle> connect scott/tiger
Connected.
scott@FOO> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
scott@FOO> create table a(x int);
Table created.
scott@FOO> create table b(x int);
Table created.
修改事务的隔离级别为“可串行化”
时刻 会话1 会话2
t1 scott@FOO> alter session set isolation_level = serializable;
Session altered.
t2 scott@FOO> alter session set isolation_level = serializable;
相关文档:
1、创建表
create table stud(
sid int,
sname varchar2(50),
age number,
score number(4,2))
并插入一些数据(自己手动插入一些吧)
2、创建函数
create or replace function fun_getScores(
v_age in stud.age%type
)
return number
is ......
首先,要下载一个连接mysql数据库的驱动程序: mysql-connector-java-3.0.15-ga-bin.jar, 这个驱动程序不需要做其它配置,也就是说,对于mysql数据库,不必像access或者oracle要建立odbc数据源。
其次,将上面的.jar文件加入到classpath环境变量中。
最后,就是写代码进行测试了。
主要代码如下:
......
这个文件超级大, 查了一下, 大概的作用如下
是储存的格式
INNODB类型数据状态下,
ibdata用来储存文件的数据
而库名的文件夹里面的那些表文件只是结构而已
由于mysql4.1默认试innodb,所以这个文件默认就存在了http://man.chinaunix.net/database/mysql/inonodb_zh/2.htm 这个链接试innodb的中文参考, innodb的东 ......
系统环境:rhel5 (最小化安装,只安装vi工具) 内核:2.6.18-8.el5 1、 下载编译安装 #cd /usr/local/src/tarbag #wget http://mysql.byungsoo.net/Downloads/MySQL-5.1/mysql-5.1.38.tar.gz //下载5.1.38 #tar xzvf mysql-5.1.38.tar.gz -C ../software/ #cd ../software/mysql-5.1.38 #./configure --prefix=/usr ......
注: 从MySQL从服务器的版本不能小于主服务器的版本 实验环境 Master Mysql服务器版本5.1.36,IP:192.168.128.130 Slave Mysql服务器版本5.1.36,IP:192.168.128.132 一. MySQL主服务器配置 1.建立授权用户 用法:grant replication slave on *.* to ‘用户名’@'主机’ identified by ‘密码’; mysql>grant replicatio ......