??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲午夜福利717,色噜噜综合亚洲av中文无码,亚洲精品一区二区三区四区乱码 http://m.tkk7.com/kxbin/category/49610.html成功留给有准备的?/description>zh-cnWed, 17 Apr 2013 08:35:34 GMTWed, 17 Apr 2013 08:35:34 GMT60win7 64位系l?pl sql 无法解析指定的连接标识符 解决办法http://m.tkk7.com/kxbin/articles/397925.htmlkxbinkxbinTue, 16 Apr 2013 08:25:00 GMThttp://m.tkk7.com/kxbin/articles/397925.htmlhttp://m.tkk7.com/kxbin/comments/397925.htmlhttp://m.tkk7.com/kxbin/articles/397925.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/397925.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/397925.htmlpȝ是win764位,装好后,装了pl/sql 和toadQ都q不上数据库Q报错位“ql 无法解析指定的连接标识符” 解决办法Q我勒个去!马情况吗!很是郁闷Q经q研I发现安装目录有问题。默认会(x)安装?#8220;C:\Program Files (x86)”q个目录下,Q以前有I格也没问题Qv初没在意Q后来经q研I发玎ͼ实是目录的问题Q括可pl/sql不爽了。于是乎Qpl/sql让我也不爽了Q。?/p>

记录下,解决了,现在很爽。?/p>

 

PSQ如果遇到此问题Q不用重装pl/sqlQ只需其UdQ最好copyQ到其他没有I格Q没有特D字W的目录下就ok了!



kxbin 2013-04-16 16:25 发表评论
]]>
oracle SQL语句执行步骤http://m.tkk7.com/kxbin/articles/388764.htmlkxbinkxbinFri, 28 Sep 2012 03:28:00 GMThttp://m.tkk7.com/kxbin/articles/388764.htmlhttp://m.tkk7.com/kxbin/comments/388764.htmlhttp://m.tkk7.com/kxbin/articles/388764.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/388764.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/388764.htmloracle SQL语句执行步骤

Oracle中SQL语句执行q程?Oracle内部解析原理如下:

  1、当一用户W一ơ提交一个SQL表达式时,Oracle?x)将qSQLq行Hard parse,q过E有点像E序~译,查语法、表名、字D名{相关信息(如下图)Q这q程?x)花比较长的旉Q因为它要分析语句的语法与语义。然后获得最优化后的执行计划Qsql planQ,q在内存中分配一定的I间保存该语句与对应的执行计划等信息?/span>

  2、当用户W二ơ请求或多次hӞOracle?x)自动找到先前的语句与执行计划,而不?x)进行Hard parse,而是直接q行Soft parseQ把语句对应的执行计划调出,然后执行Q?从而减数据库的分析时间?/span>

  注意的是QOracle中只能完全相同的语句Q包大小写、空根{换行都要求一hQ才?x)重复用以前的分析l果与执行计划?/span>

  分析q程如下图:(x)


  对于大量的、频J访问的SQL语句Q如果不采用Bind 变量的方式,哪Oracle?x)花费大量的Shared latch与CPU在做Hard parse处理Q所以,要尽量提高语句的重用率,减少语句的分析时_(d)通过了解Oracle SQL语句的分析过E可以明白Oracle的内部处理逻辑Qƈ在设计与实现上避免?/span>

  在用JDBC或其它持久化数据(如Hibernate,JDO{?操作Ӟ量用占位符Q?Q?/span>

  

ORACLE sql 的处理过E大致如下:(x)
 1.
q用HASH法Q得C?/span>HASH|q个值可以通过V$SQLAREA.HASH_VALUE 查看
 2.
?/span>shared pool 中的 library cache 中查找是否有相同?/span>HASH|如果存在Q则无需解析,q行软解?/span>
 3.
如果shared pool不存在此HASH|则进行语法检查,查看是否有语法错?/span>
 4.
如果没有语法错误Q就q行语义查,查该SQL引用的对象是否存在,该用h否具有访问该对象的权?/span>
 5.
如果没有语义错误Q对?/span>SQLq行解析Q生成解析树(wi)Q执行计?/span>
 6.
生成ORACLE能运行的二进制代码,q行该代码ƈ且返回结果给用户
解析和软解析都在第5步进?/span>
解析通常是昂늚操作Q大U占整个SQL执行?/span>70%左右的时_(d)解析会(x)生成执行?wi),执行计划Q等{?/span>
当再ơ执行同一?/span>SQL语句的时候,׃发现library cache中有相同?/span>HASH|q个时候不?x)硬解析Q而会(x)软解析,
那么软解析究竟是q了什么呢?其实软解析就是蟩q了生成解析?wi),生成执行计划q个耗时又?/span>CPU的操作,直接利用生成的执行计划运?/span>
?/span>SQL语句?/span>
下面摘抄eygle深入解析ORACLE 中关?/span>SQL执行q程的描q?/span>
  1.
首先获得library cache latch,Ҏ(gu)SQL?/span>HASH_VALUE?/span>library cache中查找是否存在此HASH_VALUEQ如果找到这?/span>HASH_VALUEQ称之ؓ(f)软解析,Server获得?/span>SQL执行计划转向W?/span>4步,如果找不到共享代码就q行解析?/span>
  2.
释放library pool cache,获得shared pool latch,查找q定自q?/span>(?/span>bucket 中查?/span>chunk)。如果找不到Q报ORA-04031错误
  3.
释放shared pool latch,重新获得library cache latch,?/span>SQL执行计划攑օlibrary cache中?/span>
  4.
释放library cache latch,保持null模式?/span>library cache pin/lock.
  5.
开始执行?/span>
Library cache latch
可以理解为硬/软解析的时候发生的Q因析的时候会(x)搜烦library cacheQ所以会(x)产生library cache latch
Library cache pin
是在执行的阶D发生的?/span>



kxbin 2012-09-28 11:28 发表评论
]]>
linux oracle10g安装http://m.tkk7.com/kxbin/articles/388272.htmlkxbinkxbinFri, 21 Sep 2012 08:49:00 GMThttp://m.tkk7.com/kxbin/articles/388272.htmlhttp://m.tkk7.com/kxbin/comments/388272.htmlhttp://m.tkk7.com/kxbin/articles/388272.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/388272.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/388272.html一、安装系l?/strong>
首先安装LinuxpȝQ根据Oracle官方文档的徏议,在机器内存小?G的情况下Qswap分区大小应该讄为内存的2倍大Q若内存大于2G则swap分区讄Z内存大小一栗?/div>
为防止Oracle安装q程中出Cؕ码,使用英文作ؓ(f)pȝ语言Q进行Oracle的安装工?/div>
二、安装Oracle前的pȝ准备工作
1.查需要的软g?/strong>
可以使用rpm -qa|grep 软g包关键词命o(h)q行,一般情况下?x)需要手动安装如下的软g包:(x)
  From RedHat AS5 Disk 1Q?2 BitQ?/div>
  # rpm -Uvh setarch-2* 
  # rpm -Uvh make-3* 
  # rpm -Uvh glibc-2* 
  # rpm -Uvh libaio-0*
  From RedHat AS5 Disk 2Q?2 BitQ?/div>
  # rpm -Uvh compat-libstdc -33-3* 
  # rpm -Uvh compat-gcc-34-3* 
  # rpm -Uvh compat-gcc-34-c -3* 
  # rpm -Uvh gcc-4* 
  # rpm -Uvh libXp-1*
  From RedHat AS5 Disk 3Q?2 BitQ?/div>
  # rpm -Uvh openmotif-2* 
  # rpm -Uvh compat-db-4*
如果使用DVD安装介质的话Q会(x)很方ѝ?/div>
2.修改Linux发行版本信息
׃Oracle 10g发行的时候,RedHat Enterprise Linux 5没有发行Q所以Oracle 10gq没有对RedHat Enterprise Linux 5认支持Q我们有两种Ҏ(gu)可以让Oracle 10g支持RedHat Enterprise Linux 5?/div>
Ҏ(gu)一Q?/strong>
我们需要手工修改Linux的发行注讎ͼ让Oracle 10g支持RedHat Enterprise Linux 5?/div>
~辑/etc/redhat-release文g
# vi /etc/redhat-release
其中的内容Red Hat Enterprise Linux Server release 5 (Tikanga)修改为Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Ҏ(gu)二:(x)
q有文章说修改Oracle安装包中install/oraparam.ini文g的内容,也可以让Oracle 10g支持RedHat Enterprise Linux 5Q修Ҏ(gu)法如下:(x)
# vi install/oraparam.ini
在其中的Certified VersionsD落增加redhat-5
#[Certified Versions] 
Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2]
再添?nbsp;
[Linux-redhat-5.0-optional] 
TEMP_SPACE=80 
SWAP_SPACE=150 
MIN_DISPLAY_COLORS=256
l我试Q发现方法二在安装之前的pȝ过E可以通过Q但是在安装q程中的pȝ支持无法通过Q不知道是不是我讄的有问题Q希望有高手可以l我Ҏ(gu)C?/div>
3.修改pȝ内核参数
# vi /etc/sysctl.conf
kernel.shmall = 2097152                    //  该参数表C系l一ơ可以用的׃n内存总量Q以ؓ(f)单位Q。缺省值就?097152Q通常不需要修改kernel.shmmax = 2147483648            //  该参数定义了׃n内存D늚最大尺寸(以字节ؓ(f)单位Q。缺省ؓ(f)32MQ对于oracle来说Q该~省值太低了Q通常其讄?G 
kernel.shmmni = 4096                       //  q个内核参数用于讄pȝ范围内共享内存段的最大数量。该参数的默认值是 4096 。通常不需要更?nbsp;
kernel.sem = 250 32000 100 128        //  表示讄的信号量 
fs.file-max = 65536                            //  表示文g句柄的最大数量。文件句柄设|表C在linuxpȝ中可以打开的文件数?nbsp;
net.ipv4.ip_local_port_range = 1024 65000 
net.core.rmem_default=262144        //  默认的接收窗口大?nbsp;
net.core.rmem_max=262144             //  接收H口的最大大?nbsp;
net.core.wmem_default=262144      //  默认的发送窗口大?nbsp;
net.core.wmem_max=262144           //  发送窗口的最大大?/div>
修改好内核参数后Q执行如下命令新的讄生效
# /sbin/sysctl -p
4.创徏Oracle用户、组、安装目?/strong>
在这里我只讨论单L环境Q不考虑RAC环境的配|,在以后我?x)专门写一如何配|Oracle RAC环境的文章?/div>
(1) 创徏Oracle用户l?/div>
# groupadd oinstall 
# groupadd dba
(2) 创徏Oracle用户
# useradd -m -g oinstall -G dba oracle
(3) 讄Oracle用户口o(h)
# passwd oracle
(4) 创徏Oracle安装目录以及数据存放目录
# mkdir -p /DBSoftware/app/oracle 
# mkdir -p /DBData/oradata
(5) 修改目录权限
# chown -R oracle:oinstall /DBSoftware/app/oracle/ /DBData/oradata/ 
# chmod -R 755 /DBSoftware/app/oracle/ /DBData/oradata/
5.d以下内容?etc/security/limits.conf
# vi /etc/security/limits.conf
oracle soft nproc 2047 
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536
6.d以下内容?etc/pam.d/login
# vi /etc/pam.d/login
session required /lib/security/pam_limits.so 
session required pam_limits.so
7.d以下内容?etc/profile
# vi /etc/profile
if [ $USER = "oracle" ]; then 
    if [ $SHELL = "/bin/ksh" ]; then 
        ulimit -p 16384 
        ulimit -n 65536 
    else 
        ulimit -u 16384 -n 65536 
    fi 
