??xml version="1.0" encoding="utf-8" standalone="yes"?>久久偷窥视频,欧美激情综合色综合啪啪五月,久久久久久69http://www.aygfsteel.com/fine/category/19862.htmlzh-cnWed, 02 Mar 2011 03:41:34 GMTWed, 02 Mar 2011 03:41:34 GMT60oracle扚wfetch的sql语句 bulk collect into http://www.aygfsteel.com/fine/archive/2011/02/22/344815.htmlPeter PanPeter PanTue, 22 Feb 2011 03:39:00 GMThttp://www.aygfsteel.com/fine/archive/2011/02/22/344815.htmlhttp://www.aygfsteel.com/fine/comments/344815.htmlhttp://www.aygfsteel.com/fine/archive/2011/02/22/344815.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/344815.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/344815.html

Peter Pan 2011-02-22 11:39 发表评论
]]>
oracle实现Tree(2)http://www.aygfsteel.com/fine/archive/2010/10/13/335017.htmlPeter PanPeter PanWed, 13 Oct 2010 04:38:00 GMThttp://www.aygfsteel.com/fine/archive/2010/10/13/335017.htmlhttp://www.aygfsteel.com/fine/comments/335017.htmlhttp://www.aygfsteel.com/fine/archive/2010/10/13/335017.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/335017.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/335017.html2 start with cr.parent_no is null connect by NOCYCLE prior cr.no = cr.parent_no1

Peter Pan 2010-10-13 12:38 发表评论
]]>
ORACLE shared server与dedicated serverhttp://www.aygfsteel.com/fine/archive/2010/02/03/311795.htmlPeter PanPeter PanWed, 03 Feb 2010 05:48:00 GMThttp://www.aygfsteel.com/fine/archive/2010/02/03/311795.htmlhttp://www.aygfsteel.com/fine/comments/311795.htmlhttp://www.aygfsteel.com/fine/archive/2010/02/03/311795.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/311795.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/311795.html show parameter shared_server NAME TYPE VALUE ------------------------------------ ----------- -------------------- max_shared_servers integer shared_server_sessions integer shared_servers integer 1 shared_servers大于0x持共享服务器q接 scott@ORCL> show parameter dispatchers NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ dispatchers string (PROTOCOL=TCP) (SERVICE=orclXDB) ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) (SERVER =DEDICATED) ) ) ORCL1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orclXDB) (SERVER =SHARED) ) )

Peter Pan 2010-02-03 13:48 发表评论
]]>
grant oracle debughttp://www.aygfsteel.com/fine/archive/2008/11/17/240910.htmlPeter PanPeter PanMon, 17 Nov 2008 01:39:00 GMThttp://www.aygfsteel.com/fine/archive/2008/11/17/240910.htmlhttp://www.aygfsteel.com/fine/comments/240910.htmlhttp://www.aygfsteel.com/fine/archive/2008/11/17/240910.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/240910.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/240910.htmlsession跟踪

在plsql developer Q选择procedure?test 》start debug


SQL> grant debug connect session to mw;

SQL> grant select on v_$session to mw;

授权成功?/p>

SQL> grant select on v_$sesstat to mw;

授权成功?/p>

SQL> grant select on v_$statname to mw;

授权成功?/p>

d完成?/p>

