Archive for 十二月, 2007

oracle profiles —畅饮绿色心情

星期二, 十二月 25th, 2007

一、目的:

Oracle系统中的profile可以用来对用户所能使用的数据库资源进行限制,使用Create Profile命令创建一个Profile,用它来实现对数据库资源的限制使用,如果把该profile分配给用户,则该用户所能使用的数据库资源都在该profile的限制之内。

二、条件:

创建profile必须要有CREATE PROFILE的系统权限。

为用户指定资源限制,必须:

1.动态地使用alter system或使用初始化参数resource_limit使资源限制生效。该改变对密码资源无效,密码资源总是可用。

SQL> show parameter resource_limit

NAME                                 TYPE        VALUE

———————————— ———– ——————————

resource_limit                       boolean     FALSE

(全文…)

for update nowait

星期一, 十二月 24th, 2007

Oracle provides the FOR UPDATE clause in SQL syntax to allow the developer to lock a set of Oracle rows for the duration of a transaction.  The FOR UPDATE clause is generally used in cases where an online system needs to display a set of row data on a screen and they need to ensure that the data does not change before the end-user has an opportunity to update the data.

However, the FOR UPDATE clause in SQL will cause the SQL to “hang” if one of the requested rows is locked by another user.  If you try to access the rows with the NOWAIT clause, you will get an error message, ORA-00054 Resource busy and acquire with NOWAIT specified.

Essentially, the options were either “wait forever” or “don’t wait.  Oracle9i has added additional flexibility to the syntax by allowing the SQL to wait for a pre-defined amount of time for locked rows before aborting.

In this example we select a student row and wait up to 15 seconds for another session to release their lock:

select

   student_last_name

from

   student

where student_id = 12345

FOR UPDATE WAIT 15;

In the real-world, many large online systems do not use the FOR UPDATE clause.  Rather, they ensure data integrity by re-reading the data when the end-user requests a change, and displays an error message if the data has changed since it was initially displayed to the user.

生命的呢喃

星期五, 十二月 21st, 2007

生命的呢喃,不错的文章

life2.pps

rc.d和脚本

星期五, 十二月 21st, 2007

今天早上在PUB上看到一个网友问在/etc/rc.d/rc6.d下添加的脚本不能执行。所以就把一些和启动相关的说明下。脚本的执行是和系统运行的模式有关。

/etc/rc.d/rc0.d
/etc/rc.d/rc1.d
/etc/rc.d/rc2.d
/etc/rc.d/rc3.d
/etc/rc.d/rc4.d
/etc/rc.d/rc5.d
/etc/rc.d/rc6.d
/etc/rc.d/init.d

目录
1. 关于linux的启动
2. 关于rc.d
3. 启动脚本示例
4. 关于rc.local
5. 关于bash启动脚本
6. 关于开机程序的自动启动

如果你想添加开始自动执行的程序。那么就要把脚本放到/etc/rc.d/init.d下。注意给执行权限。然后可以用chkconfig -add 添加进去。

索引为什么不工作

星期五, 十二月 21st, 2007

先要声明两个知识点:

(1)RBO&CBO。

Oracle有两种执行优化器,一种是RBO(Rule Based Optimizer)基于规则的优化器,这种优化器是基于sql语句写法选择执行路径的;另一种是CBO(Cost Based Optimizer)基于规则的优化器,这种优化器是Oracle根据统计分析信息来选择执行路径,如果表和索引没有进行分析,Oracle将会使用RBO代替CBO;如果表和索引很久未分析,CBO也有可能选择错误执行路径,不过CBO是Oracle发展的方向,自8i版本来已经逐渐取代RBO.

(全文…)