fi
8.配置LinuxL
?etc/hosts文g中是否有localhost的记录(指向127.0.0.1卛_Q,若没有的话,在后面配|Oracle监听的时候会(x)出现一些问题,D无法启动监听Q在此手工添加此记录卛_?/div>
9.配置oracle用户环境变量
# su - oracle 
$ vi ~/.bash_profile
增加如下内容Q?/div>
export ORACLE_BASE=/DBSoftware/app/oracle   // 上面创徏的Oracle安装文g?nbsp;
export ORACLE_SID=orcl 
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin 
export LD_LIBARY_PATH=$ORACLE_HOME/lib
export PATH 
umask 022
保存后用如下命令,使设|生效:(x)
$ source ~/.bash_profile
三、安装OracleQƈq行相关讄
1.解压~安装文?/strong>
Oracle的安装包有这样几U格式:(x)
(1) zip      10201_database_linux32.zip
q种格式最好解压羃Q直接用命令unzip 文g名即?/div>
(2) cpio.gz
q种格式有这样几U解压羃方式
a.  # zcat XXXX.cpio.gz | cpio -idmv 
b.  # gunzip XXXX.cpio.gz解压出XXXX.cpio文g然后?# cpio -idvm < XXXX.cpio
解压~完成后Q设|oracle帐户可以操作安装文g所在的目录
chown -R oracle:oinstall 安装文g所在目?/div>
2. 用oracle帐户q入安装文g所在目录,执行如下命o(h)卛_看到安装界面Q?/strong>
$ ./runInstaller
如果无法看到安装界面Q请使用root帐户执行如下命o(h)后再q行安装E序Q?/div>
# export DISPLAY=:0.0 
# xhost + 
$ ./runInstaller
出现安装界面后,Ҏ(gu)界面提示q行相关的设|,我的是在安装q程中不创徏数据库,只安装程序,监听和创建数据库{安装完成后再进行相关的操作?/div>
安装q程中,需要用root权限执行两个脚本?/div>
 

 

   

 

3. 安装完成后,?etc/redhat-release文g中的内容修改回Red Hat Enterprise Linux Server release 5 (Tikanga)
4.创徏监听以及创徏数据?/strong>
(1) 创徏监听E序
使用Oracle提供的NET CONFIGURATION ASSISTANT创徏TNS监听
$ netca
基本上就是一直Next可以了Q当然你也可以在q期间修改TNS的监听端口号
TNS监听创徏完成后可以用如下命令进行检查:(x)
# netstat -atln    查监听端口是否打开 
$ lsnrctl status    查TNS监听状?/div>
认监听已经成功启动后,卛_执行Database Configure Assistantq行数据库的创徏Q执行命令如下:(x)
$ dbca
在创建数据库的过E中Q徏议将数据库的字符集设|ؓ(f)Unicode UTF-8Q防止出Cؕ码?/div>
四、数据库的启动脚本(转蝲?a style="padding: 0px; margin: 0px; color: #015f91; text-decoration: none; ">[url]http://82584.blog.51cto.com/72584/110131[/url]Q?/strong>
# vi /etc/rc.d/init.d/oracle
================================ Script File Start ================================ 
 
#!/bin/bash 

# chkconfig: 35 95 1 
# description: init script to start/stop oracle database 10g, TNS listener, EMS 
# match these values to your environment:
export ORACLE_BASE=/DBSoftware/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=/u01/app/oracle/bin:$ORACLE_HOME/bin:$PATH 
export ORACLE_SID=orcl 
export ORACLE_USER=oracle
# see how we are called: 
case $1 in 
    start) 
        su - "$ORACLE_USER"<<EOO 
        lsnrctl start 
        sqlplus /nolog<<EOS 
        connect / as sysdba 
        startup 
    EOS 
    emctl start dbconsole 
    EOO 
    touch /var/lock/subsys/$scriptname 
    ;; 
    stop) 
        su - "$ORACLE_USER"<<EOO 
        lsnrctl stop 
        sqlplus /nolog<<EOS 
        connect / as sysdba 
        shutdown immediate 
    EOS 
    emctl stop dbconsole 
    EOO 
    rm -f /var/lock/subsys/scriptname 
    ;; 
*) 
echo "Usage: $0 {start|stop}" 
;; 
esac
================================ Script File End ================================
授权 Qchown root.root /etc/rc.d/init.d/oracle
修改文g属性:(x)chmod 755 /etc/rc.d/init.d/oracle
以后启动/关闭Oracle可以使用如下命o(h)操作Q?/div>
# service oracle start     //  启动监听、数据库以及em 
# service oracle stop      //  关闭监听、数据库以及em
当然你也可以把Oracle作ؓ(f)pȝ服务Q随pȝ启动{等?/div>


kxbin 2012-09-21 16:49 发表评论
]]>
ORACLE锁机?/title><link>http://m.tkk7.com/kxbin/articles/388188.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Thu, 20 Sep 2012 07:25:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/388188.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/388188.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/388188.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/388188.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/388188.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">数据库是一个多用户使用的共享资源。当多个用户q发地存取数据时Q在数据库中׃(x)产生多个事务同时存取同一数据的情c若对ƈ发操作不加控制就可能?x)读取和存储不正的数据Q破坏数据库的一致性?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">加锁是实现数据库q发控制的一个非帔R要的技术。当事务在对某个数据对象q行操作前,先向pȝ发出hQ对其加锁。加锁后事务对该数据对象有了一定的控制Q在该事务释N之前Q其他的事务不能Ҏ(gu)数据对象q行更新操作?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">在数据库中有两种基本的锁cdQ排它锁QExclusive LocksQ即X锁)和共享锁QShare LocksQ即S锁)。当数据对象被加上排它锁Ӟ其他的事务不能对它读取和修改。加了共享锁的数据对象可以被其他事务dQ但不能修改。数据库利用q两U基本的锁类型来Ҏ(gu)据库的事务进行ƈ发控制?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">Oracle数据库的锁类?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">Ҏ(gu)保护的对象不同,Oracle数据库锁可以分ؓ(f)以下几大c:(x)DML锁(data locksQ数据锁Q,用于保护数据的完整性;DDL锁(dictionary locksQ字兔RQ,用于保护数据库对象的l构Q如表、烦引等的结构定义;内部锁和闩(internal locks and latchesQ,保护 数据库的内部l构?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">DML锁的目的在于保证q发情况下的数据完整性,。在Oracle数据库中QDML锁主要包括TM锁和TX锁,其中TM锁称U锁QTX锁称Z务锁或行U锁?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">当Oracle执行DML语句Ӟpȝ自动在所要操作的表上甌TMcd的锁。当TM锁获得后Q系l再自动甌TXcd的锁Qƈ实际锁定的数据行的锁标志位q行|位。这样在事务加锁前检查TX锁相Ҏ(gu)时׃用再逐行查锁标志Q而只需查TM锁模式的相容性即可,大大提高了系l的效率。TM锁包括了SS、SX、S、X {多U模式,在数据库中用0Q?来表C。不同的SQL操作产生不同cd的TM锁?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">在数据行上只有X锁(排他锁)。在Oracle数据库中Q当一个事务首ơ发起一个DML语句时就获得一个TX锁,该锁保持C务被提交或回滚。当两个或多个会(x)话在表的同一条记录上执行 DML语句ӞW一个会(x)话在该条记录上加锁,其他的会(x)话处于等待状态。当W一个会(x)话提交后QTX锁被释放Q其他会(x)话才可以加锁?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">当Oracle数据库发生TX锁等待时Q如果不及时处理常常?x)引起Oracle数据库挂P或导致死锁的发生Q生ORA-60的错误。这些现象都?x)对实际应用产生极大的危宻I如长旉未响应,大量事务p|{?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">(zhn)观锁和乐观封?nbsp;<br />一、?zhn)观封?nbsp;<br />锁在用户修改之前发挥作用:(x) <br />Select ..for updateQnowait) <br />Select * from tab1 for update <br />用户发出q条命o(h)之后Qoracle会(x)对返回集中的数据建立行񔞮锁Q以防止其他用户的修攏V?nbsp;<br />如果此时其他用户对上面返回结果集的数据进行dml或ddl操作都会(x)q回一个错误信息或发生d?nbsp;<br />1Q对q回l果集进行update或delete操作?x)发生阻塞?nbsp;<br />2Q对该表q行ddl操作会(x)报:(x)Ora-00054:resource busy and acquire with nowait specified.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">原因分析 <br />此时Oracle已经对返回的l果集上加了排它的行U锁Q所有其他对q些数据q行的修Ҏ(gu)删除操作都必ȝ待这个锁的释放,产生的外在现象就是其他的操作发生阻塞,q个q个操作commit或rollback. <br />同样q个查询的事务将?x)对该表加表U锁Q不允许对该表的Mddl操作Q否则将?x)报出ora-00054错误Q?resource busy and acquire with nowait specified.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">二、乐观封?nbsp;<br />乐观的认为数据在select出来到updateq取q提交的q段旉数据不会(x)被更攏V这里面有一U潜在的危险是׃被选出的结果集q没有被锁定Q是存在一U可能被其他用户更改的可能。因此Oracle仍然是用(zhn)观锁Q因样会(x)更安全?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; "><br />d</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">定义Q?nbsp;<br />当一个会(x)话保持另一个会(x)话正在请求的资源上的锁定Ӟ׃(x)发生d。被d的会(x)话将一直挂P直到持有锁的?x)话攑ּ锁定的资源?f)止?个常见的dml语句?x)生阻?nbsp;<br />INSERT <br />UPDATE <br />DELETE <br />SELECT…FOR UPDATE</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; "><br />INSERT</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">Insert发生d的唯一情况是用户拥有一个徏有主键约束的表。当2个的?x)话同时试图向表中插入相同的数据Ӟ其中的一个会(x)话将被阻塞,直到另外一个会(x)话提交或?x)滚。一个会(x)话提交时Q另一个会(x)话将收到主键重复的错误。回滚时Q被d的会(x)话将l箋执行?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">UPDATE 和DELETE当执行Update和delete操作的数据行已经被另外的?x)话锁定Ӟ?x)发生dQ直到另一个会(x)话提交或?x)滚?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">Select …for update</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">当一个用户发出select..for update的错作准备对q回的结果集q行修改Ӟ如果l果集已l被另一个会(x)话锁定,是发生d。需要等另一个会(x)话结束之后才可l执行。可以通过发出 select… for update nowait的语句来避免发生dQ如果资源已l被另一个会(x)话锁定,则会(x)q回以下错误QOra-00054:resource busy and acquire with nowait specified.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">死锁-deadlock</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">定义:当两个用户希望持有对方的资源时就?x)发生死? <br />即两个用户互相等待对斚w放资源时,oracle认定Z生了死锁,在这U情况下,以牺牲一个用户作Z?另一个用L(fng)l执?牺牲的用L(fng)事务回? <br />例子Q?nbsp;<br />1Q用?对A表进行UpdateQ没有提交?nbsp;<br />2Q用?对B表进行UpdateQ没有提交?nbsp;<br />此时双反不存在资源共享的问题?nbsp;<br />3Q如果用?此时对A表作update,则会(x)发生dQ需要等到用户一的事物结束?nbsp;<br />4Q如果此时用?又对B表作updateQ则产生死锁。此时Oracle?x)选择其中一个用戯行会(x)滚,使另一个用L(fng)l执行操作?nbsp;<br />起因: <br />Oracle的死锁问题实际上很少见,如果发生Q基本上都是不正的E序设计造成的,l过调整后,基本上都?x)避免死锁的发生?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">DML锁分c表</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; "><br />?Oracle的TM锁类?nbsp;<br />锁模?锁描q?解释 SQL操作 <br />0 none <br />1 NULL I?Select <br />2 SS(Row-S) 行׃n锁,其他对象 <br />只能查询q些数据?Select for update、Lock for</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">update、Lock row share</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">3 SX(Row-X) 行排它锁, <br />在提交前不允许做DML操作 Insert、Update?nbsp;<br />Delete、Lock row share</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">4 S(Share) ׃n?Create index、Lock share <br />5 SSX(S/Row-X) ׃n行排它?Lock share row exclusive <br />6 X(Exclusive) 排它?Alter table、Drop able、Drop index、Truncate table 、Lock exclusive</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">oracle 锁问题的解决</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; "><br />可以用Spotlight软gҎ(gu)据库的运行状态进行监控?/p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">当出现session锁时Q我们要及时q行处理.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">1. 查看哪些session? <br />SQL语句Qselect 'alter system kill session '''||sid||','||serial#||''';' from v$session where sid in (select sid from v$lock where block = 1);</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">SQL> select 'alter system kill session '''||sid||','||serial#||''';' from v$session where sid in (select sid from v$lock where block = 1); <br />'ALTERSYSTEMKILLSESSION'''||SID||','||SERIAL#||''';' <br />-------------------------------------------------------------------------------- <br />alter system kill session '132,731'; <br />alter system kill session '275,15205'; <br />alter system kill session '308,206'; <br />alter system kill session '407,3510';</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">2. 查看session? <br />sql语句Qselect s.sid, q.sql_text from v$sqltext q, v$session s <br />where q.address = s.sql_address <br />and s.sid = &sid <br />order by piece;</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">SQL> select s.sid,q.sql_text from v$sqltext q, v$session s where q.address = s.sql_address and s.sid in (select sid from v$lock where block = 1) order by piece; <br />        SID SQL_TEXT <br />---------- ---------------------------------------------------------------- <br />       77 UPDATE PROFILE_USER SET ID=1,COMPANY_ID=2,CUSTOMER_ID=3,NAMED   <br />       77 _INSURED_ID=4,LOGIN=5,ROLE_ID=6,PASSWORD=7,EMAIL=8,TIME_ZON <br />       77 E=9 WHERE PROFILE_USER.ID=:34 <br />3 rows selected.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; "><br />3. kill锁的q程. <br />SQL语句Qalter system kill session '77,22198';</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">SQL> alter system kill session '391,48398'; <br />System altered.</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">4. 查看谁锁了谁?br />select s1.username || [email='@']'@'[/email] || s1.machine<br />  || ' ( SID=' || s1.sid || ' )  is blocking '<br />  || s2.username || [email='@']'@'[/email] || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status<br />  from v$lock l1, v$session s1, v$lock l2, v$session s2<br />  where s1.sid=l1.sid and s2.sid=l2.sid<br />  and l1.BLOCK=1 and l2.request > 0<br />  and l1.id1 = l2.id1<br />  and l2.id2 = l2.id2 ;</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">注:(x) <br />> Q?重定向输出,文件的标准输出重新定向输出到文Ӟ或将数据文g作ؓ(f)另一E序的标准输入内宏V?nbsp;<br />| QUNIX道Q将一文g的输Z为另一文g的输?</p><p style="color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; line-height: 23px; background-color: #d6d3d6; ">在执行SQL语句试:(x)alter system kill session '391,48398'(sid?91); 应当注意对于sid?00以下的应当}慎,可能该进E对应某个applicationQ如对应某个事务,可以kill.</p><div></div><img src ="http://m.tkk7.com/kxbin/aggbug/388188.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-20 15:25 <a href="http://m.tkk7.com/kxbin/articles/388188.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle 数据库实例启动关闭过E?/title><link>http://m.tkk7.com/kxbin/articles/388185.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Thu, 20 Sep 2012 06:59:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/388185.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/388185.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/388185.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/388185.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/388185.html</trackback:ping><description><![CDATA[     摘要: 转蝲自http://blog.csdn.net/robinson_0612/article/details/5542983-->Oracle 数据库实例启动关闭过E?-================================/*    Oracle数据库实例的启动Q严格来说应该是实例的启动,数据库仅仅是在实例启动后q行装蝲。Oracl...  <a href='http://m.tkk7.com/kxbin/articles/388185.html'>阅读全文</a><img src ="http://m.tkk7.com/kxbin/aggbug/388185.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-20 14:59 <a href="http://m.tkk7.com/kxbin/articles/388185.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle for update和for update nowait的区别(二)http://m.tkk7.com/kxbin/articles/388099.htmlkxbinkxbinWed, 19 Sep 2012 14:28:00 GMThttp://m.tkk7.com/kxbin/articles/388099.htmlhttp://m.tkk7.com/kxbin/comments/388099.htmlhttp://m.tkk7.com/kxbin/articles/388099.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/388099.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/388099.htmlҎ(gu)区别Q?br />  select * from TTable1 for update 锁定表的所有行Q只能读不能?br />  2  select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行
  3  select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定两个表的所有记?br />  4 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满x件的?br />  5. select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update of a.pkid 只锁定Table1中满x件的?br />  for update 是把所有的表都锁点 for update of Ҏ(gu)of 后表的条仉定相对应的表
  -----------
  关于NOWAIT(如果一定要用FOR UPDATEQ我更徏议加上NOWAIT)
  当有LOCK冲突时会(x)提示错误q结束STATEMENT而不是在那里{待(比如:要查的行已经被其它事务锁?当前的锁事务与之冲突,加上nowait,当前的事务会(x)l束?x)提C错误ƈ立即l束 STATEMENT而不再等?.
  如果加了for update?该语句用来锁定特定的行(如果有where子句Q就是满where条g的那些行Q。当q些行被锁定后,其他?x)话可以选择q些行,但不能更Ҏ(gu)删除q些行,直到该语句的事务被commit语句或rollback语句l束为止?br />  因ؓ(f)FOR   UPDATE子句获得了锁Q所以COMMIT释放这些锁。当锁释放了Q该游标无效了?br />  是q些区别?br /> 
关于oracle中的select...for update of columns
问题Q如下:(x)select * from emp where empno = 7369 for update; ?x)对表中员工~号?369的记录进行上锁。其他用h法对该记录进行操作,只能查询。select * from emp where empno = 7369 for update of sal; q条语句是不是意味着只对表中?369 q一行的sal字段的数据进行了上锁Q其他数据则可以被其他用户做更新操作呢。学员测试结果ؓ(f)二条语句的效果是一L(fng)。其他用户对整行都无法更斎ͼ那么是不是意味着 for update of columnsq句没有什么意义呢Q?/p>

  q个问题估计很多玩ORACLE的同学们都没有去思考过【网上相关的帖子不多】。现在将其功能讲解一下?/p>

  从单独一张表的操作来看,上面二条语句的效果确实是相同的。但是如果涉及到多表操作的时?for update of columnspvC非常大的作用了。现假定有二个用Pscott和mm?/p>