Peter Pan 2008-11-17 09:39 发表评论
]]>
Oracle分区表及分区索引1(?http://www.aygfsteel.com/fine/archive/2008/07/09/213718.htmlPeter PanPeter PanWed, 09 Jul 2008 09:14:00 GMThttp://www.aygfsteel.com/fine/archive/2008/07/09/213718.htmlhttp://www.aygfsteel.com/fine/comments/213718.htmlhttp://www.aygfsteel.com/fine/archive/2008/07/09/213718.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/213718.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/213718.html关于分区表和分区索引(About Partitioned Tables and Indexes)对于10gR2而言Q基本上可以分成几类Q?/font>
  •    Range(范围)分区
  •    Hash(哈希)分区
  •    List(列表)分区
  •    以及l合分区QRang e- Hash,Range-List?/font>

  对于表而言(常规意义上的堆组l表)Q上q分区Ş式都可以应用(甚至可以Ҏ个分区指定compress属?Q只不过分区依赖列不能是lob,long之类数据cdQ每个表的分区或子分区数的L不能过1023个?/font>

  对于索引l织表,只能够支持普通分区方式,不支持组合分区,常规表的限制对于索引l织表同h效,除此之外呢,q有一些其实的限制Q比如要求烦引组l表的分Z赖列必须是主键才可以{?/font>

  注:本篇所有示例仅针对常规表,卛_l织?

  对于索引Q需要区分创建的是全局索引Q或本地索引Q?/font>

  l 全局索引(global index)Q即可以分区Q也可以不分区。即可以建range分区Q也可以建hash分区Q即可徏于分Q又可创Z非分上,是_全局索引是完全独立的Q因此它也需要我们更多的l护操作?/font>

  l 本地索引(local index)Q其分区形式与表的分区完全相同,依赖列相同,存储属性也相同。对于本地烦引,其烦引分区的l护自动q行Q就是说你add/drop/split/ truncate 表的分区Ӟ本地索引会自动维护其索引分区?/font>

   Oracle 如果单个表超q?G最好对其进行分区,对于大表创徏分区的好处是显而易见的Q这里不多论qwhyQ而将重点攑֜when以及how?/font>

  WHEN

  一、When使用Range分区

  Range分区呢是应用范围比较q的表分区方式,它是以列的值的范围来做为分区的划分条gQ将记录存放到列值所在的range分区中,比如按照旉划分Q?008q?季度的数据放到a分区Q?8q?季度的数据放到b分区Q因此在创徏的时候呢Q需要你指定Z的列Q以及分区的范围|如果某些记录暂无法预范_可以创徏maxvalue分区Q所有不在指定范围内的记录都会被存储到maxvalue所在分ZQƈ且支持指定多列做Z赖列Q后面在讲how的时候会详细谈到?/font>

  二、When使用Hash分区

  通常呢,对于那些无法有效划分范围的表Q可以用hash分区Q这样对于提高性能q是会有一定的帮助。hash 分区会将表中的数据^均分配到你指定的几个分区中,列所在分区是依据分区列的hashD动分配,因此你ƈ不能控制也不知道哪条记录会被攑ֈ哪个分区中,hash分区也可以支持多个依赖列?/font>

  三、When使用List分区

  List分区与range分区和hash分区都有cM之处Q该分区与range分区cM的是也需要你指定列的|但这又不同与range分区的范围式列?--其分区值必L指定,也不同与hash分区---通过明确指定分区|你能控制记录存储在哪个分区。它的分区列只能有一个,而不能像range或者hash分区那样同时指定多个列做为分Z赖列Q不q呢Q它的单个分区对应值可以是多个?/font>

  你在分区时必ȝ定分区列可能存在的|一旦插入的列g在分围内Q则插入/更新׃p|Q因此通常使用list分区Ӟ要创Z个default分区存储那些不在指定范围内的记录Q类似range分区中的maxvalue分区?/font>

  四、When使用l合分区

  如果某表按照某列分区之后Q仍然较大,或者是一些其它的需求,q可以通过分区内再建子分区的方式将分区再分区,即组合分区的方式?/font>

  l合分区呢在10g中有两种Qrange-hashQrange-list。注意顺序哟Q根分区只能是range分区Q子分区可以是hash分区或list分区?/font>

  提示Q?1g在组合分区功能这块有所增强Q又推出了range-range,list-range,list-list,list-hashQ这q当于除hash外三U分? 

创徏range-hashl合分区

  语法如下Q图

  

  需要我们指定的有:

   column_list:分区依赖?支持多个Q中间以逗号分隔);

    subpartition:子分区方式,有两处:

   Subpartition_by_list:语法与list分区完全相同Q只不过把关键字partition换成subpartition

    Subpartition_by_hash:语法与hash分区完全相同Q只不过把关键字partition换成subpartition

    partition:分区名称;

    range_partition_values_clause:与range分区范围值的语法;

   tablespace_clause:分区的存储属性,例如所在表I间{属?可ؓI?Q默认承基表所在表I间的属性?/p>

  l合分区相对于普通分区,语法上稍E复杂了一些,但也正因如此Q其子分区的创徏可以非常灉|Q下面分别D几个例子(注:仅示例,qID所有Ş?

  ① 为所有分区各创徏4个hash子分?/strong>


    create table t_partition_rh (id number,name varchar2(50))
   partition by range(id) subpartition by hash(name)
    subpartitions 4 store in (tbspart01, tbspart02, tbspart03,tbspart04)(
   partition t_r_p1 values less than (10) tablespace tbspart01,
    partition t_r_p2 values less than (20) tablespace tbspart02,
    partition t_r_p3 values less than (30) tablespace tbspart03,
    partition t_r_pd values less than (maxvalue) tablespace tbspart04);
  表已创徏?



Peter Pan 2008-07-09 17:14 发表评论
]]>
行列转置http://www.aygfsteel.com/fine/archive/2008/05/19/201358.htmlPeter PanPeter PanMon, 19 May 2008 04:25:00 GMThttp://www.aygfsteel.com/fine/archive/2008/05/19/201358.htmlhttp://www.aygfsteel.com/fine/comments/201358.htmlhttp://www.aygfsteel.com/fine/archive/2008/05/19/201358.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/201358.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/201358.htmlCREATE TABLE  a as (select 1 id ,'項目一' XMMC,'XMONE' CODE,1 RYID FROM DUAL
           UNION
           select 2 id ,'項目? XMMC,'XMTWO' CODE,1 RYID FROM DUAL
           UNION
           select 3 id ,'項目? XMMC,'XMTHREE' CODE,1 RYID FROM DUAL
           UNION
           select 4 id ,'項目一' XMMC,'XMONE' CODE,2 RYID FROM DUAL
           )
WITH B AS (SELECT 1 ID,'張三' NAME FROM DUAL
           UNION
           SELECT 2 ID,'李四' NAME FROM DUAL          
           )
SELECT C.RYID,
       B.NAME,
       MAX(DECODE(RN, 1, XMMC, NULL)) XMONE,
       MAX(DECODE(RN, 2, XMMC, NULL)) XMTWO,
       MAX(DECODE(RN, 3, XMMC, NULL)) XMTHREE
  FROM (SELECT RYID,
               XMMC,
               CODE,
               ROW_NUMBER() OVER(PARTITION BY RYID ORDER BY RYID) RN  --以RYID分组后内部的排序
          FROM A) C,
       B
 WHERE C.RYID = B.ID
 GROUP BY C.RYID, B.NAME
 ORDER BY C.RYID

--     RYID NAME XMONE  XMTWO  XMTHREE
---------- ---- ------ ------ -------
--         1 張三 項目一 項目?項目?
--         2 李四 項目一        



Peter Pan 2008-05-19 12:25 发表评论
]]>
创徏带参数视?/title><link>http://www.aygfsteel.com/fine/archive/2008/04/20/194314.html</link><dc:creator>Peter Pan</dc:creator><author>Peter Pan</author><pubDate>Sun, 20 Apr 2008 07:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/fine/archive/2008/04/20/194314.html</guid><wfw:comment>http://www.aygfsteel.com/fine/comments/194314.html</wfw:comment><comments>http://www.aygfsteel.com/fine/archive/2008/04/20/194314.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/fine/comments/commentRss/194314.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/fine/services/trackbacks/194314.html</trackback:ping><description><![CDATA[ <div id="wmqeeuq" class="t_msgfont" id="message3377365"> <blockquote> <pre> <smallfont> <code> <span style="COLOR: #000000"> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">create table test</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #0000bb">name varchar2</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #0000bb">4</span> <span style="COLOR: #007700">),</span> <span style="COLOR: #0000bb">text  varchar2</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #0000bb">9</span> <span style="COLOR: #007700">));<br /><br /><br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">create view test_view </span> <span style="COLOR: #007700">as </span> <span style="COLOR: #0000bb">select text from test where name</span> <span style="COLOR: #007700">=</span> <span style="COLOR: #0000bb">userenv</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #dd0000">'client_info'</span> <span style="COLOR: #007700">);<br /><br /><br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">insert into test values</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #dd0000">'zxx'</span> <span style="COLOR: #007700">,</span> <span style="COLOR: #dd0000">'boy'</span> <span style="COLOR: #007700">);<br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">insert into test values</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #dd0000">'taw'</span> <span style="COLOR: #007700">,</span> <span style="COLOR: #dd0000">'gril'</span> <span style="COLOR: #007700">);<br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">commit</span> <span style="COLOR: #007700">;<br /><br /><br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">exec dbms_application_info</span> <span style="COLOR: #007700">.</span> <span style="COLOR: #0000bb">set_client_info</span> <span style="COLOR: #007700">(</span> <span style="COLOR: #dd0000">'zxx'</span> <span style="COLOR: #007700">);<br /><br /></span> <span style="COLOR: #0000bb">SQL</span> <span style="COLOR: #007700">></span> <span style="COLOR: #0000bb">select </span> <span style="COLOR: #007700">* </span> <span style="COLOR: #0000bb">from test_view</span> <span style="COLOR: #007700">;<br /><br /><br /><br /></span> <span style="COLOR: #0000bb">TEXT<br /><br /></span> <span style="COLOR: #007700">---------<br /><br /></span> <span style="COLOR: #0000bb">boy<br /><br /></span> <span style="COLOR: #007700">--<br /><br /><br /><br /><br /><br /></span> <span font="" s<="">a<br />create or replace type emp_type<br />as object (<br />empno number(4),<br />ename varchar2(10)<br />);<br />/<br />create or replace type emp_type_table as table of emp_type;<br />/<br />create or replace function emp_of_dept(p_deptno in number)<br />return emp_type_table<br />pipelined as<br />l_emp_type emp_type;<br />begin<br />for l_myrow in (select empno, ename from emp<br />where deptno = p_deptno) loop<br />l_emp_type := emp_type(l_myrow.empno, l_myrow.ename);<br />pipe row (l_emp_type);<br />end loop;<br />return;<br />end emp_of_dept;<br />/<br /><br />select * from table(emp_of_dept(10));<br />EMPNO ENAME<br />---------- ----------<br />7782 CLARK<br />7839 KING<br />7934 MILLER<br /><br />select * from table(emp_of_dept(30));<br />EMPNO ENAME<br />---------- ----------<br />7499 ALLEN<br />7521 WARD<br />7654 MARTIN<br />7698 BLAKE<br />7844 TURNER<br />7900 JAMES<br /><br />Tom - what do you think about this? <br /><br />Followup: <br />I think it is alot more code then:<br /><br />create or replace <br />procedure foo( p_deptno in number, p_result_set out sys_refcursor )<br />as<br />begin<br />open p_result_set for<br />select empno, ename from emp where deptno = p_deptno;<br />end;<br /><br />and having the client (which is doing Oracle stuff anyway) issue <br /><br />begin foo( :n, :m ); end;<br /><br /><br />It'll be less performant as well. <br />Neat "trick" but not best practice. <br /><br />create or replace function f_test(p_num in number)<br />return sys_refcursor<br />is<br />Result sys_refcursor;<br />begin<br />open Result for<br />select * from t1 t where t1.c1=p_num;<br />return(Result);<br />exception<br />when others then<br />raise;<br />end;<br /><br />select f_test(1) from dual;</span> </span> </code> </smallfont> </pre> </blockquote> </div> <img src ="http://www.aygfsteel.com/fine/aggbug/194314.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/fine/" target="_blank">Peter Pan</a> 2008-04-20 15:00 <a href="http://www.aygfsteel.com/fine/archive/2008/04/20/194314.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle exp/imp导出导入工具的??http://www.aygfsteel.com/fine/archive/2008/04/16/193372.htmlPeter PanPeter PanWed, 16 Apr 2008 03:43:00 GMThttp://www.aygfsteel.com/fine/archive/2008/04/16/193372.htmlhttp://www.aygfsteel.com/fine/comments/193372.htmlhttp://www.aygfsteel.com/fine/archive/2008/04/16/193372.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/193372.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/193372.html 一. 导出工具 expwQeLinux联盟
wQeLinux联盟
1. 它是操作pȝ下一个可执行的文?strong> 存放目录/ORACLE_HOME/binwQeLinux联盟
wQeLinux联盟
   exp导出工具数据库中数据备份压~成一个二q制pȝ文g.可以在不同OS间迁U?span style="DISPLAY: none">wQeLinux联盟
   wQeLinux联盟
   它有三种模式Q?span style="DISPLAY: none">wQeLinux联盟
       a.  用户模式Q?导出用户所有对象以及对象中的数据;wQeLinux联盟
       b.  表模式: 导出用户所有表或者指定的表;wQeLinux联盟
       c.  整个数据库: 导出数据库中所有对象?span style="DISPLAY: none">wQeLinux联盟
