ORA-18008: cannot find OUTLN schema

今天无缘无故的outln不见了,后台alter日志也没有删除的信息。重新创建也创建不上

create user outln identified by outln
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-18008: cannot find OUTLN schema

很是郁闷,不见了居然还不让创建。

只能通过后台的dump文件来查看原因了

sqlplus / as sysdba
alter session set events '18008 trace name errorstack level 3';
alter session set events '10046 trace name context forever, level 12';
create user outln identified by outln;

通过跟踪后台日志查看。

知道是这个trigger的问题:MDSYS.SDO_ST_SYN_CREATE

alter trigger MDSYS.SDO_ST_SYN_CREATE disable;

create user outln identified by outln;

alter trigger MDSYS.SDO_ST_SYN_CREATE enable;

这个以后就不会出现ORA-18008: cannot find OUTLN schema这个问题了。

 

附上:OUTLN用户的创建语句

DECLARE
user_exists EXCEPTION;
outln_user number;
outln_tables number;
extra_outln_tables number;
DDL_CURSOR integer;
BEGIN
select count(*) into outln_user from user$ where name='OUTLN';

select count(*) into outln_tables from obj$ where name in
('OL$', 'OL$HINTS','OL$NODES') and owner#=
(select user# from user$ where name='OUTLN');

select count(*) into extra_outln_tables from obj$ where name not in
('OL$', 'OL$HINTS','OL$NODES') and type#=2 and owner#=
(select user# from user$ where name='OUTLN');


DDL_CURSOR := dbms_sql.open_cursor;
IF outln_user = 0 THEN
dbms_sql.parse(DDL_CURSOR, 'create user outln identified by outln',
dbms_sql.native);
dbms_sql.parse(DDL_CURSOR,
'grant connect, resource, execute any procedure to outln',
dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create table outln.ol$ ( '||
'ol_name varchar2(30), ' ||
'sql_text long, ' ||
'textlen number, ' ||
'signature raw(16), ' ||
'hash_value number, ' ||
'hash_value2 number, ' ||
'category varchar2(30), ' ||
'version varchar2(64), ' ||
'creator varchar2(30), ' ||
'timestamp date, ' ||
'flags number, ' ||
'hintcount number, ' ||
'spare1 number, ' ||
'spare2 varchar2(1000))', dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create table outln.ol$hints ( '||
'ol_name varchar2(30), '||
'hint# number, '||
'category varchar2(30), '||
'hint_type number, '||
'hint_text varchar2(512), '||
'stage# number, '||
'node# number, '||
'table_name varchar2(30), '||
'table_tin number, '||
'table_pos number, '||
'ref_id number, '||
'user_table_name varchar2(64), '||
'cost FLOAT(126),'||
'cardinality FLOAT(126),'||
'bytes FLOAT(126),'||
'hint_textoff number, '||
'hint_textlen number,'||
'join_pred varchar2(2000),'||
'spare1 number, '||
'spare2 number, '||
'hint_string clob)', dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create table outln.ol$nodes ( '||
'ol_name varchar2(30), '||
'category varchar2(30), '||
'node_id number, '||
'parent_id number, '||
'node_type number, '||
'node_textlen number, '||
'node_textoff number, '||
'node_name varchar2(64))', dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create unique index outln.ol$name '||
'on outln.ol$(ol_name)', dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create unique index outln.ol$signature '||
' on outln.ol$(signature,category)', dbms_sql.native);
dbms_sql.parse(DDL_CURSOR, 'create unique index outln.ol$hnt_num '||
' on outln.ol$hints(ol_name, hint#)', dbms_sql.native);
dbms_output.put_line('OUTLN CREATION SUCCESSFUL');
ELSE
IF outln_tables!=3 or extra_outln_tables!=0 THEN
dbms_output.put_line('ERROR - OUTLN USER ALREADY EXISTS');
RAISE user_exists;
ELSE
dbms_output.put_line('OUTLN CREATION SUCCESSFUL');
END IF;
END IF;

EXCEPTION
WHEN user_exists THEN
RAISE;

END;
/

alter user outln account lock;

 

10g R2的outln用户的文档

Subject:     Script. to create user OUTLN in 10.2
      Doc ID:     422983.1     Type:     SCRIPT
      Modified Date :     04-SEP-2008     Status:     PUBLISHED

9i的参考文档如下:
Subject:     Script. to create user OUTLN in 9i
      Doc ID:     240478.1     Type:     SCRIPT
      Modified Date :     08-DEC-2008     Status:     PUBLISHED

8i的参考文档如下:
Subject:     Script. to create user OUTLN in 8i
      Doc ID:     98572.1     Type:     BULLETIN
      Modified Date :     10-JUN-2003     Status:     PUBLISHED

 

另外为啥会要这个outln用户呢?不要为啥就不可以呢!

What is the OUTLN user?
=======================
 
This document will address these topics:

1. Why is the user OUTLN created by Oracle?
2. What are stored outlines and what are they good for?
3. What does OUTLN user own?
4. If it is dropped by accident, can it be created on the fly?


1. Why is the user OUTLN created by Oracle?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The OUTLN user is created automatically during installation of Oracle.
The create user outln statement appears in SQL.BSQ that is run at database
creation time to initiate the datadictionary, as such the OUTLN user is an
integral part of the database. This user is granted connect, resource, and
execute any procedure privileges. It is also set to locked and expired
since no end-user connections should be made to this acount except for
maintenance. The database administrator should change the password for
the OUTLN schema just as for the SYS and SYSTEM schemas, also make sure the
account is locked and only unlock it in case a DBA needs access to it for
maintenance operations.


2. What are stored outlines and what are they good for?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Stored outlines support a very usefull feature: Optimizer Plan Stability

After carefully tuning an application, you might want to ensure that the
optimizer generates the same execution plan whenever the same SQL statements
are executed. Plan stability allows you to maintain the same execution plans
for the same SQL statements, regardless of changes to the database such as
re-analyzing tables, adding or deleting data, modifying a table's columns,
constraints, or indexes, changing the system configuration, or even upgrading
to a new version of the optimizer.

The CREATE OUTLINE statement creates a stored outline, which contains a set of
attributes that the optimizer uses to create an execution plan. Stored outlines
can also be created automatically by setting the system parameter
CREATE_STORED_OUTLINES to TRUE.

The system parameter USE_STORED_OUTLINES can be set to TRUE, FALSE, or a
category name to indicate whether to make use of existing stored outlines for
queries that are being executed. The OUTLN_PKG package provides procedures used
for managing stored outlines.
 
Oracle adds the OUTLN user schema to support Plan Stability. The OUTLN user
acts as a place to centrally manage metadata associated with stored outlines.
 
You cannot create this user on the fly. The user OUTLN makes use of the package
OUTLN_PKG which is used to manage stored outlines and their outline categories.

The package sys.outln_pkg is created by script. "dbmsol.sql" in the
$ORACLE_HOME/rdbms/admin directory. The "dbmsol.sql" script. is called from
"catproc.sql". "prvtol.plb" creates the body of "outln_pkg"; it is also called
from catproc.sql.


3. What does OUTLN user own?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The outline user ows some tables that are the stored outlines metadata
repository, typically these are OL$, OL$HINTS and OL$NODES and some indexes.

In case of an upgrade or migration, the upgrade or migration scripts will take
care of any changes to the OUTLN respository tables and associated package.

4. If it is dropped by accident, can it be created on the fly?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

First of all: you should never try to drop the OUTLN user (in the same way as you
should not drop the SYSTEM user) but if you accidently did you can recreate
it by running the same commands from the file sql.bsq again to create the outln
user (do NOT run sql.bsq directly!), issue grants, create tables and indexes,
note that "M_IDEN" stands for the length of an identifier which is 30 for current
releases, "M_CSIZ" is 2000. For some versions support has created an automated
script. to restore the outln schema and its contents.

Naturally you will have lost all stored outlines when you drop the OUTLN schema,
also, since the kernel makes implicit assumptions on its existence , you will get
the error ORA-18009 "one or more outline system tables do not exist" when you try
to issue outline related sql statements when the OUTLN schema is not there.


你可能感兴趣的:(ORA-18008: cannot find OUTLN schema)