Thomas Zhang的杂货铺
30 06, 2008
强悍的SQLTXPLAIN
作者 tomszrp 23:08 | Permalink 静态链接网址 | Comments 最新回复 (2) | Trackback 引用 (0) | PUB论剑

今天下载了SQLTXPLAIN的最新版本,并在自己的本子上做了一个体验,这个工具最早我在使用8i的时候用过一次,后来在因为绝大部分情况下用不着她,就慢慢的遗忘了,今天下载了最新的针对9i,10g,11g的新版本,在更新自己的资料库的时候才发现,很前就玩过了,没想到她也一直在"成长"。

这是一个全面的、强大的分析和调优SQL语句的有力工具

工具需要到metalink上download
SQLTXPLAIN Directory Structure
sqlt/
install/
run/
sample/
在zip文件里包含详细的说明和demo.说明写的很详细

工具的安装和卸载类似statspack这样的工具
conn /as sysdba
start sqcreate.sql
然后按照提示输入密码、表空间和临时表空间就OK了。

conn /as sysdba
start sqdrop.sql

需要注意的是:
1)在安装sqltxplain之前,你必须要确保你的系统中已经安装了如下4个package.
sys.dbms_metadata
sys.dbms_random
sys.utl_file
sys.dbms_shared_pool
2)在安装的过程中会提示你输入一个Host String (TNS Alias),记得一定要加上@
比如我的Host String为ora10g,那么要输入@ora10g
3)如果你的temp 表空间比较小的话,记得一定要将tempfile resize一下,比如到200M,因为这个工具中使用了很多的
临时表。如果你希望永久保存的话,那么就需要手工修改一下sqctab.sql这个脚本了。
4)有一些bug会影响到SQLTXPLAIN的,所以你需要自己的阅读一下instructions.txt

SQLTXPLAIN的调用有三种方式:
XPLAIN - Given one SQL, it generates its explain plan without executing the SQL
XTRACT - Given an id for a known SQL, it extracts the SQL and its actual execution plan from memory
XECUTE - Given a script that contains one SQL and its bind variables (declaration and values),
it executes the SQL and extracts its execution plan form memory

使用起来比较简单,但输出的结果太完美了,不罗嗦了。大家赶紧去体验一下就知道了。

31 08, 2007
dbms_metadata获取的表结构和desc出来的不一致的一个demo
作者 tomszrp 13:06 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑
这个问题源至一位puber的问题。

实际上不能说是一个问题, 只是因为该表采用了基于rowid的方式做过
在线重定义而多出来的一个隐藏列。这个隐藏列通过desc是看不到的。
而metadata.get_ddl可以读取到,下面再现一下:

目的:把一个普通表在线重定义为hash partition table.

测试环境:xp+10.2.0.1


SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE	10.2.0.1.0	Production

TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

SQL> 
SQL> create table zrp
  2  (oid number,
  3   dealdate date default sysdate
  4  );

Table created

SQL> begin
  2   for i in 1..100 loop
  3       insert into zrp (oid) values(i);
  4   end loop;
  5   commit;
  6  end;
  7  /

PL/SQL procedure successfully completed

SQL> 
SQL> create table ZRP_MID
  2  (
  3    OID      NUMBER,
  4    DEALDATE DATE default sysdate
  5  )
  6  partition by hash (OID)
  7  ( partition p1 tablespace STUDY,
  8    partition p2 tablespace STUDY,
  9    partition p3 tablespace STUDY,
 10    partition p4 tablespace STUDY
 11  );

Table created

SQL> exec dbms_redefinition.can_redef_table(
       'STUDY',
       'ZRP',
       dbms_redefinition.cons_use_rowid);

PL/SQL procedure successfully completed

SQL> exec dbms_redefinition.start_redef_table(
      'study',
      'ZRP',
      'ZRP_MID',
      'oid oid,dealdate dealdate',
      dbms_redefinition.cons_use_rowid);

PL/SQL procedure successfully completed

SQL> exec dbms_redefinition.finish_redef_table('STUDY','ZRP','ZRP_MID');

PL/SQL procedure successfully completed

SQL> desc zrp
Name     Type   Nullable Default Comments 
-------- ------ -------- ------- -------- 
OID      NUMBER Y                         
DEALDATE DATE   Y        sysdate          

SQL> desc zrp_mid
Name     Type   Nullable Default Comments 
-------- ------ -------- ------- -------- 
OID      NUMBER Y                         
DEALDATE DATE   Y        sysdate          

SQL> 
SQL> select dbms_metadata.get_ddl('TABLE','ZRP') from dual;