wQeLinux联盟
2. 导出工具exp交互式命令行方式的用的例子wQeLinux联盟
wQeLinux联盟
$exp test/test123@appdbwQeLinux联盟
Enter array fetch buffer size: 4096 > 回RwQeLinux联盟
Export file: expdat.dmp > m.dmp  生成导出的文件名wQeLinux联盟
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3wQeLinux联盟
Export table data (yes/no): yes > 回RwQeLinux联盟
Compress extents (yes/no): yes > 回RwQeLinux联盟
Export done in ZHS16GBK character set and ZHS16GBK NCHAR character setwQeLinux联盟
About to export specified tables via Conventional Path ...wQeLinux联盟
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu  要导出的表名wQeLinux联盟
. . exporting table                        CMAMENU       4336 rows exportedwQeLinux联盟
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要导出的表名nwQeLinux联盟
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回RwQeLinux联盟
Export terminated successfully without warnings. wQeLinux联盟
wQeLinux联盟
3. 导出工具exp非交互式命o行方式的例子wQeLinux联盟
wQeLinux联盟
$exp scott/tiger tables=(emp,dept) file=/directory/scott.dmp grants=ywQeLinux联盟
wQeLinux联盟
说明:把scott用户里两个表emp,dept导出到文?directory/scott.dmpwQeLinux联盟
wQeLinux联盟
$exp scott/tiger tables=emp query=\"where job=\'salesman\' and sal\<1600\" file=/directory/scott2.dmpwQeLinux联盟
wQeLinux联盟
说明:在exp里面加上导出emp的查询条件job='salesman' and sal<1600wQeLinux联盟
    wQeLinux联盟
    (但我个h很少q样?q是把满x件的记录生成临时表后,再exp会方便一?wQeLinux联盟
wQeLinux联盟
$exp parfile=username.par file=/directory1/username_1.dmp,/directory1/username_2.dmp filesize=2000M log=/directory2/username_exp.logwQeLinux联盟
wQeLinux联盟
参数文gusername.par内容wQeLinux联盟
userid=username/userpasswordwQeLinux联盟
buffer=8192000wQeLinux联盟
compress=nwQeLinux联盟
grants=ywQeLinux联盟
wQeLinux联盟
说明:username.par为导出工具exp用的参数文g,里面具体参数可以Ҏ需要去修改wQeLinux联盟
wQeLinux联盟
     filesize指定生成的二q制备䆾文g的最大字节数wQeLinux联盟
     wQeLinux联盟
     (可用来解x些OS?G物理文g的限制及加快压羃速度和方便刻历史数据光盘{?wQeLinux联盟
wQeLinux联盟
?导入工具 impwQeLinux联盟
wQeLinux联盟
1. 它是操作pȝ下一个可执行的文?存放目录/ORACLE_HOME/binwQeLinux联盟
wQeLinux联盟
imp导入工具EXP形成的二q制pȝ文g导入到数据库?wQeLinux联盟
wQeLinux联盟
   它有三种模式Q?span style="DISPLAY: none">wQeLinux联盟
       a.  用户模式Q?导出用户所有对象以及对象中的数据;wQeLinux联盟
       b.  表模式: 导出用户所有表或者指定的表;wQeLinux联盟
       c.  整个数据库: 导出数据库中所有对象?span style="DISPLAY: none">wQeLinux联盟
       wQeLinux联盟
   只有拥有IMP_FULL_DATABASE和DBA权限的用h能做整个数据库导?span style="DISPLAY: none">wQeLinux联盟
   wQeLinux联盟
   imp步骤Q?span style="DISPLAY: none">wQeLinux联盟
   (1) create table  (2) insert data  (3) create index (4) create triggers,constraintswQeLinux联盟
wQeLinux联盟
2.导入工具imp交互式命令行方式的例?/strong>wQeLinux联盟
$ impwQeLinux联盟
Import: Release 8.1.6.0.0 - Production on 星期?12?7 17:01:08 2001wQeLinux联盟
(c) Copyright 1999 Oracle Corporation.  All rights reserved.wQeLinux联盟
用户?  testwQeLinux联盟
口o:****wQeLinux联盟
q接? Oracle8i Enterprise Edition Release 8.1.6.0.0 - 64bit ProductionwQeLinux联盟
With the Partitioning optionwQeLinux联盟
JServer Release 8.1.6.0.0 - ProductionwQeLinux联盟
导入文g: expdat.dmp> /tmp/m.dmpwQeLinux联盟
输入插入~冲区大(最ؓ 8192 ) 30720>wQeLinux联盟
l由常规路径导出由EXPORT:V08.01.06创徏的文?span style="DISPLAY: none">wQeLinux联盟
警告: 此对象由 TEST 导出, 而不是当前用?span style="DISPLAY: none">wQeLinux联盟
已经完成ZHS16GBK字符集和ZHS16GBK NCHAR 字符集中的导?span style="DISPLAY: none">wQeLinux联盟
只列出导入文件的内容(yes/no)Qno>wQeLinux联盟
׃对象已存? 忽略创徏错误(yes/no)Qno> yeswQeLinux联盟
导入权限(yes/no)Qyes>wQeLinux联盟
导入表数?yes/no)Qyes>wQeLinux联盟
导入整个导出文g(yes/no)Qno> yeswQeLinux联盟
. 正在TEST的对象导入到 SCOTTwQeLinux联盟
. . 正在导入表                     ?"CMAMENU"       4336行被导入wQeLinux联盟
成功l止导入Q但出现警告?wQeLinux联盟
wQeLinux联盟
wQeLinux联盟
3.导入工具imp非交互式命o行方式的例子wQeLinux联盟
wQeLinux联盟
$ imp system/manager fromuser=jones tables=(accts) wQeLinux联盟
$ imp system/manager fromuser=scott tables=(emp,dept) wQeLinux联盟
$ imp system/manager fromuser=scott touser=joe tables=emp wQeLinux联盟
$ imp scott/tiger file = expdat.dmp full=y wQeLinux联盟
$ imp scott/tiger file = /mnt1/t1.dmp show=n buffer=2048000 ignore=n commit=y grants=y full=y log=/oracle_backup/log/imp_scott.logwQeLinux联盟
$ imp system/manager parfile=params.dat wQeLinux联盟
params.dat 内容 wQeLinux联盟
file=dba.dmp show=n ignore=n grants=y fromuser=scott tables=(dept,emp) wQeLinux联盟
wQeLinux联盟
4.导入工具imp可能出现的问?/strong>wQeLinux联盟
wQeLinux联盟
(1) 数据库对象已l存?span style="DISPLAY: none">wQeLinux联盟
一般情? 导入数据前应该彻底删除目标数据下的表, 序列, 函数/q程,触发器等;  wQeLinux联盟
数据库对象已l存? 按缺省的imp参数, 则会导入p|wQeLinux联盟
如果用了参数ignore=y, 会把exp文g内的数据内容导入wQeLinux联盟
如果表有唯一关键字的U束条g, 不合条g不被导?span style="DISPLAY: none">wQeLinux联盟
如果表没有唯一关键字的U束条g, 引赯录重?span style="DISPLAY: none">wQeLinux联盟
wQeLinux联盟
(2) 数据库对象有d键约?span style="DISPLAY: none">wQeLinux联盟
      不符合主外键U束? 数据会导入失?wQeLinux联盟
      解决办法: 先导入主? 再导入依存表wQeLinux联盟
disable目标导入对象的主外键U束, 导入数据? 再enable它们wQeLinux联盟
(3)  权限不够wQeLinux联盟
如果要把A用户的数据导入B用户? A用户需要有imp_full_database权限wQeLinux联盟
wQeLinux联盟
(4)  导入大表( 大于80M ) ? 存储分配p|wQeLinux联盟
      默认的EXP? compress = Y, 也就是把所有的数据压羃在一个数据块?wQeLinux联盟
      导入? 如果不存在连l一个大数据? 则会导入p|.wQeLinux联盟
      导出80M以上的大表时, 记得compress= N, 则不会引赯U错?wQeLinux联盟
wQeLinux联盟
(5) imp和exp使用的字W集不同wQeLinux联盟
      如果字符集不? 导入会失? 可以改变unix环境变量或者NT注册表里NLS_LANG相关信息.wQeLinux联盟
      导入完成后再改回?wQeLinux联盟
wQeLinux联盟
(6) imp和exp版本不能往上兼?span style="DISPLAY: none">wQeLinux联盟
imp可以成功导入低版本exp生成的文? 不能导入高版本exp生成的文?span style="DISPLAY: none">wQeLinux联盟
Ҏ情况我们可以?span style="DISPLAY: none">wQeLinux联盟
$ imp username/password@connect_stringwQeLinux联盟
说明: connect_string 是在/ORACLE_HOME/network/admin/tnsnames.orawQeLinux联盟
   定义的本地或者远端数据库的名U?span style="DISPLAY: none">wQeLinux联盟


Peter Pan 2008-04-16 11:43 发表评论
]]>
oracle创徏表空?/title><link>http://www.aygfsteel.com/fine/archive/2008/04/16/193254.html</link><dc:creator>Peter Pan</dc:creator><author>Peter Pan</author><pubDate>Tue, 15 Apr 2008 17:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/fine/archive/2008/04/16/193254.html</guid><wfw:comment>http://www.aygfsteel.com/fine/comments/193254.html</wfw:comment><comments>http://www.aygfsteel.com/fine/archive/2008/04/16/193254.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/fine/comments/commentRss/193254.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/fine/services/trackbacks/193254.html</trackback:ping><description><![CDATA[create tablespace  dbspace datafile 'D:\oracle\product\10.2.0\oradata\orcl\dbspace.dbf' size 400M autoextend on next 10m maxsize unlimited;--创徏表空?br />DROP TABLESPACE dbspace INCLUDING CONTENTS AND DATAFILES;--删除表空?br /><div><span style="FONT-SIZE: 10.5pt; COLOR: black">1) DATAFILE: </span><span style="FONT-SIZE: 10.5pt; COLOR: black">表空间数据文件存放\?br />2) SIZE: 起初讄?00M<br />3) UNIFORM: 指定区尺ؓ128k,如不指定Q区寸默认?4k <br />4) I间名称histdb ?数据文g名称 histdb.dbf 不要求相?可随意命?</span></div><div><span style="FONT-SIZE: 10.5pt; COLOR: black">5) AUTOEXTEND ON/OFF </span><span style="FONT-SIZE: 10.5pt; COLOR: black">表示启动/停止自动扩展表空?/span></div><div style="MARGIN-LEFT: 26.35pt; TEXT-INDENT: -26.35pt" align="left"><span>6) alter database datafile ' D:\oracle\product\10.2.0\oradata\orcl\histdb.dbf ' resize 500m; //手动修改数据文g大小?br /><br />create user test1 identified by test1 default tablespace dbspace; <br />alter database default tablespace dbspace; <br />create user test identified by test; <br />select username, default_tablespace defspace from dba_users where username='TEST';</span></div><img src ="http://www.aygfsteel.com/fine/aggbug/193254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/fine/" target="_blank">Peter Pan</a> 2008-04-16 01:05 <a href="http://www.aygfsteel.com/fine/archive/2008/04/16/193254.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle10g创徏用户http://www.aygfsteel.com/fine/archive/2008/04/16/193253.htmlPeter PanPeter PanTue, 15 Apr 2008 16:58:00 GMThttp://www.aygfsteel.com/fine/archive/2008/04/16/193253.htmlhttp://www.aygfsteel.com/fine/comments/193253.htmlhttp://www.aygfsteel.com/fine/archive/2008/04/16/193253.html#Feedback5http://www.aygfsteel.com/fine/comments/commentRss/193253.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/193253.html阅读全文