scott执行语句Qselect * from emp e,dept d where e.deptno = d.deptno for update; --对二张表都进行了整表锁定
mm执行语句Qselect * from scott.dept for update wait 3; --试图锁定scott用户的dept?/p>

l果是:(x)
ERROR 位于W?1 ?
ORA-30006: 资源已被占用; 执行操作时出?WAIT 时

现在Qscott用户先进行解锁rollback,再在for update语句后面加上of columnsQ进行测?/p>

scott执行语句Qselect * from emp e,dept d where e.deptno = d.deptno for update of sal ;
mm执行语句Qselect * from scott.dept for update wait 3;

l果是:(x)
成功锁定了dept表的数据.

mm再次执行语句Qselect * from scott.emp for update wait 3;

l果是:(x)
ERROR 位于W?1 ?
ORA-30006: 资源已被占用; 执行操作时出?WAIT 时

通过q段代码案例Q我们可以得到结论,for update of columns 用在多表q接锁定Ӟ可以指定要锁定的是哪几张表,而如果表中的列没有在for update of 后面出现的话Q就意味着q张表其实ƈ没有被锁定,其他用户是可以对q些表的数据q行update操作的。这U情늻怼(x)出现在用户对带有q接查询的视图进行操作场景下。用户只锁定相关表的数据Q其他用户仍然可以对视图中其他原始表的数据来q行操作?br /> 
Oracle 的for update行锁
 SELECT...FOR UPDATE 语句的语法如下:(x)
  SELECT ... FOR UPDATE [OF column_list][WAIT n|NOWAIT][SKIP LOCKED];
其中Q?br />  OF 子句用于指定卛_更新的列Q即锁定行上的特定列?br />  WAIT 子句指定{待其他用户释放锁的U数Q防止无限期的等待?br />  “使用FOR UPDATE WAIT”子句的优点如下:(x)
  Q防止无限期地等待被锁定的行Q?br />  Q允许应用程序中寚w的等待时间进行更多的控制?br />  Q对于交互式应用E序非常有用Q因些用户不能等待不定
  Q?若用了skip lockedQ则可以过锁定的行Q不?x)报告由wait n 引发?#8216;资源?#8217;异常报告

