首页 > 数据库 > Oracle > 正文

Oracle错误案例:ORA-00922

2024-08-29 13:31:55
字体:
来源:转载
供稿:网友
国内最大的酷站演示中心!

ora-00922 missing or invalid option 
0ra-00922: 丢失或者无效的选项

  cause an invalid option was specified in defining a column or storage clause. the valid option in specifying a column is not null to specify that the column cannot contain any null values. only constraints may follow the datatype. specifying a maximum length on a date or long datatype also causes this error.
 
  action correct the syntax. remove the erroneous option or length specification from the column or storage specification. 

  案例一:oracle明文密码漏洞

  受影响系统:

  oracle oracle10g application server 9.0.4.0
  oracle oracle10g application server 10.1.0.2
  描述:

  oracle database是一款商业性质大型数据库系统。

  oracle 10g存在包含明文密码的全局可读文件,本地攻击者可以利用这个漏洞获得对数据库的访问。

  sysman帐户的密码可在'$oracle_home/hostname_sid/sysman/config/emoms.properties'文件中获得,此文件全局可读。

  另外如果安装oracle 10g时提供sys, system, dbsnmp和sysman 帐户密码相同,并且密码有惊叹号(如f00bar!!),那么当设置sysman和dbsnmp密码时db安装会出现错误,错误信息"postdbcreation.log"会记录密码:

  alter user sysman identified by f00bar!! account unlock
error at line 1:
ora-00922: missing or invalid option

  alter user dbsnmp identified by f00bar!! account unlock
error at line 1:
ora-00922: missing or invalid option

  <*来源:david litchfield ([email protected])
 
  链接:http://marc.theaimsgroup.com/?  l=bugtraq&m=110382247308064&w=2
  *>

  建议:

  厂商补丁:

  oracle
  ------
  oracle已经发布patch (#68)来修正此漏洞:

  http://metalink.oracle.com/

案例二:置换变量

  我才刚开始使用oracle的产品,我在执行下面两条命令的时候遇到了问题:accept 和prompt。我已经更改了行的顺序,有时候放在char中,有时候删除,有时候放在prompt中,有时候删除。无论我怎么做还是收到错误信息。我甚至试过把accept 和prompt放在begin的前后。
我想做的事情是这样的。在脚本的开始,我从键盘读取开始和结束日期,然后在程序的主要部分,我从一个表中使用select读取,并测试看日期是否在键盘输入的两个日期之间。现在当我在sql*plus中执行/编译脚本的时候,我得到的错误信息是ora-00922。

prompt
accept in_beg_date  prompt 'enter beginning extract date mm/dd/yy '
prompt
accept in_end_date  prompt 'enter ending extract date mm/dd/yy '
declare
   beg_date varchar2(8) := &in_beg_date;
   end_date varchar2(8) := &in_end_date;
   beg_dte  date;
   end_dte  date;
...
begin
   beg_dte := to_date (beg_date, 'mm/dd/yy');
   end_dte := to_date (end_date, 'mm/dd/yy');
...
   if (outrec_abs_date >= beg_dte and <= end_dte) then
...

  说实话,看起来你对prompt 和 accept 有一个很好的理解。prompt 告诉sql*plus 在屏幕上书写一行文字。你在这里使用了两个prompt命令;每个命令都在屏幕上打印一个空行,这对于垂直间距很有好处。accept命令是等待用户输入一个置换变量的值。accept命令中可选的prompt 子句在用户输入数值的同一行中显示了一条信息。你在pl/sql 块的外面放置prompt 和 accept 是正确的:他们是sql*plus 命令,不是pl/sql 。

  你可能注意到当你运行这个脚本的时候,每一个拥有置换变量的行都引起了屏幕上的两行输出,例如:
old   3:    beg_date varchar2(8) := &in_beg_date;
new   3:    beg_date varchar2(8) := 09/01/03;

  这就显示了sql*plus 在看到一行包括了置换变量的代码的时候所作的工作:他用变量的数值(以&开头)置换了变量的名字。这就像你在文本编辑器,例如记事本中,用查找和置换一样,将一个字符串的每个出现(这里是&in_beg_date)都替换成了另一个字符串(09/09/03)。“原来”的行就是在代码中的样子。“新”的行是将要执行的样子。如果你执行了"beg_date varchar2(8) := 09/01/03;"语句,会发生什么?sql*plus 会创建一个字符串变量并且用":="右侧的数值来进行初始化。在这个案例中,它是一个数字表达式,那么sql*plus 就会检测"(9/1) / 3"这个表达式,并将答案写为'3'。你实际的意思是:

  beg_date varchar2(8) := '&in_beg_date';
  end_date varchar2(8) := '&in_end_date';
  单引号是至关重要的。

  本文国际来源:http://searchoracle.techtarget.com/

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表