Peter Pan 2008-04-16 00:58 发表评论
]]>
ora sql 优化http://www.aygfsteel.com/fine/archive/2007/05/18/118416.htmlPeter PanPeter PanFri, 18 May 2007 09:17:00 GMThttp://www.aygfsteel.com/fine/archive/2007/05/18/118416.htmlhttp://www.aygfsteel.com/fine/comments/118416.htmlhttp://www.aygfsteel.com/fine/archive/2007/05/18/118416.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/118416.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/118416.htmlselect /*+index(t_customer idx_t_cust_area_name)*/    --利用t_customer的烦引 idx_t_cust_area_name q行查询
         count(*)
          into v_count
          from t_customer
         where parent_cust_id = in_parent_cust_id
           and type = 1
           and customer_area_code = in_customer_area_code
           and customer_name = in_customer_name;

分析?br />analyze table T_INDUSTRY compute statistics;


Peter Pan 2007-05-18 17:17 发表评论
]]>
exp/imp导出导入工具http://www.aygfsteel.com/fine/archive/2007/04/30/114753.htmlPeter PanPeter PanMon, 30 Apr 2007 05:20:00 GMThttp://www.aygfsteel.com/fine/archive/2007/04/30/114753.htmlhttp://www.aygfsteel.com/fine/comments/114753.htmlhttp://www.aygfsteel.com/fine/archive/2007/04/30/114753.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/114753.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/114753.html
   exp导出工具数据库中数据备份压~成一个二q制pȝ文g.可以在不同OS间迁U?br />  
   它有三种模式Q?br />       a.  用户模式Q?导出用户所有对象以及对象中的数据;
       b.  表模式: 导出用户所有表或者指定的表;
       c.  整个数据库: 导出数据库中所有对象?br />$exp test/test123@appdb
