首页 新闻 会员 周边 捐助

ORACLE APPLICATION EXPRESS解决

0
悬赏园豆:100 [待解决问题]

Rem  Copyright (c) Oracle Corporation 1999 - 2009. All Rights Reserved.
Rem
Rem    NAME
Rem      apexins.sql
Rem
Rem    DESCRIPTION
Rem
Rem    NOTES
Rem      Assumes the SYS user is connected.
Rem
Rem    REQUIRENTS
Rem      - Oracle 9.2.0.3 or later
Rem
Rem    Arguments:
Rem     Position 1: Name of tablespace for Application Express application user
Rem     Position 2: Name of tablespace for Application Express files user
Rem     Position 3: Name of temporary tablespace
Rem     Position 4: Virtual directory for APEX images
Rem
Rem    Example:
Rem
Rem    1)Local
Rem      sqlplus "sys/oracle as sysdba" @apexins SYSAUX SYSAUX TEMP /i/
Rem
Rem    2)With connect string
Rem      sqlplus "sys/oracle@10g as sysdba" @apexins SYSAUX SYSAUX TEMP /i/
Rem
Rem    MODIFIED   (MM/DD/YYYY)
Rem      jkallman  09/10/2004 - Created
Rem      jstraub   10/25/2004 - Changed the name of the log file to end in .log and include date/time
Rem      jkallman  01/04/2005 - Adjusted APPUN to FLOWS_020000
Rem      jduan     07/07/2005 - Modify for upgrade to 2.0
Rem      jkallman  09/14/2005 - Adjusted APPUN to FLOWS_020100
Rem      jkallman  09/22/2005 - Add substitution variable XE
Rem      jkallman  01/23/2006 - Adjusted APPUN to FLOWS_020200
Rem      jkallman  02/28/2006 - Copied from original htmldbins.sql
Rem      jstraub   06/27/2006 - Added exit logic if XE
Rem      jstraub   08/11/2006 - Changed calling coreins with new prefix parameter
Rem      jkallman  09/29/2006 - Adjusted APPUN to FLOWS_030000
Rem      jkallman  02/15/2007 - Remove XE check
Rem      jstraub   02/21/2007 - Removed 6th positional connect parameter
Rem      jstraub   04/10/2007 - Added INSTALL_TYPE parameter for use with dynamically setting WHENEVER SQLERROR exit in coreins
Rem      jkallman  08/02/2007 - Change FLOWS_030000 references to FLOWS_030100
Rem      jstraub   08/16/2007 - Removed password as positional parameter and made random
Rem      jstraub   09/14/2007 - Updated comments to reflect correct number of arguments and updated examples
Rem      jstraub   12/19/2007 - Added logic to exit if not connected as SYSDBA
Rem      jstraub   01/10/2008 - Added prerequisite checks for XDB and CONTEXT
Rem      jstraub   02/08/2008 - Added alter session set nls_length_semantics = byte
Rem      jkallman  07/08/2008 - Change FLOWS_030100 references to FLOWS_040000
Rem      jkallman  10/02/2008 - Change FLOWS_040000 references to APEX_040000
Rem      mhichwa   10/15/2008 - Changed comments, no functional changes
Rem      jstraub   02/18/2009 - Added version already installed to prerequisite checks
Rem      jstraub   03/24/2009 - Added spool off, removed from coreins.sql for catupgrd
Rem      jkallman  06/01/2009 - Added DB version check
Rem      jkallman  06/08/2009 - Removed DB version check
Rem      jstraub   07/14/2010 - Added DB version check


alter session set nls_length_semantics = byte;

prompt .  ____   ____           ____        ____
prompt . /    \ |    \   /\    /     |     /
prompt .|      ||    /  /  \  |      |    |
prompt .|      ||---    ----  |      |    |---

prompt .|      ||   \  /    \ |      |    |
prompt . \____/ |    \/      \ \____ |____ \____
prompt .
prompt . Application Express (APEX) Installation.
prompt ..........................................
prompt .
prompt ... Checking prerequisites

set define '^'
set concat on
set concat .
set verify off
set termout off
spool off
set termout on

Rem
Rem  Check that user has SYSDBA privilege, CONTEXT and XDB are installed before proceeding
Rem


