楼主: yaguo_96

回滚段头事务表的大小

[复制链接]
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
21#
发表于 2008-5-29 22:14 | 只看该作者
原帖由 sqysl 于 2008-5-29 01:39 发表
谢谢了yonghuang,学习。
草草的看了一遍,没完全看明白,尤其是PERL脚本的部分,为什么用到PERL脚本呢,都用SHELL不可以完成吗?看来SHELL在文件内容的操作上远没PERL方便啊。


If you're willing to manually edit 48 files (actually I used 96 files in total), you don't need to use Perl.

Everyone working on UNIX/Linux should remember this very useful command:

perl -pi -e 's/string1/string2/' filename

It does what these two commands do:

sed -n 's/string1/string2/' filename > tmpfile
mv tmpfile filename

Since you don't have to worry about the middle file, tmpfile, here, the perl command is much easier. The middle file, if you use the sed method, has to be unique, which adds complexity to your shell programming logic.

This command:

perl -pi -e '$x=$.; s/constantstring/$x/' filename

does what UltraEdit vertical line editing does. $. is current line number.

Yong Huang

使用道具 举报

回复
论坛徽章:
7
生肖徽章:鸡
日期:2006-09-07 17:08:172008新春纪念徽章
日期:2008-02-13 12:43:03奥运会纪念徽章:足球
日期:2008-10-24 13:28:14生肖徽章2007版:龙
日期:2009-02-25 16:35:082010新春纪念徽章
日期:2010-01-04 08:33:082014年新春福章
日期:2014-02-18 16:41:11马上有车
日期:2014-02-18 16:41:11
22#
发表于 2008-5-29 22:50 | 只看该作者
太高深了,看不懂,就明白了通过设置隐含参数可以增加事务

使用道具 举报

回复
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
23#
发表于 2008-5-30 12:48 | 只看该作者
谢谢YONGHUANG 的答复,有机会认真研究一下PERL

使用道具 举报

回复
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
24#
发表于 2008-5-31 22:20 | 只看该作者

回复 #21 Yong Huang 的帖子

yonghuang,俺现在用SHELL编了个脚本(crt_sql_test.sh)完成你的测试脚本的生成:i.sql和test.sh:
$cat crt_sql_test.sh
#!/bin/sh
i=1
while [ i -le 48 ]
do
  echo "set transaction use rollback segment \"_SYSSMU5$\";\ndelete from t where x = $i;">$i.sql
  echo "sqlplus -S yong/yong @$i \&">>test.sh
  i=`expr $i+1`
done
文件都在当前目录下,然后运行:
./test.sh

[ 本帖最后由 sqysl 于 2008-5-31 22:24 编辑 ]

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
25#
发表于 2008-6-1 01:23 | 只看该作者
原帖由 sqysl 于 2008-5-31 08:20 发表
yonghuang,俺现在用SHELL编了个脚本(crt_sql_test.sh)完成你的测试脚本的生成:i.sql和test.sh:
$cat crt_sql_test.sh
#!/bin/sh
i=1
while [ i -le 48 ]
do
  echo "set transaction use rollback segment "_SYSSMU5$";
delete from t where x = $i;">$i.sql
  echo "sqlplus -S yong/yong @$i &">>test.sh
  i=`expr $i+1`
done
文件都在当前目录下,然后运行:
./test.sh


Great! I should have done that too. It's cleaner. Actually, we probably could merge all contents of $i.sql into the single file, test.sh, using here documents.

This kind of trick is useful to create many sessions. There're lots of load testing programs on the Internet. But I don't think they allow you to create sessions and sit there doing nothing like what we do here. Besides, no load testing programs would think of "set transaction use rollback segment".

Yong Huang

使用道具 举报

回复
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
26#
发表于 2008-6-1 18:13 | 只看该作者
thanks to yonghuang,but what is your mean for the "Actually, we probably could merge all contents of $i.sql into the single file, test.sh, using here documents",how to put all into the single file?like this:

$cat crt_sql_test.sh
#!/bin/sh
i=1
while [ i -le 48 ]
do
    echo "sqlplus -S yong/yong  set transaction use rollback segment \"_SYSSMU5\$";delete from t where x = $i \&">>test.sh
  i=`expr $i+1`
done

[ 本帖最后由 sqysl 于 2008-6-1 18:14 编辑 ]

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
27#
发表于 2008-6-6 06:00 | 只看该作者
原帖由 sqysl 于 2008-6-1 04:13 发表
thanks to yonghuang,but what is your mean for the "Actually, we probably could merge all contents of $i.sql into the single file, test.sh, using here documents",how to put all into the single file?like this:

$cat crt_sql_test.sh
#!/bin/sh
i=1
while [ i -le 48 ]
do
    echo "sqlplus -S yong/yong  set transaction use rollback segment "_SYSSMU5$";delete from t where x = $i &">>test.sh
  i=`expr $i+1`
done


Instead of having many .sql files, each one called by
sqlplus -s yong/yong @$i.sql &

I can do this:

$ cat test.sql
set transaction use rollback segment "_SYSSMU11$";
delete from t where x = &1;
$ cat test.sh
sqlplus -s yong/yong @test 1  &
sqlplus -s yong/yong @test 2  &
sqlplus -s yong/yong @test 3  &
sqlplus -s yong/yong @test 4  &
sqlplus -s yong/yong @test 5  &
sqlplus -s yong/yong @test 6  &
sqlplus -s yong/yong @test 7  &
sqlplus -s yong/yong @test 8  &
...
$ . ./test.sh

That works. But it's still not ideal. I want to merge the test.sql into test.sh so one single file is enough. I haven't figured that out yet.

By the way, in your script you need to change echo to echo -e, add spaces around + inside expr expression, remove  in front of &, and change "i -le 48" to "$i -le 48". I like the new syntax better: while (( i < 48 )).

Also, you need to run the shell script as a dot script: . ./test.sh, not just ./test.sh.

Yong Huang

使用道具 举报

回复
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
28#
发表于 2008-6-6 08:45 | 只看该作者
thanks a lot to YONGHUANG,I haven't tested the scripts,I will test it sometime,then post it.

使用道具 举报

回复
论坛徽章:
8
2009新春纪念徽章
日期:2009-01-04 14:52:28祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-03-01 11:07:24ITPUB9周年纪念徽章
日期:2010-10-08 09:32:25ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262013年新春福章
日期:2013-02-25 14:51:24沸羊羊
日期:2015-03-04 14:51:522015年新春福章
日期:2015-03-06 11:57:31
29#
发表于 2008-6-8 10:51 | 只看该作者
HUANG YONG ,你好:
我在我的环境测试了这个问题,你上次的帖子里说的脚本问题都是对的,我现在我的环境里进行了测试,VM+ENTERPRISE_LINUX4+RAC10_2_1,发现在有以下两个问题:
1.运行脚本用./test.sh,而../test.sh不能运行。
2.在运行脚本期间,查询v$rollstat里没记录,可测试表里的数据确实被删除了。
3.运行完该脚本后,用set transaction...;delete from t...依然可以。
不知道怎末回事情。不知道你测试过这个过程没有,环境是什么环境?

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
30#
发表于 2008-6-16 00:51 | 只看该作者
原帖由 sqysl 于 2008-6-7 20:51 发表
HUANG YONG ,你好:
我在我的环境测试了这个问题,你上次的帖子里说的脚本问题都是对的,我现在我的环境里进行了测试,VM+ENTERPRISE_LINUX4+RAC10_2_1,发现在有以下两个问题:
1.运行脚本用./test.sh,而../test.sh不能运行。
2.在运行脚本期间,查询v$rollstat里没记录,可测试表里的数据确实被删除了。
3.运行完该脚本后,用set transaction...;delete from t...依然可以。
不知道怎末回事情。不知道你测试过这个过程没有,环境是什么环境?


All three problems you reported here are because you did not read my words carefully. You need to run the shell script as a dot script in order to affect the current shell instead of a subshell:
.[space]./test.sh

(Change [space] to an actual space on your keyboard.)

Yong Huang

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表