Enter array fetch buffer size: 4096 > 回R
Export file: expdat.dmp > m.dmp  生成导出的文件名
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3
Export table data (yes/no): yes > 回R
Compress extents (yes/no): yes > 回R
Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu  要导出的表名
. . exporting table                        CMAMENU       4336 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要导出的表名n
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回R
Export terminated successfully without warnings.


1. 它是操作pȝ下一个可执行的文?存放目录/ORACLE_HOME/bin

imp导入工具EXP形成的二q制pȝ文g导入到数据库?

   它有三种模式Q?br />       a.  用户模式Q?导出用户所有对象以及对象中的数据;
       b.  表模式: 导出用户所有表或者指定的表;
       c.  整个数据库: 导出数据库中所有对象?br />      
   只有拥有IMP_FULL_DATABASE和DBA权限的用h能做整个数据库导?br />  
   imp步骤Q?br />   (1) create table  (2) insert data  (3) create index (4) create triggers,constraints

2.导入工具imp交互式命令行方式的例?br />$ imp
Import: Release 8.1.6.0.0 - Production on 星期?12?7 17:01:08 2001
(c) Copyright 1999 Oracle Corporation.  All rights reserved.
用户?  test
口o:****
q接? Oracle8i Enterprise Edition Release 8.1.6.0.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production
导入文g: expdat.dmp> /tmp/m.dmp
输入插入~冲区大(最ؓ 8192 ) 30720>
l由常规路径导出由EXPORT:V08.01.06创徏的文?br />警告: 此对象由 TEST 导出, 而不是当前用?br />已经完成ZHS16GBK字符集和ZHS16GBK NCHAR 字符集中的导?br />只列出导入文件的内容(yes/no)Qno>
׃对象已存? 忽略创徏错误(yes/no)Qno> yes
导入权限(yes/no)Qyes>
导入表数?yes/no)Qyes>
导入整个导出文g(yes/no)Qno> yes
. 正在TEST的对象导入到 SCOTT
. . 正在导入表                     ?"CMAMENU"       4336行被导入
成功l止导入Q但出现警告?