CZ:
create table t(a varchar2(20),b varchar2(20));
insert into t values('1','1');
insert into t values('2','2');
insert into t values('3','3');
insert into t values('4','4');
现在执行如下操作Q?br />在plsql develope中打开两个sqlH口Q?br />?H口中运行sql
select * from t where a='1' for update;
?H口中运行sql1
1. select * from t where a='1'; q一炚w题也没有Q因U锁不会(x)影响Ua的select语句
再运行sql2
2. select * from t where a='1' for update; 则这一句sql在执行时Q永q处于等待状态,除非H口1中sql被提交或回滚?br />如何才能让sql2不等待或{待指定的时间呢Q?我们再运行sql3
3. select * from t where a='1' for update nowait; 则在执行此sqlӞ直接报资源忙的异常?br />若执?select * from t where a='1' for update wait 6; 则在{待6U后Q报 资源忙的异常?br />如果我们执行sql4
4. select * from t where a='1' for update nowait skip Locked; 则执行sqlӞ即不{待Q也不报资源忙异常?br />现在我们看看执行如下操作会(x)发生什么呢Q?br />在窗?中执行:(x)
select * from t where rownum<=3 nowait skip Locked;
在窗?中执行:(x)
select * from t where rownum<=6 nowait skip Locked;
select for update 也就如此了吧Qinsert、update、delete操作默认加行U锁Q其原理和操作与select for updateq无两样?br />select for update ofQ这个of子句在牵q到多个表时Q具有较大作用,如不使用of指定锁定的表的列Q则所有表的相兌均被锁定Q若在of中指定了需修改的列Q则只有与这些列相关的表的行才会(x)被锁定?/p>

kxbin 2012-09-19 22:28 发表评论
]]>
oracle for update和for update nowait的区别(一Q?/title><link>http://m.tkk7.com/kxbin/articles/388098.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 19 Sep 2012 14:20:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/388098.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/388098.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/388098.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/388098.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/388098.html</trackback:ping><description><![CDATA[<div><p>1<span style="font-family:宋体;Times New Roman";Times New Roman"">?/span>for update <span style="font-family:宋体;Times New Roman";Times New Roman"">?/span> for update nowait <span style="font-family:宋体;Times New Roman";Times New Roman"">的区别:(x)</span></p> <p> <span style="font-family: 宋体; ">首先一点,如果只是</span>select <span style="font-family: 宋体; ">的话Q?/span>Oracle<span style="font-family: 宋体; ">是不?x)加M锁的Q也是</span>Oracle<span style="font-family: 宋体; ">?/span> select <span style="font-family: 宋体; ">d的数据不?x)有M限制Q虽然这时候有可能另外一个进E正在修改表中的数据Qƈ且修改的l果可能影响C目前</span>select<span style="font-family: 宋体; ">语句的结果,但是因ؓ(f)没有锁,所?/span>select<span style="font-family: 宋体; ">l果为当前时刻表中记录的状态?/span></p> <p> <span style="font-family: 宋体; ">如果加入?/span>for update<span style="font-family: 宋体; ">Q?/span> <span style="font-family: 宋体; ">?/span>Oracle<span style="font-family: 宋体; ">一旦发玎ͼW合查询条g的)q批数据正在被修改,则不?x)发?/span>select<span style="font-family: 宋体; ">语句查询Q直到数据被修改l束Q被</span>commit<span style="font-family: 宋体; ">Q,马上自动执行q个</span>select<span style="font-family: 宋体; ">语句?/span></p> <p> <span style="font-family: 宋体; ">同样Q如果该查询语句发出后,有h需要修改这Ҏ(gu)据(中的一条或几条Q,它也必须{到查询l束后(</span>commit<span style="font-family: 宋体; ">Q后Q才能修攏V?/span></p> <p> for update nowait<span style="font-family: 宋体; ">?/span> for update <span style="font-family: 宋体; ">都会(x)Ҏ(gu)查询到得l果集进行加锁,所不同的是Q如果另外一个线E正在修改结果集中的数据Q?/span>for update nowait <span style="font-family: 宋体; ">不会(x)q行资源{待Q只要发现结果集中有些数据被加锁Q立刻返?/span> <span style="font-family: 宋体; ">“</span>ORA-00054<span style="font-family: 宋体; ">错误Q内Ҏ(gu)资源正忙</span>, <span style="font-family: 宋体; ">但指定以</span> NOWAIT <span style="font-family: 宋体; ">方式获取资源”?/span></p> <p> for update <span style="font-family: 宋体; ">?/span> for update nowait <span style="font-family: 宋体; ">加上的是一个行U锁Q也是只有W合</span>where<span style="font-family: 宋体; ">条g的数据被加锁。如果仅仅用</span>update<span style="font-family: 宋体; ">语句来更Ҏ(gu)据时Q可能会(x)因ؓ(f)加不上锁而没有响应地、莫名其妙地{待Q但如果在此之前Q?/span>for  update NOWAIT<span style="font-family: 宋体; ">语句要更改的数据试探性地加锁Q就可以通过立即q回的错误提C明白其中的道理Q或许这是</span>For Update<span style="font-family: 宋体; ">?/span>NOWAIT<span style="font-family: 宋体; ">的意义之所在?/span></p> <p> <span style="font-family: 宋体; ">l过试Q以</span>for update <span style="font-family: 宋体; ">?/span> for update nowait<span style="font-family: 宋体; ">方式q行查询加锁Q在</span>select<span style="font-family: 宋体; ">的结果集中,只要有Q何一个记录在加锁Q则整个l果集都在等待系l资源(如果?/span>nowait<span style="font-family: 宋体; ">Q则抛出相应的异常)</span></p> <p> </p> <p style="margin-left:6.0pt;line-height:18.0pt">2<span style="font-family:宋体;Times New Roman";Times New Roman"">?/span>for update nowait <span style="font-family:宋体;Times New Roman";Times New Roman"">?/span> for update <span style="font-family:宋体;Times New Roman";Times New Roman"">的目?/span>:<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">锁定表的所有行Q排斥其他针对这个表的写操作。确保只有当前事务对指定表进行写操作?/span><br /> for update nowait<span style="font-family: 宋体;Times New Roman";Times New Roman"">?/span> for update<span style="font-family:宋体;Times New Roman";Times New Roman"">的区别:(x)</span></p> <p style="margin-left:6.0pt;line-height:18.0pt"><span style="font-family:宋体;Times New Roman";Times New Roman"">别的事务要对q个表进行写操作Ӟ是等待一D|间还是马上就被数据库pȝ拒绝而返?/span>.<span style="font-family:宋体;Times New Roman";Times New Roman"">制定采用</span>nowait<span style="font-family:宋体;Times New Roman";Times New Roman"">方式来进行检索,所以当发现数据被别?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">锁定中的时候,׃(x)q速返?/span>ORA-00054<span style="font-family:宋体;Times New Roman";Times New Roman"">错误Q内Ҏ(gu)资源正忙</span>, <span style="font-family:宋体;Times New Roman";Times New Roman"">但指定以</span> NOWAIT <span style="font-family:宋体;Times New Roman";Times New Roman"">方式获取资源。所以在E序中我们可以采?/span>nowait<span style="font-family:宋体;Times New Roman";Times New Roman"">方式q速判断当前数据是否被锁定中,如果锁定中的话,p采取相应的业务措施进行处理?/span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">如何理解上面的话</span>.<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">开启一?x)?/span> (<span style="font-family:宋体;Times New Roman";Times New Roman"">是开一?/span>sqlwindow)<br />   select  empno,ename from emp for update nowait where empno='7369';<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">得到下面l果?/span>:<br />     empno  ename<br />     7369    smith<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">开启另一?x)?/span><br />   select empno,ename from emp for update nowait where empno="7369"<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">q回</span>RA-00054<span style="font-family:宋体;Times New Roman";Times New Roman"">错误Q内Ҏ(gu)资源正忙</span>, <span style="font-family:宋体;Times New Roman";Times New Roman"">但指定以</span> NOWAIT <span style="font-family:宋体;Times New Roman";Times New Roman"">方式获取资源</span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">上面?x)话都提?/span>commit;<br /> ~~~~~~~~~~~~~~~~~~~~~<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">开启一?x)?/span>,<br />   select  empno,ename from emp for update where empno='7369';<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">得到下面l果?/span>:<br />     empno  ename<br />     7369    smith<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">开启另一?x)?/span><br />   select empno,ename from emp for update  where empno="7369"<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">dQ不q回错误?/span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">提交W一个会(x)话,W二个回话自动执?/span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">提交W二个会(x)?/span><br /> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />    for update: <span style=" font-family:宋体;Times New Roman";Times New Roman"">当第一?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">最?/span>commit<span style="font-family:宋体;Times New Roman";Times New Roman"">或?/span>rollback<span style="font-family:宋体;Times New Roman";Times New Roman"">之后Q第二个</span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">中的索结果就是自动蟩出来Qƈ且也把数据锁定住</span>.<br />   <span style="font-family:宋体;Times New Roman";Times New Roman"">开启一?x)话Q?/span><br />      select empno,ename from emp for update  where empno="7369"<span style="font-family:宋体;Times New Roman";Times New Roman"">Q?/span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">得到下面l果?/span>:<br />     empno  ename<br />     7369    smith<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">开启另一个会(x)话,</span><br />    update emp set ename='ALLEN'  where empno="7396";<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">d?/span><br />   <span style="font-family:宋体;Times New Roman";Times New Roman"">提交W一个会(x)话,</span>update <span style="font-family:宋体;Times New Roman";Times New Roman"">语句执行</span><br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">在开启一?x)?/span><br />     update emp set ename="SMITH" where empno='7396';<br /> <span style="font-family:宋体;Times New Roman";Times New Roman"">同样dQ虽然第一个会(x)话因为提交而释放了锁,但是W二个会(x)话中?/span>update <span style="font-family:宋体;Times New Roman";Times New Roman"">又给q一行加锁了</span>;<br />for update nowait:<span style="font-family: 宋体;Times New Roman";Times New Roman"">当你W一?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">攑ּ锁定以后</span>,<span style=" font-family:宋体;Times New Roman";Times New Roman"">W二?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">才能正常q行。当你第二个</span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">语句q行后,数据又被你第二个</span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">语句锁定住了Q这个时候只要你W二?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">语句后还没有</span>commit<span style="font-family:宋体;Times New Roman";Times New Roman"">Q别?/span>session<span style="font-family:宋体;Times New Roman";Times New Roman"">照样不能Ҏ(gu)据进行锁定更新等{?/span><br /></p></div><img src ="http://m.tkk7.com/kxbin/aggbug/388098.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-19 22:20 <a href="http://m.tkk7.com/kxbin/articles/388098.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle10g安装?1g的ODAC后,PL/SQLq接提示TNSQ无法解析指定的q接标识W?/title><link>http://m.tkk7.com/kxbin/articles/388014.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Tue, 18 Sep 2012 10:30:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/388014.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/388014.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/388014.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/388014.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/388014.html</trackback:ping><description><![CDATA[<p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; "><span style="font-size: 13px; ">  安装完成以后Q用PL/SQLd试原有的数据库Q竟然提C?#8220;TNSQ无法解析指定的q接标识W?#8221;错误?/span></p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  查了相关资料Q?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  首先Q?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  在D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\LISTENER.ORA文g头部加入q一?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  DIRECT_HANDOFF_TTC_LISTENER = OFF</p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  执行以下命o(h)重启监听?</p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  -------------------------------------------------------------------</p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  lsnrctl stop<br />  lsnrctl start</p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  其次Q?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  打开PL/SQL 在工?#8212;—首选项——q接Q右侧窗?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  在Oracleȝ录名中选择服务器版本安装\径:(x)OraDb10g_home1</p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  点击定后,关闭PL/SQLH口Q重新打开后原有配|的数据库登陆成功?/p><p style="font-size: 13px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; background-color: #ffffff; ">  但是在EF实现中还是没有出现Oracleq接驱动Q尚不清楚什么原因,后箋再去解决?/p><img src ="http://m.tkk7.com/kxbin/aggbug/388014.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-18 18:30 <a href="http://m.tkk7.com/kxbin/articles/388014.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE常用命o(h)http://m.tkk7.com/kxbin/articles/388010.htmlkxbinkxbinTue, 18 Sep 2012 10:01:00 GMThttp://m.tkk7.com/kxbin/articles/388010.htmlhttp://m.tkk7.com/kxbin/comments/388010.htmlhttp://m.tkk7.com/kxbin/articles/388010.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/388010.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/388010.html阅读全文

kxbin 2012-09-18 18:01 发表评论
]]>
Oracle同义词创建及其作?/title><link>http://m.tkk7.com/kxbin/articles/388003.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Tue, 18 Sep 2012 09:46:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/388003.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/388003.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/388003.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/388003.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/388003.html</trackback:ping><description><![CDATA[<p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">Oracle的同义词QsynonymsQ从字面上理解就是别名的意思,和试囄功能cMQ就是一U映关pR本文介l如何创建同义词语句Q删除同义词以及查看同义词语句?br />  oracle的同义词ȝQ?br />  从字面上理解是别名的意思,和试囄功能cM。就是一U映关pR?br />  1.创徏同义词语句:(x)</p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  create public synonym table_name for user.table_name;</p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  其中W一个user_table和第二个user_table可以不一栗?br />  此外如果要创Z个远E的数据库上的某张表的同义词Q需要先创徏一个Database Link(数据库连?来扩展访问,然后在用如下语句创建数据库同义词:(x)create synonym table_name for<a href="mailto:table_name@DB_Link" style="color: #333333; text-decoration: none; ">table_name@DB_Link</a>;<br />  当然Q你可能需要在user用户中给当前用户(user2)授权Q?grant select/delete/update on user2<br />  2.删除同义词:(x)</p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  drop public synonym table_name;</p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  3.查看所有同义词Q?/p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  select * from dba_synonyms</p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">  同义词拥有如下好处:(x)节省大量?a target="_blank" style="color: #333333; text-decoration: none; ">数据?/a>I间Q对不同用户的操作同一张表没有多少差别;扩展的数据库的用范_(d)能够在不同的数据库用户之间实现无~交?同义词可以创建在不同一个数据库服务器上Q通过|络实现q接?br /> <a target="_blank" style="color: #333333; text-decoration: none; ">Oracle</a>数据库中提供了同义词理的功能。Oracle同义词是数据库方案对象的一个别名,l常用于化对象访问和提高对象讉K的安全性?br />ADQ?br /> <span style="text-indent: 2em; ">在Oracle中对用户的管理是使用权限的方式来理的,也就是说Q如果我们想使用数据库,我们必d有权限,但是如果是别人将权限授予了我们,我们也是能对数据库进行操作的Q但是我们必要已授权的表的名称前键入该表所有者的名称Q所以这是比较ȝ的,遇到q种情况Q我们该怎么办呢Q创ZOracle同义词吧Q这h们就可以直接使用同义词来使用表了?/span></p><p style="border-width: 0px; padding: 0px; margin: 0px 0px 8px; list-style: none; text-indent: 2em; color: #333333; font-family: 宋体; line-height: 28px; background-color: #ffffff; ">1.同义词的概念<br />Oracle数据库中提供了同义词理的功能。同义词是数据库Ҏ(gu)对象的一个别名,l常用于化对象访问和提高对象讉K的安全性。在使用同义词时QOracle数据库将它翻译成对应Ҏ(gu)对象的名字。与视图cMQ同义词q不占用实际存储I间Q只有在数据字典中保存了同义词的定义。在Oracle数据库中的大部分数据库对象,如表、视图、同义词、序列、存储过E、包{等Q数据库理员都可以Ҏ(gu)实际情况Z们定义同义词?br />2.Oracle同义词的分类<br />Oracle同义词有两种cdQ分别是公用Oracle同义词与U有Oracle同义词?br />1)公用Oracle同义?׃个特D的用户lPublic所拥有。顾名思义Q数据库中所有的用户都可以用公用同义词。公用同义词往往用来标示一些比较普通的数据库对象,q些对象往往大家都需要引用?br />2)U有Oracle同义?它是跟公用同义词所对应Q他是由创徏他的用户所有。当Ӟq个同义词的创徏者,可以通过授权控制其他用户是否有权使用属于自己的私有同义词?br />3.Oracle同义词创建及删除<br />创徏公有Oracle同义词的语法QCreate [public] synonym 同义词名U?for [username.]objectNameQ?br />Drop [public] synonym 同义词名U?br />4.Oracle同义词的作用<br />1) 多用户协同开发中Q可以屏蔽对象的名字及其持有者。如果没有同义词Q当操作其他用户的表Ӟ必须通过user?object名的形式Q采用了Oracle同义词之后就可以隐蔽掉user名,当然q里要注意的是:(x)public同义词只是ؓ(f)数据库对象定义了一个公q别名Q其他用戯否通过q个别名讉Kq个数据库对象,q要看是否已lؓ(f)q个用户授权?br />2) 为用L(fng)化sql语句。上面的一条其实就是一U简化sql的体玎ͼ同时如果自己建的表的名字很长Q可以ؓ(f)q个表创Z个Oracle同义词来化sql开发?br />3)为分布式数据库的q程对象提供位置透明性?br />5.Oracle同义词在数据库链中的作用<br />数据库链是一个命名的对象Q说明一个数据库到另一个数据库的\径,通过其可以实C同数据库之间的通信?br />Create database link 数据库链?connect  to  user?identified by 口o(h)  using ‘Oracleq接?#8217;; 讉K对象要通过 object名@数据库链名。同义词在数据库链中的作用就是提供位|透明性?/p><img src ="http://m.tkk7.com/kxbin/aggbug/388003.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-18 17:46 <a href="http://m.tkk7.com/kxbin/articles/388003.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle创徏database linkȝhttp://m.tkk7.com/kxbin/articles/388002.htmlkxbinkxbinTue, 18 Sep 2012 09:36:00 GMThttp://m.tkk7.com/kxbin/articles/388002.htmlhttp://m.tkk7.com/kxbin/comments/388002.htmlhttp://m.tkk7.com/kxbin/articles/388002.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/388002.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/388002.html物理上存放于|络的多个ORACLE数据库,逻辑上可以看成一个单一的大型数?库,用户可以通过|络对异地数据库中的数据q行存取Q而服务器之间的协同处理对于工作站用户及应用程序而言是完全透明的,开发h员无需兛_|络的链接细 节、数据在|络节点中的具体分布情况和服务器间的协调工作q程?/p>

数据库之间的链接建立在DATABASE LINK上。要创徏一个DATABASE LINKQ必首先在建立链接的数据库上设|链接字W串Q即配置一个远E数据库的本地网l服务名?/p>

链接字符串的配置参见《客L(fng)q接服务器》一节?/p>

数据库全局名称可以用以下命令查出:(x)

SELECT * FROM GLOBAL_NAME;

修改可以用以下语句来修改参数|(x)

ALTER SYSTEM SET GLOBAL_NAME=TRUE/FALSE;

<1>、当数据库参数global_name=falseӞ׃要求数据库链接名U跟q端数据库名UC栗?/p>

oracle数据库之间进行连接通讯?br />创徏数据库链接的语法如下Q?nbsp;
CREATE [PUBLIC] DATABASE LINK link

CONNECT TO username IDENTIFIED BY password

USING ‘connectstring’

其中Q?br />--demona为用net8 easy config创徏的连接字W串
目的Ҏ(gu)据库的init.ora文g中的global_names设ؓ(f)false
重新启动数据库设|才能生?br />或者用sys用户执行

注意Q创建数据库链接的帐号必LCREATE DATABASE LINK或CREATE PUBLIC DATABASE LINK的系l权限,用来d到远E数据库的帐号必LCREATE SESSION权限。这两种权限都包含在CONNECT角色中(CREATE PUBLIC DATABASE LINK权限在DBA中)?/p>

一个公用数据库链接对于数据库中的所有用户都是可用的Q而一个私有链接仅对创建它的用户可用。由一个用L(fng)另外一个用h权私有数据库链接是不可能的,一个数据库链接要么是公用的Q要么是U有的?/p>

创徏数据库链接时Q还可以使用~省d方式Q即不指定远E数据库的用户名和密码:(x)

create public database link zrhs_link

using ‘zrhs’;

在不指定用户名和口o(h)的情况下QORACLE使用当前的用户名和口令登录到q程数据库?/p>

USING后面指定的是链接字符Ԍ也就是远E数据库的网l服务名Q这个服务名保存在TNSNAMES.ORA文g中,在该文g中定义了协议、主机名、端口和数据库名?/p>

删除数据库链接的语句是:(x)

DROP [PUBLIC] DATABASE LINK zrhs_link

数据库链接的引用

一般情况下引用数据库链接,可以直接其攑ֈ调用的表名或视图名称后面Q中间用一?@ 作ؓ(f)分割W:(x)

SELECT * FROM worker@zrhs_link ;

对于l常使用的数据库链接Q可以徏立一个本地的同义词,方便使用Q?/p>

CREATE SYNONYM worker_syn FOR worker@zrhs_link ;

q可以徏立一个本地的q程视图Q方便用:(x)

CREATE VIEW worker AS SELECT * FROM worker@zrhs_link where… ;

现在本视囑֏与本地数据库中的M其它视图一样对待,也可以授权给其它用户Q访问此视图Q但该用户必L讉K数据库链接的权限?/p>

对于另外一U情况,所要访问的表不在数据库链接中指定的q程帐户下,但该帐户有访问该表的权限Q那么我们在表名前要加上该表的用户名Q?/p>

SELECT * FROM camel.worker@zrhs_link ;

<2>、当数据库参数global_name=trueӞ那就要求数据库链接名U跟q端数据库名UC?br />数据库全局名称可以用以下命令查?/p>

SELECT * FROM GLOBAL_NAME;

atabase link(dblink)--数据库链?br />创徏dblink的语法:(x)
sql>create database link 数据库链路名
connect to 用户?identified by 口o(h)
using 'L字符串名';
 
如:(x)
sql>create database link ora9i.us.oracle.com ### q里的us.oracle.com为oracle默认域名 ###
connect to scott identified by tiger
using 'sun';

1)dblink名必Mq程数据库的全局数据库名Qglobal_nameQ相同;
2)用户名,口o(h)E数据库用户名,口o(h);
3)L字符串ؓ(f)本机tnsnames.ora中定义的?
4)两个同名的数据库间不得徏立dblink;
然后Q你可以通过dblink讉Kq程数据库了?br />如:(x)
sql>select * from 表名@ora9i.us.oracle.com;
q可以徏立快?snapshot)通过dblink实现q程数据自动传输?/p>

查看所有的数据库链接,q入pȝ理员SQL>操作W下Q运行命令:(x) 

SQL>select owner,object_name from dba_objects where object_type='DATABASE LINK';