DBMS_METADATA.GET_DDL('TABLE',
------------------------------------------------------
CREATE TABLE "STUDY"."ZRP"
(	"SYS_C00003_07083112:38:30$" VARCHAR2(255),
	"OID" NUMBER,
	"DEALDATE" DATE DEFAULT sysdate
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(BUFFER_POOL DEFAULT)
  TABLESPACE "STUDY"
  PARTITION BY HASH ("OID")
  (PARTITION "P1"  TABLESPACE "STUDY",
   PARTITION "P2"  TABLESPACE "STUDY",
   PARTITION "P3"  TABLESPACE "STUDY",
   PARTITION "P4"  TABLESPACE "STUDY")
SQL> 

这个时候我们看到,多出了一列,其实这一列是因为我们采用基于rowid的
方式在线重定义而增加的一个隐藏列。在9i中这个列名为M_ROW$$,在10g中
采用了新的命名机制:
  SYS_C<5位的数字>_yymmddhh24:mi:ss$
  比如:SYS_C00003_07083112:38:30$
  这个格式的官方doc我还不曾看到(没来得及学习),是我猜出来的,其中5位
  数字编码应该是列的序号,不知道是否这样。   

SQL> select col#,name,type#
  2  from SYS.COL$
  3  WHERE OBJ#=(select object_id
  4              from dba_objects
  5              where owner='STUDY' and
  6                    object_name='ZRP' And
  7                    object_type='TABLE');

      COL# NAME                                TYPE#
---------- ------------------------------ ----------
         1 OID                                     2
         2 DEALDATE                               12
         0 SYS_C00003_07083112:38:30$              1

SQL> 

SQL> alter table zrp set unused column "SYS_C00003_07083112:38:30$";

Table altered

SQL> alter table zrp drop unused columns;

Table altered

SQL> desc zrp
Name     Type   Nullable Default Comments 
-------- ------ -------- ------- -------- 
OID      NUMBER Y                         
DEALDATE DATE   Y        sysdate          

SQL> 
SQL> select col#,name,type#
  2  from SYS.COL$
  3  WHERE OBJ#=(select object_id
  4              from dba_objects
  5              where owner='STUDY' and
  6                    object_name='ZRP' And
  7                    object_type='TABLE');

      COL# NAME                                TYPE#
---------- ------------------------------ ----------
         1 OID                                     2
         2 DEALDATE                               12

SQL> insert into zrp values(2000,sysdate);

1 row inserted

SQL> commit;

Commit complete

SQL> 

再看一下通过metadata.get_ddl得到的结果:

SQL> Select dbms_metadata.get_ddl('TABLE','ZRP') From dual;