imp userid=system/password fromuser=olddbuser touser=newdbuser

Peter Pan 2007-04-30 13:20 发表评论
]]>
Oracle备䆾与恢复案?/title><link>http://www.aygfsteel.com/fine/archive/2007/03/16/104237.html</link><dc:creator>Peter Pan</dc:creator><author>Peter Pan</author><pubDate>Fri, 16 Mar 2007 05:45:00 GMT</pubDate><guid>http://www.aygfsteel.com/fine/archive/2007/03/16/104237.html</guid><wfw:comment>http://www.aygfsteel.com/fine/comments/104237.html</wfw:comment><comments>http://www.aygfsteel.com/fine/archive/2007/03/16/104237.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/fine/comments/commentRss/104237.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/fine/services/trackbacks/104237.html</trackback:ping><description><![CDATA[     摘要: Oracle 备䆾与恢复案? By Piner   一. 理解什么是数据库恢复 ? 当我们用一个数据库...  <a href='http://www.aygfsteel.com/fine/archive/2007/03/16/104237.html'>阅读全文</a><img src ="http://www.aygfsteel.com/fine/aggbug/104237.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/fine/" target="_blank">Peter Pan</a> 2007-03-16 13:45 <a href="http://www.aygfsteel.com/fine/archive/2007/03/16/104237.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>安装SQL SERVER2000?错误http://www.aygfsteel.com/fine/archive/2007/03/13/103546.htmlPeter PanPeter PanTue, 13 Mar 2007 07:43:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/13/103546.htmlhttp://www.aygfsteel.com/fine/comments/103546.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/13/103546.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/103546.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/103546.html
q行Regedit.exe
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager
清空PendingFileRenameOperations中的内容

Peter Pan 2007-03-13 15:43 发表评论
]]>
Oracle Base Sqlhttp://www.aygfsteel.com/fine/archive/2007/03/13/103543.htmlPeter PanPeter PanTue, 13 Mar 2007 07:24:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/13/103543.htmlhttp://www.aygfsteel.com/fine/comments/103543.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/13/103543.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/103543.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/103543.htmlselect * from user_objects --where object_name = 'T_CUSTOMER';
--
select * from user_source

Peter Pan 2007-03-13 15:24 发表评论
]]>
oracle INDEX BY Pl/sql数组http://www.aygfsteel.com/fine/archive/2007/03/12/103358.htmlPeter PanPeter PanMon, 12 Mar 2007 09:31:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/12/103358.htmlhttp://www.aygfsteel.com/fine/comments/103358.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/12/103358.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/103358.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/103358.html--INDEX BY Pl/sql数组
SET SERVEROUTPUT ON
DECLARE
       TYPE NumberTab IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
       v_Numbers NumberTab;
BEGIN
     FOR v_Count in 1..10 LOOP
         v_Numbers(v_Count) := v_Count * 10;
     END LOOP;
    
     DBMS_OUTPUT.put_line('Table elements: ');
     FOR v_Count IN 1..10 LOOP
         DBMS_OUTPUT.put_line(' v_Numbers('|| v_Count||'): '||v_Numbers(v_Count));
     END LOOP;
    
  BEGIN
       DBMS_OUTPUT.put_line('v_Numbers(11): '|| v_Numbers(11));
  EXCEPTION
           WHEN NO_DATA_FOUND THEN
                DBMS_OUTPUT.put_line('No data found reading v_Numbers(11)!');
  END;
END;

--INDEX BY Pl/sql数组002
SET SERVEROUTPUT ON
declare
       type T_customerTab is table of t_customer%rowtype index by binary_integer;
       t_customers T_customerTab;
begin
          select * into t_customers(1) from t_customer where rownum = 1;    
          DBMS_OUTPUT.put_line( 'customer_name: '||t_customers(1).customer_id || ' customer_name: '||t_customers(1).customer_name);
end;



Peter Pan 2007-03-12 17:31 发表评论
]]>
ORACLE DBMS_UTILITY.format_call_stack 001http://www.aygfsteel.com/fine/archive/2007/03/09/102880.htmlPeter PanPeter PanFri, 09 Mar 2007 09:20:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/09/102880.htmlhttp://www.aygfsteel.com/fine/comments/102880.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/09/102880.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/102880.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/102880.htmlSET SERVEROUTPUT ON
BEGIN
     DBMS_OUTPUT.put_line('A BEGIN');
       BEGIN
            DBMS_OUTPUT.put_line('B BEGIN');
              DECLARE
                     v_CallStack      VARCHAR2(2000);
              BEGIN
                   DBMS_OUTPUT.put_line('C BEGIN');
                   v_CallStack := DBMS_UTILITY.format_call_stack;
                   DBMS_OUTPUT.put_line(v_CallStack);
                   DBMS_OUTPUT.put_line('C END');
              END;
            DBMS_OUTPUT.put_line('B END');
       END;
     DBMS_OUTPUT.put_line('A END');
END;

--DBMS_UTILITY.format_call_stack
SET SERVEROUTPUT ON
DECLARE
       v_CallStack      VARCHAR2(2000);
BEGIN
       DBMS_OUTPUT.put_line('C BEGIN');
       v_CallStack := DBMS_UTILITY.format_call_stack;
       DBMS_OUTPUT.put_line(v_CallStack);
       DBMS_OUTPUT.put_line('C END');
END;
--l果
/*
C BEGIN
----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
135576A4         5  anonymous block

C END
*/


/**
   CREATE OR REPLACE PROCEDURE C AS
        v_CallStack      VARCHAR2(2000);
   BEGIN
        v_CallStack := DBMS_UTILITY.format_call_stack;
   END C;
  
   CREATE OR REPLACE PROCEDURE B AS
   BEGIN
        C;
   END B;
  
   CREATE OR REPLACE PROCEDURE A AS
   BEGIN
        B;
   END A;
 
 
--cMl果
C BEGIN
----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
135576A4         4  PROCEDURE C
135576A4         5  PROCEDURE B
135576A4         5  PROCEDURE A
135576A4         5  anonymous block

C END
*/



Peter Pan 2007-03-09 17:20 发表评论
]]>
ORACLE EXCEPTION 001http://www.aygfsteel.com/fine/archive/2007/03/09/102868.htmlPeter PanPeter PanFri, 09 Mar 2007 08:40:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/09/102868.htmlhttp://www.aygfsteel.com/fine/comments/102868.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/09/102868.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/102868.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/102868.html--定义EXCEPTION
SET SERVEROUTPUT ON
DECLARE
       A exception;