kxbin 2012-09-18 17:36 发表评论
]]>
ORACLE SQLQ经典查询练手第五篇http://m.tkk7.com/kxbin/articles/387986.htmlkxbinkxbinTue, 18 Sep 2012 07:05:00 GMThttp://m.tkk7.com/kxbin/articles/387986.htmlhttp://m.tkk7.com/kxbin/comments/387986.htmlhttp://m.tkk7.com/kxbin/articles/387986.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387986.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387986.html阅读全文

kxbin 2012-09-18 15:05 发表评论
]]>
ORACLE SQLQ经典查询练手第四篇http://m.tkk7.com/kxbin/articles/387984.htmlkxbinkxbinTue, 18 Sep 2012 07:04:00 GMThttp://m.tkk7.com/kxbin/articles/387984.htmlhttp://m.tkk7.com/kxbin/comments/387984.htmlhttp://m.tkk7.com/kxbin/articles/387984.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387984.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387984.html阅读全文

kxbin 2012-09-18 15:04 发表评论
]]>
ORACLE SQLQ经典查询练手第三篇http://m.tkk7.com/kxbin/articles/387983.htmlkxbinkxbinTue, 18 Sep 2012 07:03:00 GMThttp://m.tkk7.com/kxbin/articles/387983.htmlhttp://m.tkk7.com/kxbin/comments/387983.htmlhttp://m.tkk7.com/kxbin/articles/387983.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387983.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387983.html阅读全文

kxbin 2012-09-18 15:03 发表评论
]]>
ORACLE SQLQ经典查询练手第二篇http://m.tkk7.com/kxbin/articles/387981.htmlkxbinkxbinTue, 18 Sep 2012 07:02:00 GMThttp://m.tkk7.com/kxbin/articles/387981.htmlhttp://m.tkk7.com/kxbin/comments/387981.htmlhttp://m.tkk7.com/kxbin/articles/387981.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387981.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387981.html阅读全文

kxbin 2012-09-18 15:02 发表评论
]]>
ORACLE SQLQ经典查询练手第一?/title><link>http://m.tkk7.com/kxbin/articles/387980.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Tue, 18 Sep 2012 07:01:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/387980.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/387980.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/387980.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/387980.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/387980.html</trackback:ping><description><![CDATA[     摘要: 本文使用的实例表l构与表的数据如下:(x)scott.emp员工表结构如下:(x)Name     Type         Nullable Default Comments -------- ------------ ...  <a href='http://m.tkk7.com/kxbin/articles/387980.html'>阅读全文</a><img src ="http://m.tkk7.com/kxbin/aggbug/387980.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-18 15:01 <a href="http://m.tkk7.com/kxbin/articles/387980.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle常见问题(401-500)http://m.tkk7.com/kxbin/articles/387661.htmlkxbinkxbinThu, 13 Sep 2012 09:28:00 GMThttp://m.tkk7.com/kxbin/articles/387661.htmlhttp://m.tkk7.com/kxbin/comments/387661.htmlhttp://m.tkk7.com/kxbin/articles/387661.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387661.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387661.html401. V$PQ_TQSTAT 
包含q行执行操作上的l计?/span>.帮助在一个查询中定不^衡的问题?/span>


402. V$PROCESS 
包含关于当前zdq程的信息?/span>


403. V$PROXY_ARCHIVEDLOG 
包含归档日志备䆾文g的描qC息,q些备䆾文g带有一个称?/span>PROXY副本的新特征?/span>


404. V$PROXY_DATAFILE 
包含数据文g和控制文件备份的描述信息Q这些备份文件带有一个称?/span>PROXY副本的新特征?/span>


405. V$PWFILE_USERS 
列出被授?/span>SYSDBA?/span>SYSOPERҎ(gu)的用戗?/span>


406. V$PX_PROCESS 
包含正在q行q行操作的会(x)话的信息?/span>


407. V$PX_PROCESS_SYSSTAT 
包含正在q行q行操作的会(x)话的信息?/span>


408. V$PX_SESSION 
包含正在q行q行操作的会(x)话的信息?/span>


409. V$PX_SESSTAT 
包含正在q行q行操作的会(x)话的信息?/span>


410. V$QUEUE 
包含多线E消息队列的信息?/span>


411. V$QUEUEING_MTH 
昄所有可用的查询资源分配Ҏ(gu)?/span>


412. V$RECOVER_FILE 
昄需要介质恢复的文g状态?/span>


413. V$RECOVERY_FILE_STATUS 
包含Ҏ(gu)个恢复命令的每一数据文g的一行信息?/span>


414. V$RECOVERY_LOG 
列出需要完成介质恢复的归档日志的信?/span>.q个信息来自V$LOG_HISTORY


415. V$RECOVERY_PROCESS 
能够用来跟踪数据库恢复操作,以便他们不会(x)被终止执行?/span> 
也用来估进E中完成q个操作所需的时间?/span>


416. V$RECOVERY_STATUS 
包含当前恢复q程的统计量?/span>


417. V$REQDIST 
列出MTS调度E序hơ数的直方图的统计量?/span>

418. V$RESERVED_WORDS 
l出PL/SQL~译器所使用的关键字的列表?/span>


419. V$RESOURCE 
包含资源名和地址信息?/span>


420. V$RESOURCE_LIMIT 
昄pȝ资源的全局资源使用的信息?/span>

 
421. V$ROLLNAME 
列出所有联机回滚段的信息?/span>


422. V$ROLLSTAT 
包含回滚D늚l计量?/span>


423. V$ROWCACHE 
昄zd数据字典的统计量?/span>


424. V$ROWCACHE_PARENT 
昄数据字典中所有双亲对象的信息?/span>


425. V$ROWCACHE_SUBORDINATE 
昄数据字典中从属对象的信息?/span>


426. V$RSRC_CONSUMER_GROUP 
昄与当前活动资源消费者用L(fng)相关联的数据?/span>


427. V$RSRC_CONSUMER_GROUP_CPU_MTH 
源消费者用L(fng)昄所有可用的资源的分配方法?/span>


428. V$RSRC_PLAN 
昄当前所有活动资源方案的名称?/span>


429. V$RSRC_PLAN_CPU_MTH 
昄所有用于资源方案的可用CPU资源分配Ҏ(gu)?/span>


430. V$SESS_IO 
为每个用户会(x)话列?/span>I/Ol计?/span>


431. V$SESSION 
列出当前每一个会(x)话的?x)话信息?/span>


432. V$SESSION_CONNECT_INFO 
昄当前?x)话的网l连接的信息?/span>


433. V$SESSION_CURSOR_CACHE 
昄当前?x)话的游标用法的信息?/span>

 
434. V$SESSION_EVENT 
列出一个会(x)话在{待一个事件的信息?/span>


435. V$SESSION_LONGOPS 
昄一个长旉q行操作的状态?/span>


436. V$SESSION_OBJECT_CACHE 
昄本地服务器上当前用户对话的对象高速缓存的l计量?/span>


437. V$SESSION_WAIT 
列出正在{待的活动会(x)话的资源或事件?/span>


438. V$SESSTAT 
列出用户?x)话l计量?/span>


439. V$SGA 
包含pȝ全局区的ȝ计量?/span>

 
440. V$SGASTAT 
包含pȝ全局区的详细信息?/span>


441. V$SHARED_POOL_RESERVED 
列出能帮助你调节׃n池中保留池和I间的统计量?/span>


442. V$SHARED_SERVER 
包含׃n服务器进E的信息?/span>

 
443. V$SHARED_SERVER_MONITOR 
包含调试׃n服务器进E的信息?/span>


444. V$SORT_SEGMENT 
包含一个给定实例中每一个排序段的信息?/span>


445. V$SPPARAMETER 
列出SPFILE的内宏V?/span>


446. V$SQL 
列出SQL׃n区的l计量?/span>


447. V$SQL_BIND_DATA 
如果数据在服务器中可用,它将Ҏ(gu)询这个视囄?x)话所拥有的每个游标中的每一个不同的q接变量Q显C客

L(fng)发送的实际q接数据?/span>


448. V$SQL_BIND_METADATA 
Ҏ(gu)询这个视囄?x)话所拥有的每个游标中的每一个不同的q接变量Q显C客L(fng)提供的连接元数据?/span>


449. V$SQL_CURSOR 
昄与查询这个视囄?x)话相关的每一个游标的DEBUG信息?/span>


450. V$SQL_PLAN 
包含装蝲到库~存中每个子游标的执行计划信息?/span>


451. V$SQL_SHARED_CURSOR 
Z么一个特定的子游标没有与存在的子查询的共享的解释?/span>


452. V$SQL_SHARED_MEMEORY 
关于׃n内存快照的游标的信息?/span>


453. V$SQL_REDIRECTION 
标识复位向的SQL语句?/span>


454. V$SQL_WORKAREA 
昄?/span>SQL游标使用的工作区信息?/span>


455. V$SQL_WORKAREA_ACTIVE 
包含当前ql分配的工作区的昫间信息?/span>


456. V$SQLAREA 
׃nSQL的统计量?/span>


457. V$SQLTEXT 
包含SGA中属于共?/span>SQL游标?/span>SQL语句文本?/span>


458. V$SQLTEXT_WITH_NEWLINES 
不能用空g替新行制表符外,?/span>V$SQLTEXT功能一栗?/span>


459. V$STATNAME 
V$SESSTAT?/span>V$SYSTAT表中的统计量的译码统计名字?/span>


460. V$SUBCACHE 
昄当前装蝲于库高速缓存中的从属高速缓存的信息?/span>


461. V$SYSSTAT 
列出pȝl计量?/span>


462. V$SYSTEM_CURSOR_CACHE 
pȝ范围的信息?/span>


463. V$SYSTEM_EVENT 
包含{待一个事件的全部信息?/span>


464. V$SYSTEM_PARAMETER 
包含pȝ参数信息?/span>


465. V$SYSTEM_PARAMETER2 
ORACLE实例中当前媄响的参数和参数的倹{?/span>


466. V$TABLESPACE 
控制文g中表I间的信息?/span>


467. V$TEMP_CACHE_TRANSFER 
昄每个数据文g中探查块的数量?/span>


468. V$TEMP_EXTENT_MAP 
昄所有(f)时表I间的每一个单元的状态信息?/span>


469. V$TEMP_EXTENT_POOL 
昄被一个给定实例用的临时I间~存的状态?/span>


470. V$TEMP_PING 
昄每一个数据文件探查的块数?/span>


471. V$TEMP_SPACE_HEADER 
昄每一个(f)时表I间中每一个文件的聚集信息Q涉及每个空间首部中当前使用多少I间和有多少自由I间?/span>


472. V$TEMPFILE 
昄临时文g的信息?/span>


473. V$TEMPORARY_LOBS 
昄临时?/span>LOB?/span>


474. V$TEMPSTAT 
包含文g?/span>/写的l计信息?/span>


475. V$THREAD 
包含控制文g中的U程信息?/span>


476. V$TIMER 
列出?/span>1%U计的流逝时间?/span>


477. V$TIMEZONE_NAMES 
列出合法的时区名U?/span>


478. V$TRANSACTION 
列出pȝ中的zd事务?/span>


479. V$TRANSACTION_ENQUEUE 
昄事务状态对象所拥有的锁?/span>


480. V$TYPE_SIZE 
列出不同数据库组件的大小Q以便用来估数据块的容量大?/span>


481. V$UNDOSTAT 
昄一个历史统计数据来昄pȝ工作的如何?/span>


482. V$VERSION 
列出ORACLE服务器中核心库组件的版本受?/span>


483. V$VPD_POLICY 
列出与当前在库缓存中的游标相关的所有安全策略?/span>


484. V$WAITSTAT 
列出块竞争统计量 
9I
理的数据字?/span>DBA视图


485. DBA_2PC_NEIGHBORS 
包含未决事务的引入或出的连接信息?/span>


486. DBA_ALL_TABLES 
昄数据库中所有表的描q?/span>


487. DBA_APPLICATION_ROLES 
所有的h函数定义的验证策略的角色?/span>


488. DBA_ASSOCIATIONS 
昄用户定义的统计信息?/span>


489. DBA_AUDIT_EXISTS 
列出AUDIT NOT EXISTS?/span>AUDIT EXISTS产生的审计跟t?/span>


490. DBA_AUDIT_OBJECT 
pȝ中所有对象的审计跟踪记录?/span>


491. DBA_AUDIT_SESSION 
列出关于CONNECT?/span>DISCONNECT的所有审计跟t信息?/span>


492. DBA_AUDIT_STATEMENT 
列出关于GRANTQ?/span>REVOKEQ?/span>AUDITQ?/span>NOAUDITQ?/span>ALTER SYSTEM语句的审计跟t信息?/span>


493. DBA_AUDIT_TRAIL 
列出所有的审计跟踪条目?/span>


494. DBA_BLOCKERS 
列出正有人等待一个会(x)话持有的锁的所有会(x)话,但ƈ非它们自己在{待一个锁?/span>


495. DBA_BASE_TABLE_MVIEWS 
描述数据库中所有的物化视图?/span>


496. DBA_CATALOG 
列出所有数据库标,视图Q同义词和序列?/span>


497. DBA_CLU_COLUMNS 
列出表列到聚集列的映?/span>


498. DBA_CLUSTER_HASH_EXPRESSIONS 
列出所有聚集的散列HASH函数?/span>


499. DBA_CLUSTERS 
包含数据库中所有聚集的描述?/span>


500. DBA_COL_COMMENTS 
所有表和视囄列的注解?/span> 



kxbin 2012-09-13 17:28 发表评论
]]>
oracle常见问题(301-400)http://m.tkk7.com/kxbin/articles/387660.htmlkxbinkxbinThu, 13 Sep 2012 09:27:00 GMThttp://m.tkk7.com/kxbin/articles/387660.htmlhttp://m.tkk7.com/kxbin/comments/387660.htmlhttp://m.tkk7.com/kxbin/articles/387660.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387660.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387660.html301. V$BUFFER_POOL 
昄实例~冲池的信息?/span>

 
302. V$BUFFER_POOL_STATISTICS 
昄实例~冲池的信息?/span>


303. V$CACHE 
包含当前实例?/span>SGA中的每一个块的头部信息?/span>


304. V$CACHE_LOCK 
包含当前实例?/span>SGA中的每一个块的头部信?/span>?/span>V$CACHE非常怼Q?/span> 
除特使^台锁理器标识符号不同外?/span>


305. V$CACHE_TRANSFER 
除了只显C那些被探查了至一ơ的块的信息外,?/span>V$CACHE功能相同?/span>


306. V$CIRCUIT 
包含关于虚电(sh)路的信息Q是用户通过调度E序和服务器到数据库的所有连接?/span>


307. V$CLASS_PING 
昄每一个块cM被探查块的数目?/span>


308. V$COMPATIBILITY 
昄数据库实例用的特征Q可以阻止数据库回到早期的版本中厅R?/span>


309. V$COMPATSEG 
昄数据库实例用的怹性特征,可以L数据库回到早期的版本中去?/span>


310. V$CONTEXT 
列出当前对话的设|属性?/span>


311. V$CONTROLFILE 
列出控制文g的名U?/span>


312. V$CONTROLFILE_RECORD_SECTION 
昄控制文g记录部分的信息?/span>


313. V$COPY_CORRUPTION 
昄控制文g中数据文件损坏的信息?/span>


314. V$CR_BLOCK_SERVER 
昄用在~存中块服务器后台进E上的统计信息?/span>


315. V$DATABASE 
包含控制文g中数据库的信息?/span>


316. V$DATAFILE 
包含控制文g中数据库文g的信息?/span>


317. V$DATAFILE_COPY 
包含控制文g中数据库文g副本的信息?/span>


318. V$DATAFILE_HEADER 
昄数据文g头部的数据文件信息?/span>


319. V$DB_CACHE_ADVICE 
Ҏ(gu)~存的大估计出物理ȝ数量?/span>


320. V$DB_OBJECT_CACHE 
~存在库~存中的数据库对象?/span>


321. V$DB_PIPES 
昄实例中的׃n池当前描l的道?/span>


322. V$DBFILE 
列出l成数据库的所有数据文件?/span>


323. V$DBLINK 
查询?x)话所打开的所有数据库q接?/span>