DBMS_METADATA.GET_DDL('TABLE',
----------------------------------------
CREATE TABLE "STUDY"."ZRP"
(	"OID" NUMBER,
	"DEALDATE" DATE DEFAULT sysdate
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  STORAGE(BUFFER_POOL DEFAULT)
  TABLESPACE "STUDY"
  PARTITION BY HASH ("OID")
  (PARTITION "P1"   TABLESPACE "STUDY",
   PARTITION "P2"   TABLESPACE "STUDY",
   PARTITION "P3"   TABLESPACE "STUDY",
   PARTITION "P4"   TABLESPACE "STUDY")
SQL> 
这个就和我们期望的一样了。

进一步测试发现,如果直接drop这个隐藏列,这个版本上将导致
insert/update操作异常,下面再现一下:

SQL> alter table zrp drop column "SYS_C00003_07083113:30:37$";

Table altered

SQL> insert into zrp values(2000,sysdate);

insert into zrp values(2000,sysdate)

ORA-00600:内部错误代码,参数:[kghGetHpSz1],[0x64F0A8D4],
[],[],[],[],[],[]

SQL> delete from zrp where oid=1;

1 row deleted

SQL> desc zrp;
Name     Type   Nullable Default Comments 
-------- ------ -------- ------- -------- 
OID      NUMBER Y                         
DEALDATE DATE   Y        sysdate          

SQL> update zrp set dealdate =sysdate where oid=2;

update zrp set dealdate =sysdate where oid=2

ORA-00957: 重复的列名

SQL> update zrp set oid=20000 where oid=2;

update zrp set oid=20000 where oid=2

ORA-00600:内部错误代码,参数:[13013],[5001],[54641],[25166861],
[0],[25166861],[17],[]

SQL> 

22 08, 2007
使用dbms_metadata遇到ORA-31603的一种情况
作者 tomszrp 19:31 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

使用dbms_metadata获取object的ddl语句时,有时会遇到ORA-31603这样的错误,大部分情况是因为使用者写错了object_type或忘记了schema参数.

但也有这样的情况,如下的情况的是在9206上遇到的,其他版本我还没测试过.

场景:对分区表存在unused column的时候,使用dbms_metadata.gete_ddl返回ORA-31603

下面再现一下:

SQL> select *from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production

TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production

SQL>
SQL> create table zrp(
2 areacode number(3),
3 name varchar2(32),
4 oid number,
5 recdate date
6 )
7 partition by range(areacode)
8 (partition p_1 values less than(100),
9 partition p_2 values less than(200),
10 partition p_3 values less than(300)
11 );

Table created

SQL> set long 20000
SQL> Select dbms_metadata.get_ddl('TABLE','ZRP') From dual;

DBMS_METADATA.GET_DDL('TABLE',
-------------------------------------------------------------
CREATE TABLE "STUDY"."ZRP"
( "AREACODE" NUMBER(3,0),
"NAME" VARCHAR2(32),
"OID" NUMBER,
"RECDATE" DATE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE
(
BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000"
PARTITION BY RANGE ("AREACODE")
(PARTITION "P_1" VALUES LESS THAN (100)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS ,
PARTITION "P_2" VALUES LESS THAN (200)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS ,
PARTITION "P_3" VALUES LESS THAN (300)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS )


SQL> alter table zrp set unused column recdate;

Table altered

SQL>
SQL> Select dbms_metadata.get_ddl('TABLE','ZRP') From dual;

Select dbms_metadata.get_ddl('TABLE','ZRP') From dual

ORA-31603: object "ZRP" of type TABLE not found in schema "STUDY"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 628
ORA-06512: at "SYS.DBMS_METADATA", line 1222
ORA-06512: at line 1

SQL> Select obj#,Name From Sys.col$ Where obj#=
2 (Select object_id
3 From dba_objects
4 Where object_name='ZRP' And
5 owner=STUDYAnd
6 object_type='TABLE');

OBJ# NAME
---------- ------------------------------
352622 AREACODE
352622 NAME
352622 OID
352622 SYS_C00004_07082213:34:03$

SQL>
SQL> Select obj#,Name From Sys.col$ Where obj#=
2 (Select object_id
3 From dba_objects
4 Where object_name='ZRP' And
5 owner='STUDY' And
6 object_type='TABLE');

OBJ# NAME
---------- ------------------------------
352622 AREACODE
352622 NAME
352622 OID
352622 SYS_C00004_07082213:34:03$

SQL> alter table zrp drop unused columns;

Table altered

SQL>
SQL> Select obj#,Name From Sys.col$ Where obj#=
2 (Select object_id
3 From dba_objects
4 Where object_name='ZRP' And
5 owner='STUDY' And
6 object_type='TABLE');

OBJ# NAME
---------- ------------------------------
352622 AREACODE
352622 NAME
352622 OID

SQL>
SQL> Select dbms_metadata.get_ddl('TABLE','ZRP') From dual;

DBMS_METADATA.GET_DDL('TABLE',
-------------------------------------------------------------------
CREATE TABLE "STUDY"."ZRP"
( "AREACODE" NUMBER(3,0),
"NAME" VARCHAR2(32),
"OID" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000"
PARTITION BY RANGE ("AREACODE")
(PARTITION "P_1" VALUES LESS THAN (100)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS ,
PARTITION "P_2" VALUES LESS THAN (200)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS ,
PARTITION "P_3" VALUES LESS THAN (300)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "D_DATA_000" NOCOMPRESS )


SQL>


26 07, 2007
如何让SPOOL出来的文件不含执行的SQL语句
作者 tomszrp 20:57 | Permalink 静态链接网址 | Comments 最新回复 (2) | Trackback 引用 (0) | PUB论剑

今天看到这么一个问题,其实这个问题我在平时工作也经常遇到,只不过aix下的shell太强大了,

根本不需要考虑的这么复杂。

比如aix下可以通过sed来进行删除,很方便的
$ sed /SQL/d source_file >target_file

当然了, 这个问题,也可以通过sqlplus自身来完成这个动作。只不过就是罗嗦一点。

一般分为2个SQL文件
1)执行SQL的文件
2)调用1)中的sql完成spool的文件


比如我下面的这个例子中,data.sql是用来真正取数据的SQL文件,do.sql是用来完成spool

动作的SQL文件。
 

data.sql内容如下:

select * from zrp;

do.sql 是完成spool的SQL文件,在do.sql中调用了data.sql,内容如下:
set heading off feedback off term off pagesize 0
spool e:info.txt
@e:data.sql
spool off
exit


然后测试看看:

E:>sqlplus study/study @do.sql

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 7月 26 12:46:42 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开

E:>more info.txt
1
2
3
4
5
6
7
8


E:>

另外也可以使用类似如下的bat文件完成(unix的shell scripts就更简单了,不再多说).

 

edit test.bat

sqlplus -s /nolog @e:data.sql

 

data.sql的内容如下:

conn study/study
set heading off feedback off term off pagesize 0
spool e:info.txt
select * from zrp;
spool off
exit


13 07, 2007
Oracle OS Watcher使用说明(7)
作者 tomszrp 21:24 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

使用OSWg的注意事项

 

如果我们需要分析的文件很多,那么java需要更多memory,否则可能会遇到类似如下的错误:

java.lang.OutOfMemoryError

 

这个时候,我们就不得不增加java heap的大小。如果要增加java heap的大小,可以通过使用-Xmx 参数来设置,比如:

java -jar -Xmx10M OSWg.jar -i /oracle/osw/archive

 

[cs1] /oracle/osw> java -jar -Xmx10M OSWg.jar -i /oracle/osw/archive

Starting OSWg V2.0.4
OSWatcher Graph Written by Oracle Center of Expertise
Copyright (c) 2007 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file cs1_vmstat_07.13.07.1000.dat ...
Parsing file cs1_vmstat_07.13.07.1100.dat ...

Parsing Completed.


Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs

Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently Displayed Graphs
Enter Q to Quit Program

Please Select an Option:


13 07, 2007
Oracle OS Watcher使用说明(6)
作者 tomszrp 21:22 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

[cs1] /oracle/osw> java -jar OSWg.jar -i /oracle/osw/archive

Starting OSWg V2.0.4
OSWatcher Graph Written by Oracle Center of Expertise
Copyright (c) 2007 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file cs1_vmstat_07.13.07.1000.dat ...
Parsing file cs1_vmstat_07.13.07.1100.dat ...

Parsing Completed.


Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs

Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently Displayed Graphs
Enter Q to Quit Program

Please Select an Option:6

OSWG_RunQueue.gif
OSWG_BlockQueue.gif
OSWG_CpuIdle.gif
OSWG_CpuSystem.gif
OSWG_CpuUser.gif
OSWG_Interrupts.gif
OSWG_CS.gif


Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs

Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently Displayed Graphs
Enter Q to Quit Program

Please Select an Option:q

[cs1] /oracle/osw>

如果要查看输出结果,可以直接在上面的菜单中选择你要查看的信息。

说明:图片上传比较麻烦,我就不上传了,大家测试一下就可以看到效果了


13 07, 2007
Oracle OS Watcher使用说明(5)
作者 tomszrp 21:20 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

OSW的诊断信息字段含义说明

 

 

字段

描述
oswiostat
tinShows the total number of characters read by the system for all ttys
toutShows the total number of characters written by the system to all ttys.
kpsindicates the amount of data transferred (read or written) to the drive in KB per second
tpsIndicates the number of transfers per second that were issued to the physical disk. A transfer is an I/O request to the physical disk. Multiple logical requests can be combined into a single I/O request to the disk.
servaverage response time of transactions, in milliseconds
usPercentage of CPU cycles spent on user processes
syPercentage of CPU cycles spent on system processes wt
wtShows the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request
id
 
Percentage of unused CPU cycles or idle time when the CPU is basically doing nothing .
oswmpstat
cpuProcessor ID
minfMinor faults
mifMajor Faults
xcalProcessor cross-calls (when one CPU wakes up another by interrupting it).
intrInterrupts
ithr
 
Interrupts as threads (except clock)
cswContext switches
icswInvoluntary context switches
migrThread migrations to another processor
smtxNumber of times a CPU failed to obtain a mutex
srwNumber of times a CPU failed to obtain a read/write lock on the first try
sysclNumber of system calls
usrPercentage of CPU cycles spent on user processes
sysPercentage of CPU cycles spent on system processes
wtPercentage of CPU cycles spent waiting on event
idlPercentage of unused CPU cycles or idle time when the CPU is basically doing nothing
oswnetstat
nameDevice name of interface
MtuMaximum transmission unit
NetNetwork Segment Address
addressNetwork address of the device
ipktsInput packets
IerrsInput errors
opktsOutput Packets
OerrsOutput errors
collisCollisions
queueNumber in the Queue
oswps
fFlags s State of the process
uidThe effective user ID number of the process
pidThe process ID of the process
ppidThe process ID of the parent process.
dProcessor utilization for scheduling (obsolete).
priThe priority of the process.
niNice value, used in priority computation.
addrThe memory address of the process.
szThe total size of the process in virtual memory, including all mapped files and devices, in pages.
wchanThe address of an event for which the process is sleeping (if blank, the process is running).
stimeThe starting time of the process, given in hours, minutes, and seconds.
ttyThe controlling terminal for the process (the message ?, is printed when there is no controlling terminal).
timeThe cumulative execution time for the process.
cmdThe command name process is executing.
oswtop
PID Process ID of process
USERNAMEUsername of process
THRProcess thread PRI Priority of process
NICENice value of process
SIZETotal size of a process, including code and data, plus the stack space in kilobytes
RESAmount of physical memory used by the process
STATECurrent CPU state of process. The states can be S for sleeping, D for uninterrupted, R for running, T for stopped/traced, and Z for zombied
TIMEThe CPU time that a process has used since it started
%CPUThe CPU time that a process has used since the last update
COMMANDThe task's command name
oswvmstat
PROCS
rNumber of processes that are in a wait state and basically not doing anything but waiting to run
bNumber of processes that were in sleep mode and were interrupted since the last update
wNumber of processes that have been swapped out by mm and vm subsystems and have yet to run
MEMORY
swapThe amount of swap space currently available free The size of the free list
PAGE
repage reclaims
mfminor faults
pikilobytes paged in
pokilobytes paged out
frkilobytes freed
deanticipated short-term memory shortfall (Kbytes)
srpages scanned by clock algorithm
DISK
BiDisk blocks sent to disk devices in blocks per second
FAULTS
InInterrupts per second, including the CPU clocks
SySystem calls
CsContext switches per second within the kernel
CPU
UsPercentage of CPU cycles spent on user processes
SyPercentage of CPU cycles spent on system processes
IdPercentage of unused CPU cycles or idle time when the CPU is basically doing nothing


13 07, 2007
Oracle OS Watcher使用说明(3)
作者 tomszrp 21:18 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

OSW的启动

 

启动OSW非常简单。只要运行startOSW.sh就可以了。该shell 需要2个参数,第一个参数指定采样时间间隔,第二个指定存储数据的时间。缺省情况下(如果不输入参数),OSW采样以30秒为间隔,存储24小时的数据.

 

对于超过保留期限的数据,File Manager 会自动清理(File Manager 每隔一个小时调度一次)

 

下面是我在cs1上运行的启动过程:

[cs1] /oracle/osw> startOSW.sh 60 1
Testing for discovery of OS Utilities...
VMSTAT found on your system.IOSTAT found on your system.MPSTAT found on your system.NETSTAT found on your system.

Discovery completed.

Starting OSWatcher V2.0.2 on Fri Jul 13 10:24:43 BEIST 2007
With SnapshotInterval = 60
With ArchiveInterval = 1
OSWatcher - Written by Carl Davis, Center of Expertise, Oracle Corporation

Starting Data Collection...
osw heartbeat:Fri Jul 13 10:24:43 BEIST 2007

[cs1] /oracle/osw>

 

OSW的停止

 

停止OSW 服务,通过stopOSW.sh来完成

 

./stopOSW.sh


13 07, 2007
Oracle OS Watcher使用说明(4)
作者 tomszrp 21:18 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

OSW的诊断输出

 

运行osw后,收集的信息被放在archive下的对应的7个子目录下,以ascii格式存放。文件命名格式如下:

<node_name>_<OS_utility>_MM.DD.YY.HH24.dat

 

比如我测试收集到的文件如下:

[cs1] /oracle/osw/archive> ls -ltrR
total 0
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswprvtnet
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswvmstat
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswtop
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswps
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswnetstat
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswmpstat
drwxr-xr-x 2 oracle dba 256 Jul 13 11:00 oswiostat
./oswprvtnet:
total 0

./oswvmstat:
total 48
-rw-r--r-- 1 oracle dba 18199 Jul 13 10:59 cs1_vmstat_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 3024 Jul 13 11:05 cs1_vmstat_07.13.07.1100.dat

./oswtop:total 1704
-rw-r--r-- 1 oracle dba 741040 Jul 13 10:59 cs1_top_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 122988 Jul 13 11:05 cs1_top_07.13.07.1100.dat

./oswps:
total 1696
-rw-r--r-- 1 oracle dba 739085 Jul 13 10:59 cs1_ps_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 121733 Jul 13 11:05 cs1_ps_07.13.07.1100.dat

./oswnetstat:
total 696
-rw-r--r-- 1 oracle dba 297692 Jul 13 10:59 cs1_netstat_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 49644 Jul 13 11:05 cs1_netstat_07.13.07.1100.dat

./oswmpstat:
total 208
-rw-r--r-- 1 oracle dba 82064 Jul 13 10:59 cs1_mpstat_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 13714 Jul 13 11:05 cs1_mpstat_07.13.07.1100.dat

./oswiostat:
total 920
-rw-r--r-- 1 oracle dba 393502 Jul 13 10:59 cs1_iostat_07.13.07.1000.dat
-rw-r--r-- 1 oracle dba 65568 Jul 13 11:05 cs1_iostat_07.13.07.1100.dat
[cs1] /oracle/osw/archive>


13 07, 2007
Oracle OS Watcher使用说明(2)
作者 tomszrp 21:16 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

OSW的卸载

 

如果想卸载OSW,直接将osw的工作目录删除即可。

rm -fr ./osw

 

OSW的设置

 

当OSW安装完毕后,OSW的解压缩脚本里就提供了管理osw的启动和停止的scripts。当第一次运行OSW的时候,系统会自动在osw的目录下创建一个子目录archive,并在archive目录下再创建7个子目录。

[cs1] /oracle/osw> cd archive
[cs1] /oracle/osw/archive> ls -ltr
total 0
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswprvtnet
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswvmstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswtop
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswps
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswnetstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswmpstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswiostat
[cs1] /oracle/osw/archive>

 

如果要收集private networks 信息,必须要手工创建一个可执行文件在osw目录下,并且命名为private.net。这个文件的设置可以参考osw目录下提供的Exampleprivate.net.这个文件中包含了用来检查RAC private networks 运行traceroute的命令.

比如:

traceroute -r -F node1
traceroute -r -F node2


13 07, 2007
Oracle OS Watcher使用说明(1)
作者 tomszrp 21:14 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

一直在AIX平台下工作,从来没听说过这个osw utility,因为NMON在收集os的信息方面比这个强大多了。今天在eygle的site上看到了这个说明,到metalik上下载并在测试环境上实验了一把,觉得还不错,留个纪念吧。

 

OSW是Oracle提供的一个用于操作系统监控的工具包,这个工具包可以从Metalink下载。Metalink Note:301137.1

 

OSW支持的平台

OSW is certified to run on the following platforms:
AIX
Tru64
Solaris
HP-UX
Linux

 

OSW的安装

从metalink上下载后(并ftp 到unix server上),直接tar开就可以使用了。如果是compress格式的,先解压缩,比如:

uncompress osw.tar.Z

tar xvf osw.tar

 

[cs1] /oracle> tar xvf osw.tar
x .
x ./osw
x ./osw/Exampleprivate.net, 1731 bytes, 4 media blocks.
x ./osw/OSWatcher.sh, 11784 bytes, 24 media blocks.
x ./osw/OSWatcherFM.sh, 4451 bytes, 9 media blocks.
x ./osw/OSWg.jar, 722088 bytes, 1411 media blocks.
x ./osw/oswnet.sh, 334 bytes, 1 media blocks.
x ./osw/oswsub.sh, 401 bytes, 1 media blocks.
x ./osw/startOSW.sh, 1101 bytes, 3 media blocks.
x ./osw/stopOSW.sh, 560 bytes, 2 media blocks.
x ./osw/tarupfiles.sh, 127 bytes, 1 media blocks.
x ./osw/topaix.sh, 409 bytes, 1 media blocks.
x ./osw/README, 4997 bytes, 10 media blocks.
x ./osw/OSWgREADME, 3426 bytes, 7 media blocks.

...

续:Oracle OS Watcher使用说明(2)


08 07, 2007
如期完成toms_tools的编写工作
作者 tomszrp 20:43 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

经过一下午对index/part index部分的增加,到现在终于完成了近几天整理的这个小工具

凡事有始有终,今天为toms_tools先划个句号吧。


06 07, 2007
The Invisiable Index in 11g
作者 tomszrp 18:15 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

在Oracle 11g版本中,我们可以设置一个index的状态为Invisiable或visible
,也可以直接创建一个Invisiable的index
alter index index_name invisible;
alter index index_name visible;
create index inix_name ... invisible;

当我们在一个生产系统中分析认为一个index没有什么意义或想在某个SQL中不
使用该索引,但不想立即将其drop或无法直接修改SQL的时候,我们可以考虑将
该索引置为Invisible状态。

当然了,我们也可以使用hint提示去强制不使用 (但这个需要你去调整SQL,很
多情况下,修改这个SQL特别麻烦)

备注:置为Invisible的index在进行DML操作的时候,仍然对其进行维护。


SQL> create table test as select * from dba_objects;

Table created.

SQL> create index inx_test_object_id on test(object_id) invisible;

Index created.

--这个时候将看不到索引inx_test_object_id

SQL> select count(*) from test where object_id=100;

执行计划
----------------------------------------------------------
Plan hash value: 1357081020

--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 7 | 1239 | 144 (3)| 00:00:02 |
|* 1 | TABLE ACCESS FULL| TEST | 7 | 1239 | 144 (3)| 00:00:02 |
--------------------------------------------------------------------------


下面我们通过hint来强制使用这个索引

SQL> select /*+ index(test inx_test_object_id) */count(*) from test where object_id=100;

执行计划
----------------------------------------------
Plan hash value: 3278524694

----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 1 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | INDEX RANGE SCAN| INX_TEST_OBJECT_ID | 1 | 13 | 1 (0)| 00:00:01 |
----------------------------------------------------------------------------------------

SQL>

再来看将这个index置为visible的情况
SQL> alter index inx_test_object_id visible;

Index altered.

SQL>
SQL> select count(*) from test where object_id=100;
执行计划
----------------------------------------------
Plan hash value: 3278524694

----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 1 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | INDEX RANGE SCAN| INX_TEST_OBJECT_ID | 1 | 13 | 1 (0)| 00:00:01 |
----------------------------------------------------------------------------------------

SQL>

可以看到,这个索引系统又能看到了。

当然了,如果不想使用该索引,通过no_index hint我们一样可以屏蔽掉。这个大家太熟悉了,不再
多罗嗦了。


同样的,在11g中,我们可以通过dba_indexes视图可以查看一个index的visible属性。

select index_name,visibility
from dba_indexes
where index_name='INX_TEST_OBJECT_ID';

INDEX_NAME VISIBILITY
------------------- -----------
INX_TEST_OBJECT_ID VISIBILE


06 07, 2007
Read -Only Tables in 11g
作者 tomszrp 13:38 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

在11g中,对table上又增加了一项新的功能,我们终于可以轻松的设置一张表为read only状态了:

设置表为只读或读写和设置tablespace的语法相似,比如

alter table table_name read only;

--

alter table table_name read write;

在这之前,我们需要考虑通过一系列的权限了、安全控制Triggler了、只读表空间了、访问控制policy了等方法才能达到我们的read only目的.现在好了,一切变的如此轻松!


06 07, 2007
11g中对PL/SQL访问sequence的一个改进
作者 tomszrp 13:22 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

在Oracle 11g之前,熟悉pl/sql编程的朋友都知道,当在pl/sql 代码中访问
一个sequence的时候,一般的做法是,比如:
DECLARE v_n number;
BEGIN
SELECT Seq.Nextval INTO v_n FROM Dual;
....
END;

所以大家都觉得很烦琐,而且这么写有一定的性能上的开销,但是没办法,
那么好了,到了11g,这个问题Oracle开发者为你排忧了。

在11g中,重新修改了访问方法,不仅仅提高了运行效率而且在pl/sql中
的调用方法也变的非常简单,在11g中,你可以简单的这样处理:
DECLARE v_n NUMBER:=Seq.Nextval;
BEGIN
....
END;

当然了,对于访问Currval也是一样的.


03 07, 2007
这个也单独收费
作者 tomszrp 22:24 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

原文来至Kamus的BLOG

如果不是今天看到Fenng的给 Larry Ellison 的公开信,事关 AWR 与 ASH文章中提到Mark Brinsmead的这封公开信,我也不知道AWR/ADDM/ASH这样几乎完全内置在数据库中的功能也是需要额外收费的。

仔细查了一下Oracle® Database Licensing Information,果然如此,汗。

Command-Line APIs

Diagnostics Pack features can also be accessed by way of database server APIs and command-line interfaces:

* The DBMS_WORKLOAD_REPOSITORY package is part of this pack.
* The DBMS_ADVISOR package is part of this pack if you specify ADDM as the value of the advisor_name parameter, or if you specify for the value of the task_name parameter any value starting with the ADDM prefix.
* The V$ACTIVE_SESSION_HISTORY dynamic performance view is part of this pack.
* All data dictionary views beginning with the prefix DBA_HIST_ are part of this pack, along with their underlying tables.
* All data dictionary views with the prefix DBA_ADVISOR_ are part of this pack if queries to these views return rows with the value ADDM in the ADVISOR_NAME column or a value of ADDM* in the TASK_NAME column or the corresponding TASK_ID.
* The following reports found in the /rdbms/admin/ directory of the Oracle home directory are part of this pack: awrrpt.sql, awrrpti.sql, addmrtp.sql, addmrpti.sql, awrrpt.sql, awrrpti.sql, addmrpt.sql, addmrpti.sql, ashrpt.sql, ashrpti.sql, awrddrpt.sql, awrddrpi.sql, awrsqrpi.sql, awrsqrpt.sql.

即使作为Oracle的员工,恐怕我也得私下里支持一下这位DBA的提议。在公开信中回复的comment中包含“SIGNATORY”字样就表示电子签名了。 )

如果说awrrpt.sql这样的脚本在不购买Oracle Diagnostic Pack的license情况下不允许使用,倒也还能控制,但是连内置在数据库里面的毫无限制的性能视图都不允许去查询,这样的license确实有些离奇,我想没有人能控制住自己不敲下select …. from V$ACTIVE_SESSION_HISTORY吧。


03 07, 2007
如期完成第一部分功能
作者 tomszrp 22:07 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

到今天下午下班前,toms_tools 包完成了表空间自适应随机动态平衡分布功能(还不是特别如意,需要稍加修饰).

同时一并完成了相应的技术白皮书,算是没有虚度光阴,下班的同时,也让同事用上了,算上的够及时.^|^

好久不写pl/sql的东西了,在10g下写出来的东西,部署到9i上居然出了点小问题,还好只是一点小的瑕疵!

明天顺利的话,补充一下对index的处理部分!告一个段落!(找点时间灌点水,总想偷懒!^|^)

对了,好象效率上有点问题,明天优化优化(哈哈,优化,又是优化...,似乎玩Oracle永远会面对这个问题,这不,自己设计,设计开发的,再自己优化喽)

...


03 07, 2007
小有进度(toms_tools)
作者 tomszrp 20:15 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

到昨天下午下班,toms_tools 可以支持目前系统(应用)中涉及到的所有系统分区和应用分区类型了.

今天如果不出意外的话,完成表空间自适应部分.


01 07, 2007
稍做调整,支持基本的分区表(range)
作者 tomszrp 18:58 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

上午写出了基本结构,下午让铿锵在MSN因为undo出现坏块的问题耽误了一会儿,对base frame稍做改动,可以支持基本的分区表了(range)

支持分区表
1)按地区分区
SQL> create table test(
  2  region number(4) not null,
  3  oid    number(12) primary key,
  4  deal_date date default sysdate,
  5  flag   char(1) check(flag in('0','1','2'))
  6  )
  7  /

表已创建。

SQL> desc test
 名称           是否为空? 类型
 -------------- -------- -------------
 REGION         NOT NULL NUMBER(4)
 OID            NOT NULL NUMBER(12)
 DEAL_DATE               DATE
 FLAG                    CHAR(1)

SQL> 
SQL> exec toms_tool.get_create_tabl_sql;

PL/SQL procedure successfully completed

SQL> 
SQL> select sql 
     from source_sql 
     where name='TEST' 
     order by seq;

prompt create table study.test
create table study.test
(
  region number not null,
  oid number primary key,
  deal_date date default sysdate,
  flag char(1)  check(flag in('0','1','2')) 
)
partition by range(region)
( 
  partition p_530 values less than(531),
  partition p_531 values less than(532),
  partition p_532 values less than(533),
  partition p_533 values less than(534),
  partition p_534 values less than(535),
  partition p_535 values less than(536),
  partition p_536 values less than(537),
  partition p_537 values less than(538),
  partition p_538 values less than(539),
  partition p_539 values less than(540),
  partition p_543 values less than(544),
  partition p_546 values less than(547),
  partition p_631 values less than(632),
  partition p_632 values less than(633),
  partition p_633 values less than(634),
  partition p_634 values less than(635),
  partition p_635 values less than(636),
  partition p_999 values less than(1000)
) 

2)按月分区(date)
SQL> create table test(
  2  rec_date date);

表已创建。

SQL> 
SQL> exec toms_tool.get_create_tabl_sql;

PL/SQL procedure successfully completed

SQL> 
SQL> select sql 
     from source_sql 
     where name='TEST' 
     order by seq;

prompt create table study.test
create table study.test
(
  rec_date date 
)
partition by range(rec_date)
( 
  partition p_200707 values less than(to_date('20070801','yyyymmdd')),
  partition p_max    values less than(to_date('20370101','yyyymmdd'))
) 

01 07, 2007
toms_tools小试牛刀
作者 tomszrp 16:45 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

今天上午调试好了toms_tools的基本功能,可以读取建表的基本信息了。下面测试一下(我在家测试了很多种情况,脚本太多,就列举一个相对典型的情况)

SQL> create table test(
  2  a int not null,
  3  b number,
  4  c number(8,2),
  5  d char(1) check(d in ('0','1')),
  6  e varchar2(32),
  7  f date
  8  ,
  9  constraint pk_test primary key(b));

表已创建。

SQL> desc test
 名称      是否为空? 类型
 --------- -------- ---------------
 A         NOT NULL NUMBER(38)
 B         NOT NULL NUMBER
 C                  NUMBER(8,2)
 D                  CHAR(1)
 E                  VARCHAR2(32)
 F                  DATE


SQL> exec toms_tool.get_create_tabl_sql;

PL/SQL procedure successfully completed

SQL> 
SQL> select sql 
     from source_sql 
     where name='TEST' 
     order by seq;

SQL
-----------------------------------------
prompt create table study.test
create table study.test
(
  a number not null,
  b number primary key,
  c number(8,2),
  d char(1) check(d in ('0','1')) ,
  e varchar2(32),
  f date
)

10 rows selected

SQL> 

01 07, 2007
开发toms_tools维护工具包计划
作者 tomszrp 15:13 | Permalink 静态链接网址 | Comments 最新回复 (3) | Trackback 引用 (0) | PUB论剑

因工作需要,需要经常在多个系统中间同步/重构数据库对象结构,至少目前在几十多个生产库,N个培训库、N个测试、N个压力测试库、若干开发库中经常需要同步应用对象结构。

因为各个系统中的需要不完全一样,且目标对象多达几万/几十万个,所以传统的exp/imp,dbms_metadata工具等不能完全满足需要。

为了减轻维护工作压力,提高工作效率,提供可操作、可读性强、可编辑、傻瓜型的维护工具,特决定开发一个维护package,以生产或开发DB为baseline,根据预定义的规则(参照目标环境需要),自动生成目标环境需要的全部/部分数据库对象(应用)创建脚本

初步设想可以实现如下功能:

1)自动生成需要的建表/索引脚本