BEGIN
      RAISE A;
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('EXCEPTION A!');
         WHEN OTHERS THEN
              ROLLBACK; 
                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');    
END;
--l果
--EXCEPTION A!

--EXCEPTION 001
SET SERVEROUTPUT ON
DECLARE
       A exception;
       B exception;
BEGIN  
     RAISE B;
       BEGIN
              RAISE A;
       EXCEPTION
                WHEN A THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION A!');
                WHEN B THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION B!');               
       END; 
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION A!');
         WHEN B THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!');  
         WHEN OTHERS THEN
         ROLLBACK; 
                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');  
END;
--l果
--OUT EXCEPTION B!

--EXCEPTION 002
SET SERVEROUTPUT ON
DECLARE
       A exception;
       B exception;
BEGIN  
       BEGIN
              RAISE A;
       EXCEPTION
                WHEN A THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION A!');
                WHEN B THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION B!');               
       END;
    RAISE B;
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION A!');
         WHEN B THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!');
         WHEN OTHERS THEN
         ROLLBACK; 
                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');     
END;
--l果
--IN EXCEPTION A!
--OUT EXCEPTION B!

--EXCEPTION 003
SET SERVEROUTPUT ON
DECLARE
       A exception;
       B exception;
BEGIN  
       BEGIN
              RAISE A;
       EXCEPTION
                WHEN B THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION B!');               
       END;
    RAISE B;
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION A!');
         WHEN B THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!'); 
         WHEN OTHERS THEN
         ROLLBACK; 
                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');    
END;
--l果
--OUT EXCEPTION A!

--EXCEPTION 004
SET SERVEROUTPUT ON
DECLARE
       A exception;
       B exception;
       C exception;
BEGIN 
   RAISE C;
       BEGIN
              RAISE A;
       EXCEPTION
                WHEN B THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION B!');               
       END;
    RAISE B;
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION A!');
         WHEN B THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!'); 
         WHEN OTHERS THEN
         ROLLBACK; 
                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');    
END;
--l果
--OTHERS EXCEPTION!

--EXCEPTION 005
SET SERVEROUTPUT ON
DECLARE
       A exception;
       B exception;
       C exception;
BEGIN 
       BEGIN
              RAISE A;
       EXCEPTION
                WHEN A THEN
                  RAISE C;
                WHEN B THEN
                     DBMS_OUTPUT.put_line('IN EXCEPTION B!');               
       END;
    RAISE B;
EXCEPTION
         WHEN A THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!');
         WHEN B THEN
                  DBMS_OUTPUT.put_line('OUT EXCEPTION B!'); 
         WHEN OTHERS THEN
         ROLLBACK; 

                    DBMS_OUTPUT.put_line('OTHERS EXCEPTION!');    
END;
--l果Q?br />--OTHERS EXCEPTION!



Peter Pan 2007-03-09 16:40 发表评论
]]>
oracle procedures 001http://www.aygfsteel.com/fine/archive/2007/03/09/102842.htmlPeter PanPeter PanFri, 09 Mar 2007 07:30:00 GMThttp://www.aygfsteel.com/fine/archive/2007/03/09/102842.htmlhttp://www.aygfsteel.com/fine/comments/102842.htmlhttp://www.aygfsteel.com/fine/archive/2007/03/09/102842.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/102842.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/102842.html--单@?br />SET SERVEROUTPUT ON
DECLARE
       v_t_customer t_customer%ROWTYPE;
       v_customer_id t_customer.customer_id%TYPE;
       v_customer_name t_customer.customer_name%TYPE;
       CURSOR c_t_customer IS
        --select customer_id,customer_name from t_customer where rownum <= 10;
        select * from t_customer where rownum <= 10;
BEGIN
     OPEN c_t_customer;
       LOOP
         --fetch c_t_customer into v_customer_id,v_customer_name;
         FETCH c_t_customer INTO v_t_customer;
        
         dbms_output.put_line('customer_id :'||v_t_customer.customer_id||' customer_name :'||v_t_customer.customer_name);
         EXIT WHEN c_t_customer%NOTFOUND;
       END LOOP;
     CLOSE c_t_customer;
EXCEPTION
         WHEN OTHERS THEN
         ROLLBACK; 
         DBMS_OUTPUT.put_line('exception'); 
END;
     
--WHILE循环
SET SERVEROUTPUT ON
DECLARE
       v_t_customer t_customer%ROWTYPE;
       v_customer_id t_customer.customer_id%TYPE;
       v_customer_name t_customer.customer_name%TYPE;
       CURSOR c_t_customer IS
        --select customer_id,customer_name from t_customer where rownum <= 10;
        select * from t_customer where rownum <= 10;
BEGIN
     OPEN c_t_customer;
       --fetch c_t_customer into v_customer_id,v_customer_name;
       FETCH c_t_customer INTO v_t_customer;
       WHILE c_t_customer%FOUND LOOP
         --fetch c_t_customer into v_customer_id,v_customer_name;
         FETCH c_t_customer INTO v_t_customer;
         dbms_output.put_line('customer_id :'||v_t_customer.customer_id||' customer_name :'||v_t_customer.customer_name);
       END LOOP;
     CLOSE c_t_customer;
EXCEPTION
         WHEN OTHERS THEN
         ROLLBACK; 
         DBMS_OUTPUT.put_line('exception'); 
END;

--游标FOR循环
SET SERVEROUTPUT ON
DECLARE
       v_t_customer t_customer%ROWTYPE;
       v_customer_id t_customer.customer_id%TYPE;
       v_customer_name t_customer.customer_name%TYPE;
       CURSOR c_t_customer IS
        --select customer_id,customer_name from t_customer where rownum <= 10;
        select * from t_customer where rownum <= 10;
BEGIN
       FOR v_t_customer IN c_t_customer LOOP
         dbms_output.put_line('customer_id :'||v_t_customer.customer_id||' customer_name :'||v_t_customer.customer_name);
       END LOOP;
EXCEPTION
         WHEN OTHERS THEN
         ROLLBACK; 
         DBMS_OUTPUT.put_line('exception'); 
END;