324. V$DELETED_OBJECT 
昄控制文g中被删除归档日志?/span>

 
325. V$DISPATCHER 
提供调度q程的信息?/span>


326. V$DISPATCHER_RATE 
度进E提供优质提供速率l计量?/span>


327. V$DLM_ALL_LOCKS 
列出当前所有锁的信息?/span>


328. V$DLM_CONVERT_LOCAL 
本地锁{换操作所消耗的旉?/span>


329. V$DLM_CONVERT_REMOTE 
q程锁{换操作所消耗的旉?/span>


330. V$DLM_LATCH 
它是q时的,参见V$LATCH


331. V$DLM_LOCKS 
q些是锁理器已知的被阻塞或d其它对象的锁信息?/span>


332. V$DLM_MISC 
昄多种DLMl计量?/span>


333. V$DLM_RESS 
昄当前锁管理器已知的全部资源的信息?/span>


334. V$ENABLEDPRIVE 
昄被授予的Ҏ(gu)?/span>


335. V$ENQUEUE_LOCK 
昄排队对象所拥有的全部锁?/span>


336. V$EVENT_NAME 
包含{待事g的信息?/span>


337. V$EXECUTION 
昄q行执行中的信息?/span>


338. V$FALSE_PING 
可能得到探查p|的缓冲区?/span>


339. V$FAST_START_SERVERS 
执行q行操作事务恢复的所有从属操作的信息?/span>


340. V$FAST_START_TRANSACTIONS 
恢复中的事务q展信息?/span>


341. V$FILE_CACHE_TRANSFER 
昄每个数据文g中探查的块的数量?/span>


342. V$FILE_PING 
昄每个数据文g被探查的块数目?/span>


343. V$FILESTAT 
包含文g关于?/span>/写统计量信息?/span>


344. V$FIXED_TABLE 
昄数据库中所有动态性能表和视图及导?/span>


345. V$FIXED_VIEW_DEFINITION 
昄所有固定视囄定义?/span>


346. V$GC_ELEMENTS_WITH_COLLISIONS 
可以扑ֈ保护多缓存的锁?/span>

 
347. V$GES_BLOCKING_ENQUEUE 
q些是锁理器已知的被阻塞或d其它对象的锁信息?/span>

 
348. V$GES_CONVERT_LOCAL 
本地锁{换操?/span>


349. V$GES_CONVERT_REMOTE 
q程锁{换操作所消耗的旉?/span>


350. V$GES_ENQUEUE 
昄当前锁管理员知道的所有的锁?/span>


351. V$GES_LATCH 
参见V$LATCH


352. V$GES_RESOURCE 
昄当前锁管理器已知的全部资源的信息?/span>


353. V$GES_STATISTICS 
昄多种DLMl计量?/span>


354. V$GLOBAL_BLOCKED_LOCKS 
昄全局块锁?/span>


355. V$GLOBAL_TRANSACTION 
昄当前Ȁzȝ全局事务的信息?/span>


356. V$HS_AGENT 
标识当前q行在一个给定的L上的HS代理的集合?/span>


357. V$HS_SESSION 
ORACLE服务器打开?/span>HS?x)话集?/span>


358. V$INDEXED_FIXED_COLUMN 
昄建立索引的动态性能表中的列(X$?/span>)?/span>


359. V$INSTANCE 
昄当前实例的状态?/span>


360. V$INSTANCE_RECOVERY 
用来监视执行用户指定恢复L数的限制机制?/span>


361. V$LATCH 
为非双亲易锁列出l计量?/span>


362. V$LATCH_CHILDREN 
关于子简易锁的统计量?/span>


363. V$LATCH_MISSES 
试图获得一个简易锁p|的统计量?/span>


364. V$LATCH_PARENT 
包含关于双亲易锁的统计量?/span>


365. V$LATCHHOLDER 
当前易锁持有者的信息?/span>


366. V$LATCHNAME 
包含关于昄?/span>V$LATCH中的易锁的解码简易锁名字的信息?/span>


367. V$LIBRARYCACHE 
关于高速缓存性能和活动的l计量?/span>


368. V$LICENSE 
许可证限制的信息?/span>


369. V$LOADCSTAT 
包含在一个直接装载执行过E中所~译?/span>SQL*LOADERl计量?/span>


370. V$LOCK 
当前ORACLE所持有的锁?/span>


371. V$LOCK_ACTIVITY 
昄当前实例?/span>DLM锁操作活动?/span>


372. V$LOCK_ELEMENT 
每一个被~存使用?/span>PCM锁在V$LOCK_ELEMENTS中都有一个条目?/span>


373. V$LOCKED_OBJECT 
列出每个事务所获得的全部锁?/span>


374. V$LOCK_WITH_COLLISIONS 
可以查询Z护多~冲区的锁?/span>


375. V$LOG 
控制文g中日志文件的信息?/span>


376. V$LOG_HISTORY 
控制文g中日志文件的历史信息?/span>


377. V$LOGFILE 
包含重做日志文g的信息?/span>


378. V$LOGHIST 
控制文g中日志文件的日志历史信息?/span>


379. V$LOGMNR_CONTENTS 
日志历史信息?/span>


380. V$LOGMNR_DICTIONARY 
日志历史信息?/span>


381. V$LOGMNR_LOGS 
日志信息?/span>


382. V$LOGMNR_PARAMETERS 
日志信息?/span>


383. V$MTS 
包含调节多线E的服务器的信息?/span>


384. V$MYSTAT 
当前?x)话的统计量?/span>


385. V$NLS_PARAMETERS 
当前NLS参数信息?/span>


386. V$NLS_VALID_VALUES 
列出所?/span>NLS参数的有效倹{?/span>


387. V$OBJECT_DEPENDENCY 
能够通过当前装蝲在共享池中的包,q程或游标来军_依赖哪一个对象?/span>


388. V$OBJECT_USAGE 
来监视烦引的使用?/span>


389. V$OBSOLETE_PARAMETER 
列出陈旧的参数?/span>


390. V$OFFINE_RANGE 
昄控制文g中数据文件的脱机信息?/span>


391. V$OPEN_CURSOR 
列出每一个会(x)话当前打开的和解析的游标?/span>


392. V$OPTION 
列出ORACLE服务安装的状c?/span>


393. V$PARALLEL_DEGREE_LIMIT_MTH 
昄所有有效的q行度限制资源分配的Ҏ(gu)?/span>


394. V$PARAMETER 
列出关于初始化参数的信息?/span>


395. V$PARAMETER2 
列出了当前媄响会(x)话的参数和参数倹{?/span>

 
396. V$PGASTAT 
列出ORACLE内存使用l计?/span>

 
397. V$PING 
?/span>V$CACHE一栗?/span>


398. V$PQ_SESSTAT 
列出q行查询?x)话的统计信息?/span>


399. V$PQ_SLAVE 
一个实例上每个zdq行执行服务器的l计量?/span>


400. V$PQ_SYSSTAT 
列出q行查询的系l的l计量?/span>



kxbin 2012-09-13 17:27 发表评论
]]>
oracle常见问题(201-300)http://m.tkk7.com/kxbin/articles/387659.htmlkxbinkxbinThu, 13 Sep 2012 09:26:00 GMThttp://m.tkk7.com/kxbin/articles/387659.htmlhttp://m.tkk7.com/kxbin/comments/387659.htmlhttp://m.tkk7.com/kxbin/articles/387659.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387659.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387659.html阅读全文

kxbin 2012-09-13 17:26 发表评论
]]>
oracle常见问题(101-200)http://m.tkk7.com/kxbin/articles/387657.htmlkxbinkxbinThu, 13 Sep 2012 09:24:00 GMThttp://m.tkk7.com/kxbin/articles/387657.htmlhttp://m.tkk7.com/kxbin/comments/387657.htmlhttp://m.tkk7.com/kxbin/articles/387657.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387657.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387657.html阅读全文

kxbin 2012-09-13 17:24 发表评论
]]>
oracle常见问题(1-100)http://m.tkk7.com/kxbin/articles/387656.htmlkxbinkxbinThu, 13 Sep 2012 09:23:00 GMThttp://m.tkk7.com/kxbin/articles/387656.htmlhttp://m.tkk7.com/kxbin/comments/387656.htmlhttp://m.tkk7.com/kxbin/articles/387656.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387656.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387656.html阅读全文

kxbin 2012-09-13 17:23 发表评论
]]>
ORACLE PL/SQL~程详解之七Q? E序包的创徏与应?/title><link>http://m.tkk7.com/kxbin/articles/387581.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 12 Sep 2012 09:34:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/387581.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/387581.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/387581.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/387581.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/387581.html</trackback:ping><description><![CDATA[     摘要: 本篇主要内容如下Q第七章  E序包的创徏和应?.1  E序包简?.2  E序包的定义7.3  包的开发步?.4  包定义的说明7.5  子程序重?.6  加密实用E序7.7  删除?.8  包的理 ...  <a href='http://m.tkk7.com/kxbin/articles/387581.html'>阅读全文</a><img src ="http://m.tkk7.com/kxbin/aggbug/387581.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-12 17:34 <a href="http://m.tkk7.com/kxbin/articles/387581.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE PL/SQL~程详解之六Q?把过E与函数说?/title><link>http://m.tkk7.com/kxbin/articles/387580.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 12 Sep 2012 09:33:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/387580.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/387580.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/387580.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/387580.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/387580.html</trackback:ping><description><![CDATA[     摘要: 本篇主要内容如下Q?.1 引言6.2 创徏函数6.3 存储q程6.3.1 创徏q程6.3.2 调用存储q程6.3.3 AUTHID6.3.4 PRAGMA AUTONOMOUS_TRANSACTION6.3.5 开发存储过E步?.3.6 删除q程和函?.3.7 q程与函数的比较 6.1...  <a href='http://m.tkk7.com/kxbin/articles/387580.html'>阅读全文</a><img src ="http://m.tkk7.com/kxbin/aggbug/387580.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-12 17:33 <a href="http://m.tkk7.com/kxbin/articles/387580.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE PL/SQL~程详解之五Q?异常错误处理http://m.tkk7.com/kxbin/articles/387579.htmlkxbinkxbinWed, 12 Sep 2012 09:32:00 GMThttp://m.tkk7.com/kxbin/articles/387579.htmlhttp://m.tkk7.com/kxbin/comments/387579.htmlhttp://m.tkk7.com/kxbin/articles/387579.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387579.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387579.html阅读全文

kxbin 2012-09-12 17:32 发表评论
]]>
ORACLE PL/SQL~程详细之四Q?把游标说?/title><link>http://m.tkk7.com/kxbin/articles/387578.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 12 Sep 2012 09:31:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/387578.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/387578.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/387578.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/387578.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/387578.html</trackback:ping><description><![CDATA[     摘要: 本篇主要内容如下Q?.1 游标概念4.1.1 处理昑ּ游标4.1.2 处理隐式游标4.1.3 关于 NO_DATA_FOUND ?nbsp;%NOTFOUND的区?.1.4  使用游标更新和删除数?.2 游标变量4.2.1  声明游标变量4.2.2  游标变量操作...  <a href='http://m.tkk7.com/kxbin/articles/387578.html'>阅读全文</a><img src ="http://m.tkk7.com/kxbin/aggbug/387578.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-12 17:31 <a href="http://m.tkk7.com/kxbin/articles/387578.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE PL/SQL~程详解之三QPL/SQL程控制语句http://m.tkk7.com/kxbin/articles/387577.htmlkxbinkxbinWed, 12 Sep 2012 09:30:00 GMThttp://m.tkk7.com/kxbin/articles/387577.htmlhttp://m.tkk7.com/kxbin/comments/387577.htmlhttp://m.tkk7.com/kxbin/articles/387577.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387577.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387577.html阅读全文

