不commit能否将脏数据写入数据文件

Step 1: 
创建测试表空间。 
SQL> create tablespace test datafile '/u01/app/oracle/oradata/orcl/test01.dbf' size 1m; 
Tablespace created.

Step 2: 
创建测试用户。 
SQL> create user test identified by test; 
User created.

Step 3: 
将测试用户的默认表空间更改为test表空间。 
SQL> alter user test default tablespace test; 
User altered.

Step 4: 
用test用户连接数据库。 
[oracle@localhost ~]$ sqlplus "test/test" SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 25 18:55:38 2011 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

Step 5: 
查看test用户的schema下的object数量。 
SQL> select count(*) from user_objects; 
COUNT(*) 
---------- 0

Step 6: 
在test用户的schema下创建测试表mytest。 
SQL> create table mytest(name varchar(20)); Table created.

Step 7: 
向测试表mytest中插入一条记录。 
SQL> insert into mytest values('freas'); 
1 row created.

Step 8: 
在dba的窗口下刷buffer cache。 
SQL> alter system flush buffer_cache; System altered.

Step 9: 
在bash shell中用strings命令查看第一条记录"freas"是否已经写入数据文件了。 
[oracle@localhost ~]$ strings /u01/app/oracle/oradata/orcl/test01.dbf|grep "freas" Freas
注:此处有输出,说明Oracle已经将"freas"写入数据文件中。

Step 10: 
向测试表mytest中插入一条记录。 
SQL> insert into mytest values('tangtang'); 
1 row created.

Step 11: 
重复第9步操作,查看第二条记录"tangtang"是否已经写入数据文件了。 
[oracle@localhost ~]$ strings /u01/app/oracle/oradata/orcl/test01.dbf|grep "tangtang"
注:此处没有输出,说明Oracle没有将"tangtang"写入数据文件中,数据目前仍然停留在buffer cache中的。

Step 12: 
等待约1分钟,重复第9步操作,查看第二条记录"tangtang"是否已经写入数据文件了。 
[oracle@localhost ~]$ strings /u01/app/oracle/oradata/orcl/test01.dbf|grep "tangtang"
注:此处没有输出,说明Oracle没有将"tangtang"写入数据文件中,数据目前仍然停留在buffer cache中的。

Step 13: 
在sys用户下,再建一个铺助测试表test_aux,用于加强系统繁忙程度。 
a、 SQL> create table test_aux as select * from dba_objects; 
Table created.
b、SQL> insert into test_aux select * from test_aux; 
72713 rows 
SQL>/ 
145426 rows created. 
SQL> / 
290852 rows created.

Step 14: 
重复第9步操作,查看第二条记录"tangtang"是否已经写入数据文件了。 
[oracle@localhost ~]$ strings /u01/app/oracle/oradata/orcl/test01.dbf|grep "tangtang" tangtang,
注:此处有输出,说明Oracle已经将"tangtang"写入数据文件中。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31448824/viewspace-2136603/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31448824/viewspace-2136603/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值