根据目标环境中的需要,可以建成分区或非分去的表(只参考baseline DB中的表基本结构即可)

2)自动生成分区表/索引的split脚本

3)自动生成所有的应用pl/sql 对象建立脚本

4)自动从开发baseline 中生成目标生产上需要发布的对象脚本!

可以直接提交维护DBA执行的脚本

其他功能想到了再说。

以上功能,计划采用Oracle的PL/SQL编写实现。

第一版本表结构支持的数据类型

char/nchar/varchar/varchar2/nvarchar2
number/integer
raw/long raw/blob
long
date
float
rowid/wrowid
timestamp/timestamp with time zone/timestamp with local time zone

目前应用中主要使用了上述几种数据类型,后续补充对其他数据类型的支持。


10 12, 2006
Data Pump Import速度问题之解决过程
作者 tomszrp 13:12 | Permalink 静态链接网址 | Comments 最新回复 (3) | Trackback 引用 (0) | PUB论剑

最初由Kamus发布

 查看全文
12 11, 2006
是福还是祸
作者 tomszrp 19:20 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

今天到eygle的站点(www.eygle.co)]上溜达,看到了他关于

Oracle11g已知的将要推出的新特性之一是-自动内存管理的简单介绍.

 查看全文

18 06, 2006
系统时间不正确导致Oracle无法OPEN
作者 tomszrp 21:22 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