kxbin 2012-09-12 17:30 发表评论
]]>
ORACLE PL/SQL~程详解之二Q?PL/SQL块结构和l成元素http://m.tkk7.com/kxbin/articles/387571.htmlkxbinkxbinWed, 12 Sep 2012 09:00:00 GMThttp://m.tkk7.com/kxbin/articles/387571.htmlhttp://m.tkk7.com/kxbin/comments/387571.htmlhttp://m.tkk7.com/kxbin/articles/387571.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387571.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387571.html阅读全文

kxbin 2012-09-12 17:00 发表评论
]]>
ORACLE PL/SQL~程详解之一QPL/SQL E序设计?/title><link>http://m.tkk7.com/kxbin/articles/387570.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 12 Sep 2012 08:59:00 GMT</pubDate><guid>http://m.tkk7.com/kxbin/articles/387570.html</guid><wfw:comment>http://m.tkk7.com/kxbin/comments/387570.html</wfw:comment><comments>http://m.tkk7.com/kxbin/articles/387570.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/kxbin/comments/commentRss/387570.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/kxbin/services/trackbacks/387570.html</trackback:ping><description><![CDATA[<p style="margin: 7.5pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: 宋体; background-color: #ffff00; font-size: 11pt; font-weight: bold; ">本篇主要内容如下Q?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="text-transform: uppercase; font-family: Arial; font-size: 10.5pt; ">W?/span><span style="text-transform: uppercase; font-family: 宋体; font-size: 10.5pt; ">一</span><span style="text-transform: uppercase; font-family: Arial; font-size: 10.5pt; ">?nbsp;  PL/SQL E序设计?/span></a></p><p style="margin: 0pt 0px 0pt 10.5pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">1.</span><span style="font-variant: small-caps; font-family: 宋体; font-size: 10pt; ">1</span><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">   SQL与PL/SQL</span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.</span><span style="font-family: 宋体; font-size: 10pt; ">1</span><span style="font-family: 'Times New Roman'; font-size: 10pt; ">.1  什么是PL/SQL?</span></a></p><p style="margin: 0pt 0px 0pt 10.5pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">1.</span><span style="font-variant: small-caps; font-family: 宋体; font-size: 10pt; ">2</span><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">  PL/SQL?/span><span style="font-variant: small-caps; font-family: 宋体; font-size: 10pt; ">优点或特?/span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.1  有利于客?服务器环境应用的q行</span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.2  适合于客L(fng)?/span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.</span><span style="font-family: 宋体; font-size: 10pt; ">3</span><span style="font-family: 'Times New Roman'; font-size: 10pt; ">  </span><span style="font-family: 宋体; font-size: 10pt; ">q程?/span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.</span><span style="font-family: 宋体; font-size: 10pt; ">4</span><span style="font-family: 'Times New Roman'; font-size: 10pt; ">  </span><span style="font-family: 宋体; font-size: 10pt; ">模块?/span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.</span><span style="font-family: 宋体; font-size: 10pt; ">5</span> <span style="font-family: 宋体; font-size: 10pt; "> q行错误的可处理?/span></a></p><p style="margin: 0pt 0px 0pt 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-family: 'Times New Roman'; font-size: 10pt; ">1.2.</span><span style="font-family: 宋体; font-size: 10pt; ">6</span> <span style="font-family: 宋体; font-size: 10pt; "> 提供大量内置E序?/span></a></p><p style="margin: 0pt 0px 0pt 10.5pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">1.</span><span style="font-variant: small-caps; font-family: 宋体; font-size: 10pt; ">3</span><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">  PL/SQL 可用的SQL语句</span></a></p><p style="margin: 0pt 0px 0pt 10.5pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><a style="color: #464646; text-decoration: none; "><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">1.</span><span style="font-variant: small-caps; font-family: 宋体; font-size: 10pt; ">4</span><span style="font-variant: small-caps; font-family: 'Times New Roman'; font-size: 10pt; ">  q行PL/SQLE序</span></a></p><p style="margin: 0pt 0px 0pt 10.5pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><hr style="font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; line-height: normal; background-color: #ffffff; " /><p style="margin: 7px 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "> </p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><p style="margin: 0pt 0px; text-indent: 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: 宋体; font-size: 10.5pt; ">SQL语言只是讉K、操作数据库的语aQƈ不是一U具有流E控制的E序设计语言Q而只有程序设计语a才能用于应用软g的开发?/span><span style="font-family: Arial; font-size: 10.5pt; ">PL /SQL是一U高U数据库E序设计语言Q该语言专门用于在各U环境下对ORACLE数据库进行访问。由于该语言集成于数据库服务器中Q所以PL/SQL代码可以Ҏ(gu)据进行快速高效的处理。除此之外,可以在ORACLE数据库的某些客户端工具中Q用PL/SQL语言也是该语a的一个特炏V本章的主要内容是讨论引入PL/SQL语言的必要性和该语a的主要特点,以及了解PL/SQL语言的重要性和数据库版本问题。还要介l一些诏I全书的更详l的高概念Qƈ在本章的最后就我们在本书案例中使用的数据库表的若干U定做一说明?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h2><a name="_Toc518865172" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 12pt; "><a name="_Toc521305443" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418090" style="color: rgb(70, 70, 70); "></a><a name="_Toc524428001" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949039" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407121" style="color: rgb(70, 70, 70); "></a><a name="_Toc477183988" style="color: rgb(70, 70, 70); "></a><a name="_Toc24706" style="color: rgb(70, 70, 70); "></a><a name="_Toc18787" style="color: #464646; ">1.</a></span><span style="font-family: 宋体; font-size: 12pt; ">1</span><span style="font-family: Arial; font-size: 12pt; ">   SQL与PL/SQL</span></h2><h3><a name="_Toc518865173" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc521305444" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418091" style="color: rgb(70, 70, 70); "></a><a name="_Toc524428002" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949040" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407122" style="color: rgb(70, 70, 70); "></a><a name="_Toc477183989" style="color: rgb(70, 70, 70); "></a><a name="_Toc24699" style="color: rgb(70, 70, 70); "></a><a name="_Toc11821" style="color: #464646; ">1.</a></span><span style="font-family: 宋体; font-size: 10.5pt; ">1</span><span style="font-family: Arial; font-size: 10.5pt; ">.1  什么是PL/SQL?</span></h3><p style="margin: 0pt 0px; text-indent: 27pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL?nbsp;Procedure Language & Structured Query Language 的羃写。ORACLE的SQL是支持ANSI(American national Standards Institute)和ISO92 (International Standards Organization)标准的品。PL/SQL是对SQL语言存储q程语言的扩展。从ORACLE6以后QORACLE的RDBMS附带了PL/SQL。它现在已经成ؓ(f)一U过E处理语aQ简UPL/SQL。目前的PL/SQL包括两部分,一部分是数据库引擎部分Q另一部分是可嵌入到许多品(如C语言QJAVA语言{)工具中的独立引擎。可以将q两部分UCؓ(f)Q数据库PL/SQL和工具PL/SQL。两者的~程非常怼。都h~程l构、语法和逻辑机制。工具PL/SQL另外q增加了用于支持工具Q如ORACLE FormsQ的句法Q如Q在H体上设|按钮等。本章主要介l数据库PL/SQL内容?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h2><a name="_Toc503776575" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 12pt; "><a name="_Toc518865174" style="color: rgb(70, 70, 70); "></a><a name="_Toc521305445" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418092" style="color: rgb(70, 70, 70); "></a><a name="_Toc524428003" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949041" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407123" style="color: rgb(70, 70, 70); "></a><a name="_Toc477183990" style="color: rgb(70, 70, 70); "></a><a name="_Toc15813" style="color: rgb(70, 70, 70); "></a><a name="_Toc5025" style="color: #464646; ">1.</a></span><span style="font-family: 宋体; font-size: 12pt; ">2</span><span style="font-family: Arial; font-size: 12pt; ">  PL/SQL?/span><span style="font-family: 宋体; font-size: 12pt; ">优点或特?/span></h2><h3><a name="_Toc518865175" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc521305446" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418093" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949042" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407124" style="color: rgb(70, 70, 70); "></a><a name="_Toc8118" style="color: rgb(70, 70, 70); "></a><a name="_Toc6530" style="color: #464646; ">1.2.1  有利于客?服务器环境应用的q行</a></span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">对于客户/服务器环境来_(d)真正的瓶颈是|络上。无论网l多快,只要客户端与服务器进行大量的数据交换。应用运行的效率自然回受到影响。如果用PL/SQLq行~程Q将q种h大量数据处理的应用放在服务器端来执行。自然就省去了数据在|上的传输时间?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h3><a name="_Toc518865176" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc521305447" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418094" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949043" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407125" style="color: rgb(70, 70, 70); "></a><a name="_Toc6181" style="color: rgb(70, 70, 70); "></a><a name="_Toc20499" style="color: #464646; ">1.2.2  适合于客L(fng)?/a></span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL׃分ؓ(f)数据库PL/SQL部分和工具PL/SQL。对于客L(fng)来说QPL/SQL可以嵌套到相应的工具中,客户端程序可以执行本地包含PL/SQL部分Q也可以向服务发SQL命o(h)或激zL务器端的PL/SQLE序q行?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h3><a name="_Toc28930" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc21230" style="color: #464646; ">1.2.</a></span><span style="font-family: 宋体; font-size: 10.5pt; ">3</span><span style="font-family: Arial; font-size: 10.5pt; ">  </span><span style="font-family: 宋体; font-size: 10.5pt; ">q程?/span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL</span><span style="font-family: 宋体; font-size: 10.5pt; ">?/span><span style="font-family: 宋体; font-size: 10.5pt; ">Oracle在标准SQL上的q程性扩展,不仅允许在PL/SQLE序内嵌入SQL语句Q而且允许使用各种cd的条件分支语句和循环语句Q可以多个应用程序之间共享其解决Ҏ(gu)</span><span style="font-family: Arial; font-size: 10.5pt; ">?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h3><a name="_Toc2337" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc6437" style="color: #464646; ">1.2.</a></span><span style="font-family: 宋体; font-size: 10.5pt; ">4</span><span style="font-family: Arial; font-size: 10.5pt; ">  </span><span style="font-family: 宋体; font-size: 10.5pt; ">模块?/span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL</span><span style="font-family: 宋体; font-size: 10.5pt; ">E序l构是一U描q性很强、界限分明的块结构、嵌套块l构Q被分成单独的过E、函数、触发器Q且可以把它们组合ؓ(f)E序包,提高E序的模块化能力</span><span style="font-family: Arial; font-size: 10.5pt; ">?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h3><a name="_Toc23825" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc21211" style="color: #464646; ">1.2.</a></span><span style="font-family: 宋体; font-size: 10.5pt; ">5</span>  <span style="font-family: 宋体; font-size: 10.5pt; ">q行错误的可处理?/span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: 宋体; font-size: 10.5pt; ">使用</span><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL</span><span style="font-family: 宋体; font-size: 10.5pt; ">提供的异常处理(</span><span style="font-family: 宋体; font-size: 10.5pt; ">EXCEPTIONQ,开发h员可集中处理各种ORACLE错误和PL/SQL错误Q或处理pȝ错误与自定义错误Q以增强应用E序的健壮性?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><h3><a name="_Toc16138" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 10.5pt; "><a name="_Toc22163" style="color: #464646; ">1.2.</a></span><span style="font-family: 宋体; font-size: 10.5pt; ">6</span>  <span style="font-family: 宋体; font-size: 10.5pt; ">提供大量内置E序?/span></h3><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: 宋体; font-size: 10.5pt; ">ORACLE提供了大量的内置E序包。通过q些E序包能够实现DBS的一些低层操作、高U功能,不论对DBAq是应用开发h员都h重要作用?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><p style="margin: 0pt 0px; text-indent: 21pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: 宋体; font-size: 10.5pt; ">当然q有其它的一些优点如Q更好的性能、可UL性和兼容性、可l护性、易用性与快速性等?/span></p><h2><a name="_Toc518865178" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 12pt; "><a name="_Toc521305449" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418096" style="color: rgb(70, 70, 70); "></a><a name="_Toc524428004" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949045" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407127" style="color: rgb(70, 70, 70); "></a><a name="_Toc477183991" style="color: rgb(70, 70, 70); "></a><a name="_Toc10163" style="color: rgb(70, 70, 70); "></a><a name="_Toc30478" style="color: #464646; ">1.</a></span><span style="font-family: 宋体; font-size: 12pt; ">3</span><span style="font-family: Arial; font-size: 12pt; ">  PL/SQL 可用的SQL语句</span></h2><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">    PL/SQL是ORACLEpȝ的核心语aQ现在ORACLE的许多部仉是由PL/SQL写成。在PL/SQL中可以用的SQL语句有:(x)</span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">INSERTQUPDATEQDELETEQSELECT INTOQCOMMITQROLLBACKQSAVEPOINT?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-style: italic; font-family: Arial; font-size: 10.5pt; font-weight: bold; ">提示Q在 PL/SQL中只能用 SQL语句中的 DML 部分Q不能用 DDL 部分Q如果要在PL/SQL中用DDL(如CREATE  table  {?的话Q只能以动态的方式来用?/span></p><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "></p><p style="margin: 0pt 0px 0pt 39pt; text-indent: -18pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Wingdings; font-size: 10.5pt; ">l </span><span style="font-family: Arial; font-size: 10.5pt; ">ORACLE ?nbsp;PL/SQL lg在对 PL/SQL E序q行解释Ӟ同时对在其所使用的表名、列名及数据cdq行查?/span></p><p style="margin: 0pt 0px 0pt 39pt; text-indent: -18pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Wingdings; font-size: 10.5pt; ">l </span><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL 可以在SQL*PLUS 中用?/span></p><p style="margin: 0pt 0px 0pt 39pt; text-indent: -18pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Wingdings; font-size: 10.5pt; ">l </span><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL 可以在高U语a中用?/span></p><p style="margin: 0pt 0px 0pt 39pt; text-indent: -18pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Wingdings; font-size: 10.5pt; ">l </span><span style="font-family: Arial; font-size: 10.5pt; ">PL/SQL可以在ORACLE的开发工具中使用</span><span style="font-family: 宋体; font-size: 10.5pt; ">(如:(x)SQL Developer或Procedure Builder{?</span><span style="font-family: Arial; font-size: 10.5pt; ">?/span></p><p style="margin: 0pt 0px 0pt 39pt; text-indent: -18pt; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Wingdings; font-size: 10.5pt; ">l </span><span style="font-family: Arial; font-size: 10.5pt; ">其它开发工具也可以调用PL/SQL~写的过E和函数Q如Power Builder {都可以调用服务器端的PL/SQLq程?/span></p><h2><a name="_Toc518865179" style="color: rgb(70, 70, 70); "></a><span style="font-family: Arial; font-size: 12pt; "><a name="_Toc521305450" style="color: rgb(70, 70, 70); "></a><a name="_Toc521418097" style="color: rgb(70, 70, 70); "></a><a name="_Toc524428005" style="color: rgb(70, 70, 70); "></a><a name="_Toc525949046" style="color: rgb(70, 70, 70); "></a><a name="_Toc528407128" style="color: rgb(70, 70, 70); "></a><a name="_Toc477183992" style="color: rgb(70, 70, 70); "></a><a name="_Toc2603" style="color: rgb(70, 70, 70); "></a><a name="_Toc6182" style="color: #464646; ">1.</a></span><span style="font-family: 宋体; font-size: 12pt; ">4</span><span style="font-family: Arial; font-size: 12pt; ">  q行PL/SQLE序</span></h2><p style="margin: 0pt 0px; line-height: 24px; font-family: 微Y雅黑, 宋体, Arial; font-size: 15px; background-color: #ffffff; "><span style="font-family: Arial; font-size: 10.5pt; ">    PL/SQLE序的运行是通过ORACLE中的一个引擎来q行的。这个引擎可能在ORACLE的服务器端,也可能在 ORACLE 应用开发的客户端。引擎执行PL/SQL中的q程性语句,然后SQL语句发送给数据库服务器来执行。再结果返回给执行端?/span></p><img src ="http://m.tkk7.com/kxbin/aggbug/387570.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/kxbin/" target="_blank">kxbin</a> 2012-09-12 16:59 <a href="http://m.tkk7.com/kxbin/articles/387570.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE PL/SQL~程之八Q把触发器说?http://m.tkk7.com/kxbin/articles/387567.htmlkxbinkxbinWed, 12 Sep 2012 08:50:00 GMThttp://m.tkk7.com/kxbin/articles/387567.htmlhttp://m.tkk7.com/kxbin/comments/387567.htmlhttp://m.tkk7.com/kxbin/articles/387567.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387567.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387567.html阅读全文