whenever sqlerror exit
set serveroutput on

Rem  Check SYSDBA Privilege
define foo2 = 'NOSYSDBA'
column foo new_val foo2 NOPRINT

select privilege foo from session_privs where privilege = 'SYSDBA';

begin
    if '^foo2' = 'NOSYSDBA' then
        dbms_output.put_line('Application Express installation requires a connection with the SYSDBA privilege.');
        execute immediate 'bogus statement to force exit';
    end if;
end;
/

Rem  Check for proper DB version
declare
    l_version number;
    l_edition varchar2(30) := 'notXE';
begin
    execute immediate
      'select to_number(replace(version,''.'',null)) from registry$ where cid=''CATPROC'''
    into l_version;

    if l_version = 102010 then
        begin
            execute immediate
              'select edition from registry$ WHERE cid=''CATPROC'''
            into l_edition;
        exception when others then
            null;
        end;
    end if;

    if l_version < 102030 and l_edition != 'XE' then
        dbms_output.put_line('Application Express installation requires database version 10.2.0.3 or later or XE.');
        execute immediate 'bogus statement to force exit';
    end if;
end;
/

Rem  Check for CONTEXT
define foo2 = 'NOCONTEXT'
column foo new_val foo2 NOPRINT

select comp_id foo from dba_registry where comp_id = 'CONTEXT' and status = 'VALID';

begin
    if '^foo2' = 'NOCONTEXT' then
        dbms_output.put_line('Application Express installation requires the Oracle Text database component.');
        execute immediate 'bogus statement to force exit';
    end if;
end;
/

Rem  Check for XDB
define foo2 = 'NOXDB'
column foo new_val foo2 NOPRINT

select comp_id foo from dba_registry where comp_id = 'XDB' and status = 'VALID';

begin
    if '^foo2' = 'NOXDB' then
        dbms_output.put_line('Application Express installation requires the Oracle XML Database database component.');
        execute immediate 'bogus statement to force exit';
    end if;
end;
/

define APPUN = 'APEX_040000'

Rem Check if this version is already installed
begin
    for c1 in (select null
                 from dba_users
                where username = '^APPUN' ) loop
        dbms_output.put_line('This version of Application Express is already installed.');
        execute immediate 'bogus statement to force exit';
    end loop;
end;
/


whenever sqlerror continue

prompt .
prompt ... Prerequisite check complete. Result passed.
prompt .

column foo3 new_val LOG1

select 'install'||to_char(sysdate,'YYYY-MM-DD_HH24-MI-SS')||'.log' foo3 from dual;

define LOG2 = ^LOG1.english.log
define LOG3 = ^LOG1.english.bad
spool ^LOG1
define UPGRADE = '1'

define INSTALL_TYPE = 'MANUAL'

column foo2 new_val UPGRADE

select '2' foo2 from dba_users where (username in ('FLOWS_040000','APEX_030200','FLOWS_030100','FLOWS_030000','FLOWS_020200','FLOWS_020100','FLOWS_020000','FLOWS_010600','FLOWS_010500')) and rownum = 1;

define DATTS     = '^1'
define FF_TBLS   = '^2'
define TEMPTBL   = '^3'

define IMGPR     = '^4'

define DB_VERSION = '10'
define PREFIX     = '@'

column :rnd_pwd new_value ADM_PWD NOPRINT
variable rnd_pwd varchar2(30)

begin
    :rnd_pwd := dbms_random.string('X',30);
end;
/

select :rnd_pwd from dual;

@@coreins.sql ^LOG1 ^UPGRADE ^APPUN ^TEMPTBL ^IMGPR ^DATTS ^FF_TBLS ^ADM_PWD ^PREFIX

spool off

exit

当我运行@apexins SYSAUX SYSAUX TEMP /i/时出现以下错误(帮忙看下):

PL/SQL 过程已成功完成。

Application Express installation requires database version 10.2.0.3 or later or
XE.
declare
*
第 1 行出现错误:
ORA-00900: 无效 SQL 语句
ORA-06512: 在 line 21


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

oraclexp的主页 oraclexp | 初学一级 | 园豆:100
提问于:2011-03-29 21:03
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册