iamagoodmaster:

突然停电,再开机,启动数据库就出现ORA-00600错误,详细如下:
——————————————————————
SQL*Plus: Release 9.2.0.6.0 - Production on Tue Jan 1 00:44:10 2002

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.
ORACLE instance started.

Total System Global Area 581506668 bytes
Fixed Size 452204 bytes
Variable Size 402653184 bytes
Database Buffers 167772160 bytes
Redo Buffers 10629120 bytes
Database mounted.
ORA-00600: internal error code, arguments: [2252], [1903], [579459841], [], [],
[], [], []
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
——————————————————————————

 查看全文
09 06, 2006
遭遇ORA-22856+BUG[2421054]
作者 tomszrp 14:02 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

昨天晚上系统优化,尝试修改一个已经compress的分区表,结果系统提示:

ORA-22856: cannot add columns to object tables

这个问题从来没遇过[只能说以前从没修改过压缩表的结构而已],开始以为自己连续工作了N个小时头大了。后来在自己本子上的库上测试也是这个问题,但在我本子上的另外一个10g的库中,测试是没有问题。因为工作的地方没有网络可上,所以当时猜测难道在9i的版本中不支持这么操作:不允许修改压缩对象的结构?

早上回家,在网上咨询了朋友,hrb_qiuyb告诉说是9i的一个bug[2421054]