kxbin 2012-09-12 16:50 发表评论
]]>
oracle记录cdhttp://m.tkk7.com/kxbin/articles/387123.htmlkxbinkxbinWed, 05 Sep 2012 13:52:00 GMThttp://m.tkk7.com/kxbin/articles/387123.htmlhttp://m.tkk7.com/kxbin/comments/387123.htmlhttp://m.tkk7.com/kxbin/articles/387123.html#Feedback0http://m.tkk7.com/kxbin/comments/commentRss/387123.htmlhttp://m.tkk7.com/kxbin/services/trackbacks/387123.htmlpl/sql表和记录一P都是用户自定义的数据l构。recordcM于c语言中结构(structQ而pl/sql表类gc语言的数l或集合Q只是这个数据的元素可以是用戯定义的类型。record可以存储一条记录,而pl/sql表可以存储多条record记录?br />一Q什么是记录QRecordQ?
 由单行多列的标量构成的复合结构。可以看做是一U用戯定义数据cd。组成类g多维数组?/div>
一个或多个标量装成一个对象进行操作。是一U(f)时复合对象类型?/div>
 
 记录可以直接赋倹{RECORD1 :=RECORD2Q?/div>
 记录不可以整体比?
 记录不可以整体判断ؓ(f)I?/div>
 
二,%ROWTYPE和记录(RecordQ?
 请区?ROWTYPE和记录(RecordQ类型?ROWTYPE可以说是Record的升U简化版?/div>
 区别在与前者结构ؓ(f)表结构,后者ؓ(f)自定义结构。二者在使用上没有很大区别。前者方便,后者灵zR在实际中根据情冉|具体军_使用?/div>
 Record + PL/SQL表可以进行数据的多行多列存储?/div>
 
三,如何创徏和用记录?
 
  ①创徏记录cd
  语法Q?/div>
  TYPE  记录? IS RECORD 
  ( 
   filed1 type1 [NOT NULL] [Q?eXPr1],
       ....... ,
    filedN typen [NOT NULL] [Q?exprn] 
  Q?/div>
  其中Qfiled1是标量的名字?/div>
  
  ②声明记录cd变量Q?/div>
   记录cd变量?记录cd
   
  ③填充记录?/div>
   
  ④讉K记录成员
   记录cd变量?filed1
   .........
   记录cd变量?filedN
   
   
  注意Q?/div>
  表字D늱型修改后Q还需要修改记录字D늱型,有时候可能会(x)忘记Q从而出现错误?/div>
  对于记录内每个字D(filed1.。。。)Q可以指定也可以使用%TYPE?ROWTYPE动态指定记录字D늱型?nbsp;
  好处是表字段发生变化Q记录字D自动改变。但是,׃每次执行前,遇到%TYPR?ROWTYPEQ?/div>
  数据库系l都?x)去查看对应表字D늱型,?x)造成一定的数据库开销Q如果系l中大量使用记录cdQ则Ҏ(gu)能?x)有一定媄响?/div>
  另外如果删除了某一字段Q而自定义记录中用了该字D,也会(x)有可能忘记删除该字段?/div>
       Ҏ(gu)据库负荷偏低的系l,性能问题一般可以不重点xQ但是对于高负荷数据库服务器Q?/div>
       各个环节都要考虑性能问题Q每处节省一点出来,性能整体有很大提高?/div>
  
  语法Q?/div>
  TYPE  记录? IS RECORD 
  ( 
   filed1 table.Filed%Type [NOT NULL] [Q?eXPr1] ,
   filed2 table.Filed%Type [NOT NULL] [Q?eXPr1] ,
       ....... ,
    filedn table.Filed%Type [NOT NULL] [Q?exprn] 
  Q?
 
 例子Q记录可以整体赋?/div>
 /*conn scott/tiger
 Create Table  empa  As  Select * From emp;
 */
 Declare
     Type EmpType is Record(
        EMPNO number(4),
        ENAME  varchar2(10),
        JOB varchar2(15),
        SAL number(7,2),
        DEPTNO number(2)
     );
   EmpRec1  EmpType;
   EmpRec2  EmpType;
 Begin
   EmpRec1.Empno:=7369;
   EmpRec1.Ename:='SMITH';
   EmpRec1.Job:='CLERK';
   EmpRec1.Sal:=800;
   EmpRec1.Deptno:=10;
   EmpRec2 := EmpRec1;
   DBMS_output.put_line(EmpRec2.empno);
 End;
 例子Q记录不可以整体比较Q只可以比较记录字段
 Declare
     Type EmpType is Record(
        EMPNO number(4),
        ENAME  varchar2(10),
        JOB varchar2(15),
        SAL number(7,2),
        DEPTNO number(2)
     );
   EmpRec1  EmpType;
   EmpRec2  EmpType;
 Begin
   EmpRec1.Empno:=7369;
   EmpRec1.Ename:='SMITH';
   EmpRec1.Job:='CLERK';
   EmpRec1.Sal:=800;
   EmpRec1.Deptno:=10;
   if EmpRec1.sal < EmpRec2.sal then
     DBMS_output.put_line('Xiao Xiao Xiao');
   end if;
 End;
 
 例子Q记录不可以整体判断为空Q只可以判断记录字段?/div>
 Declare
     Type EmpType is Record(
        EMPNO number(4),
        ENAME  varchar2(10),
        JOB varchar2(15),
        SAL number(7,2),
        DEPTNO number(2)
     );
   EmpRec  EmpType;
 Begin
   if EmpRec.ename is null then
     DBMS_output.put_line('Kong Kong Kong');  
   end if;
 End;
 
 例子Q?TYPE?ROWTYPE动态指定记录字Dc?/div>
 /*conn scott/tiger
 Create Table  empa  As  Select * From emp;
 */
 DECLARE
  Type MyRecType Is  Record
  (
   RENO  EMPA.EMPNO%Type,
   RENAME   EMPA.ENAME%Type,
   RJOB   EMPA.JOB%Type
  );
  EmpRec  MyRecType;
 Begin
  Select   EMPNO, ENAME, JOB  InTo  EmpRec  From empa Where empa.EMPNO = '7369';
  If  EmpRec.RJOB  = 'CLERK'  Then
   DBMS_OUTPUT.PUT_LINE('Name: '||EmpRec.RENAME);
  End If;
 End;
 
 例子Q数据集中的记录和记录类型中的数据关pR?/div>
 DECLARE
  Type MyRecType Is  Record
  (
   RENO  EMPA.EMPNO%Type,
   RENAME   EMPA.ENAME%Type,
   RJOB   EMPA.JOB%Type
  );
  EmpRec  MyRecType;
  vJob  EMPA.JOB%Type;
 Begin
  Select   EMPNO, ENAME, JOB  InTo  EmpRec  From empa Where empa.EMPNO = '7369';
  DBMS_OUTPUT.PUT_LINE('MyRecType.RJOB: '||EmpRec.RJOB);
  EmpRec.RJOB  := '修改值后'  ;
  DBMS_OUTPUT.PUT_LINE('MyRecType.RJOB: '||EmpRec.RJOB);
  Select JOB  InTo vJob  from empa  Where empa.EMPNO = EmpRec.RENO;
  DBMS_OUTPUT.PUT_LINE('EMPA.JOB: '||vJob);
 End;
 /
 
 
四,使用记录向表中插入数据?
 Ҏ(gu)表结构合理安排记录字Dc比如主外键?/div>
 如果用记?RECORD)插入数据Q那么只能用记录成员;
 如果?ROWTYPE插入数据,可以直接使用%ROWTYPE?/div>
 
 例子Q用记录成员向表中插入数据
 DECLARE
  Type MyRecType Is  Record
  (
   RENO  EMPA.EMPNO%Type,
   RENAME   VARCHAR2(10),
   RJOB   EMPA.JOB%Type
  );
  EmpRec MyRecType; 
 Begin
  Select   EMPNO, ENAME, JOB  InTo  EmpRec  From empa Where empa.EMPNO = '7369';
  DBMS_OUTPUT.PUT_LINE(EmpRec.RENO||'  '||EmpRec.RENAME||'  '||EmpRec.RJOB);
  
  EmpRec.RENO  := 1001;
  EmpRec.RENAME := '杰克';
  EmpRec.RJOB  := '办事?;
  Insert InTo  empa(EMPNO,ENAME,JOB)  Values(EmpRec.RENO, EmpRec.RENAME,EmpRec.RJOB);
 
  Select  EMPNO, ENAME, JOB  InTo  EmpRec  From empa Where empa.EMPNO = '1001';
  DBMS_OUTPUT.PUT_LINE(EmpRec.RENO||'  '||EmpRec.RENAME||'  '||EmpRec.RJOB);
 End;
 
五,使用记录更新数据Q?/div>
 如果用记?RECORD)更新数据Q那么只能用记录成员;
 如果?ROWTYPE更新数据,可以直接使用%ROWTYPE?/div>
 
 例子Q?ROWTYPE向表中插入数?/div>
 DECLARE
  vEmp empa%RowType;
 Begin
  Select  *  InTo  vEmp  From empa Where empa.EMPNO = '7369';
  UpDate empa Set ROW = vEmp Where EMPNO = 1001;
 End;
六,使用记录删除数据Q?/div> 删除记录Ӟ只能在delete语句的where子句中用记录成员?nbsp;

kxbin 2012-09-05 21:52 发表评论
]]> վ֩ģ壺 337pձŷ޴| պשר2020| ޳avƬ | ɫվapp߹ۿ | ɫtvվѿ| þþ| һػ¼Ѳİ| ޹Ʒ߹ۿ| պ߹ۿƵ| avtt| ߾Ʒһ㽶| ޹Ʒר| Ʒһ㽶| ޹Ʒ˾þ| freežž| Ļ | Ů18һëƬѹۿ| þŷƷ| ޾ƷһĻ| 91ƵƷȫѹۿ| þ޹ҹƷƬ | ˵Ӱѹۿ| 44rt| 99ŮŮѾƷƵ߹ۿ | ëƬŮAPP| ޳a߹ۿ| þþƷ5555| 91Ƶַ| ޾Ʒպav| ޹㽶ˬAVƬþ| 1024Ʒ| ۺɫ鶹| ձҹѸƵ| ߹ۿ| һվ| va˳Ƶվȫ| 99Ʒѹۿ| ޳aƬ2023| һ㽶| ߹ۿAVƬ| ƷƵ|