Peter Pan 2007-03-09 15:30 发表评论
]]>
oracle实现Treehttp://www.aygfsteel.com/fine/archive/2007/02/07/98549.htmlPeter PanPeter PanWed, 07 Feb 2007 03:43:00 GMThttp://www.aygfsteel.com/fine/archive/2007/02/07/98549.htmlhttp://www.aygfsteel.com/fine/comments/98549.htmlhttp://www.aygfsteel.com/fine/archive/2007/02/07/98549.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/98549.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/98549.htmlselect a.*,level from t_customer a
start with customer_id = 'AABB10000010'
connect by prior customer_id = parent_cust_id

select a.*, level
from t_industry a
start with industry_id  = 'B03'
connect by prior industry_id = parent_id

--connect String
select Substr('bbbcbdb',1,2) ||replace(Substr('bbbcbdb',3,4),'b','a') ||Substr('bbbcbdb',7,1) from dual


 select Replace(customer_name, '->','') as all_customer_name,rownum from (
 select sys_connect_by_path(customer_name, '->') customer_name from (
  select a.customer_name, (level - 1) ll,level l
  from t_customer a
  start with customer_id = 'SH02110000893' connect by prior parent_cust_id=customer_id order by l desc
  )
  connect by prior ll= l order by level desc
  ) c where rownum <2 

Ҏ字节Ҏ出全?br />with temp as(
select a.*, (level - 1) ll, level l
  from t_content_type a
 start with a.type_id = '20000000138418'
connect by prior a.parent_type_id = a.type_id
 order by l desc
)
select sys_connect_by_path(temp.type_name, '/') path
  from temp
 start with temp.parent_type_id = '0'
connect by prior temp.type_id = temp.parent_type_id



Peter Pan 2007-02-07 11:43 发表评论
]]>
ora的中出现的一些小问题http://www.aygfsteel.com/fine/archive/2007/01/19/94851.htmlPeter PanPeter PanFri, 19 Jan 2007 01:21:00 GMThttp://www.aygfsteel.com/fine/archive/2007/01/19/94851.htmlhttp://www.aygfsteel.com/fine/comments/94851.htmlhttp://www.aygfsteel.com/fine/archive/2007/01/19/94851.html#Feedback0http://www.aygfsteel.com/fine/comments/commentRss/94851.htmlhttp://www.aygfsteel.com/fine/services/trackbacks/94851.html今天遭遇ORA-12560: TNS: 协议适配器错误的问题Q经q一番努力问题已l解冻I与大家共享?br />造成ORA-12560: TNS: 协议适配器错误的问题的原因有三个Q?br />1.监听服务没有赯v来。windowsq_个一如下操作Q开?--E序---理工具---服务Q打开服务面板

Q启动oraclehome92TNSlistener服务?br />2.database instance没有赯v来。windowsq_如下操作Q开?--E序---理工具---服务Q打开服务
面板Q启动oracleserviceXXXX,XXXX是你的database SID.
3.注册表问题。regeditQ然后进入HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0该环境变量

ORACLE_SID讄为XXXX,XXXX是你的database SID.或者右几我的电脑,属?-高--环境变量---pȝ

变量--新徏Q变量名=oracle_sid,变量?XXXX,XXXX是你的database SID.或者进入sqlplus前,?/p>

command line下输set oracle_sid=XXXX,XXXX是你的database SID.
l过以上步骤Q就可以解决问题

1、ORAQ?2541QTNSQ没有监听器
  原因Q没有启动监听器或者监听器损坏。如果是前者,使用命onet start

OracleOraHome81TNSListenerQ名字可能有出入Q即可;如果是后者,则用“Net8 Configuration

Assistant”工具向g“监听程序配|”增加一个监听器卛_Q基本不用写M信息Q一路OK。在d

之前可能需要把所有的监听器先删除Q)
2、ORAQ?2500QTNSQ监听程序无法启动专用服务器q程或ORAQ?2560QTNSQ协议适配器错?br />  原因QORACLE的数据库服务没有启动。用命令net start ORACLESERVICEORADBQORADB为数据库?/p>

字)卛_。如果仍没有解决Q请l箋向下看?/p>

3、如果数据库服务启动p|Q则很有可能是其注册表项值损坏,最好的做法是以下两步:
  1QORADIM -DELETE -SID oradb 删除数据库服务项
  2QORADIM -NEW -SID oradb 新增数据库服务项
  注:q个q程中如果出错,重启计机Q?br />4、ORAQ?2154QTNSQ能解析服务?br />  原因QORACLE的网l服务名没有正确配置。请使用“Net8 Configuration Assistant”工具向g

“本地网l服务名配置”配|TNS卛_。如果仍没有解决Q请l箋向下看?br />5、ORAQ?034 QTNSQORACLE不可?br />  原因QORACLE的数据库服务正确启动Q但是数据库没有打开Q?br />  使用命oQ?br />  1Qsvrmgrl  启动服务理?br />  2Qconnect internal 以internalw䆾登陆
  3Qstartup  打开数据?br />6、ORAQ?2560QTNSQ协议适配器错误(固性的Q?br />  原因Q未知?br />  解决Q必杀技Q-打开“Windowsd理器”,杀死ORACLE.exe及ORADIM.exeq程Q书写自q

ora_startup.batQ执行之Q?br />PSQ?br />1、我的ora_startup.batQ?br />net start OracleOraHome81TNSListener
net start ORACLESERVICEORADB
svrmgrl 一般情况下不用Q不q有时少不了它的Q具体步骤见W?步?br />2、我的ora_shutdown.batQ?br />net stop OracleOraHome81TNSListener
net stop ORACLESERVICEORADB
?br />  ORACLE_HOME=/u01/app/oracle/product/8.1.6
  export ORACLE_HOME/包括Oracle软g的目录?
  LD_LIBRARY_PATH=/u01/app/oracle/product/8.1.6/lib;
  export LD_LIBRARY_PATH
  ORACLE_BASE=/u01/app/oracle
  export ORACLE_BASE/包括Oracle软g的目录和理软g的目录?
  ORACLE_SID=ORCL
  export ORACLE_SID/缺省数据库的标识?
  ORACLE_TERM=vt100
   export ORACLE_TERM
  ORA_NLS33=/u01/app/oracle/product/8.1.6/
  ocommon/nls/admin/data
  export ORA_NLS33 /语a支持?
  PATH=$PATH: /u01/app/oracle/product/8.1.6/bin
  export PATH



Peter Pan 2007-01-19 09:21 发表评论
]]>
վ֩ģ壺 ˮ| ľ| | | | | γ| | | | ƽ| | Ԫ| ʼ| ԭ| ƽ| | | | | | | ƽ| | Ԫ| | | | | ݳ| ʯ| | | Դ| ͷ| | | | | | |