刚才到metalink上查了一下,果然是这么回事:

 查看全文

30 05, 2006
在过程中动态使用临时表的问题
作者 tomszrp 12:33 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

这两天在论坛里,有不少人咨询在存储过程中创建、访问temporary 表的问题。

下面简单的写一个DEMO,供大家参考。

需要说明的是:如果在PL/SQL中动态创建表,并在后续的脚本中使用前面创建的表,那么要使用动态SQL来实现,否则系统编译时会报告ORA-00942:table or view does not exist的错误。

 查看全文
15 04, 2006
关于在触发器中操作便异表[最近咨询变异表的人很多]
作者 tomszrp 13:01 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑
变异表就是当前被DML语句修改的表,对trigger来说,变异表就是trigger在其上
定义的表。需要明确的是trigger中SQL语句不能进行如下操作:
1)读或修改触发语句的任何变异表,其中包括触发表本身
2)读或修改触发表的约束表中的主关键字,唯一关键字和外部关键字列。除此之外的其他列都可以修改。

以上2条限制适合所有的行级trigger.
 查看全文
14 04, 2006
ORA-12704: 字符集不匹配
作者 tomszrp 16:22 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

前两天在PUB里看到的。在此收集[谢过wenaini]

 查看全文
11 04, 2006
调用dbms_system发生PLS-00201错误解决
作者 tomszrp 12:58 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

今天在论坛里看到这样一个问题
SQL> exec dbms_system.set_sql_trace_in_session(11,3352,true);
BEGIN dbms_system.set_sql_trace_in_session(11,3352,true); END;

 查看全文
10 04, 2006
巧用随机数解决数学问题
作者 tomszrp 20:46 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

今天看到有朋友问如何用pl/sql解决如下怪异的问题

T=5a+7b-2c-4d+1
a的范围:40到60
b.......:10到35
c........:8到24
d........:6到20
且a+b+c+d=100

求T:提示用SQL相关语句查询,谢谢

 查看全文
09 04, 2006
IBM UNIX服务器的逻辑分区
作者 tomszrp 18:19 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

关键词:
IBM AIX UNIX LPAR PPAR 分区 HMC
摘 要:
本文介绍了IBM UNIX服务器物理分区和逻辑分区的概念以及LPAR的实现。内容包括:
1、 为什么服务器需要分区
2、 什么是物理分区(PPAR)和逻辑分区(LPAR)
3、 IBM pSeries的逻辑分区和动态逻辑分区

原文连接:http://www.itpub.net/473989.html


09 04, 2006
如何挂起一个进程
作者 tomszrp 10:51 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (0) | PUB论剑

<