谢谢,还有下面的问题
1。book表为什么不能显示
2。物化视图日志MLOG$_BOOK用什么type
SQL> set long 9999
SQL> select dbms_metadata.get_ddl('TABLE','BOOK') from dual;
ERROR:
ORA-31603: 对象 "BOOK" 属于类型 TABLE, 在方案 "OO" 中未找到
ORA-06512: 在"SYS.DBMS_SYS_ERROR", line 105
ORA-06512: 在"SYS.DBMS_METADATA", line 628
ORA-06512: 在"SYS.DBMS_METADATA", line 1221
ORA-06512: 在line 1
未选定行
SQL> select tname from tab;
TNAME
------------------------------
A
AA
AB
B
BOOK
EST1
EST2
GBK
M
MLOG$_BOOK
MV_BOOK1
TNAME
------------------------------
MV_CAPABILITIES_TABLE
PLAN_TABLE
REWRITE_TABLE
S
T
T1
T3
T613
TEMP2
TEMP3
TEST
TNAME
------------------------------
TEST1
TEST2
TOP5
TSET
V_BOOK
V_BOOK2
已选择28行。
SQL> select dbms_metadata.get_ddl('TABLE','BOOK') from dual;
ERROR:
ORA-31603: 对象 "BOOK" 属于类型 TABLE, 在方案 "OO" 中未找到
ORA-06512: 在"SYS.DBMS_SYS_ERROR", line 105
ORA-06512: 在"SYS.DBMS_METADATA", line 628
ORA-06512: 在"SYS.DBMS_METADATA", line 1221
ORA-06512: 在line 1
未选定行
SQL> select dbms_metadata.get_ddl('TABLE','TEST') from dual;
DBMS_METADATA.GET_DDL('TABLE','TEST')
--------------------------------------------------------------------------------
CREATE TABLE "OO"."TEST"
( "TEST1_CODE" VARCHAR2(30),
"TEST1_NAME" VARCHAR2(200),
"TEST2_CODE" VARCHAR2(30),
"TEST2_NAME" VARCHAR2(200),
"DR_AMOUNT" NUMBER,
"CR_AMOUNT" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
DBMS_METADATA.GET_DDL('TABLE','TEST')
--------------------------------------------------------------------------------
TABLESPACE "LTTS"
SQL> desc book
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
ID NOT NULL VARCHAR2(10)
NAME VARCHAR2(20)
PRICE NUMBER(10,2)
SQL> select dbms_metadata.get_ddl('TABLE','V_BOOK') from dual;
ERROR:
ORA-31603: 对象 "V_BOOK" 属于类型 TABLE, 在方案 "OO" 中未找到
ORA-06512: 在"SYS.DBMS_SYS_ERROR", line 105
ORA-06512: 在"SYS.DBMS_METADATA_INT", line 2857
ORA-06512: 在"SYS.DBMS_METADATA_INT", line 3192
ORA-06512: 在"SYS.DBMS_METADATA_INT", line 4078
ORA-06512: 在"SYS.DBMS_METADATA", line 326
ORA-06512: 在"SYS.DBMS_METADATA", line 410
ORA-06512: 在"SYS.DBMS_METADATA", line 449
ORA-06512: 在"SYS.DBMS_METADATA", line 615
ORA-06512: 在"SYS.DBMS_METADATA", line 1221
ORA-06512: 在line 1
未选定行
SQL> desc v_book
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
PP NUMBER
CNT NUMBER
S NUMBER
SQL> select dbms_metadata.get_ddl('VIEW','V_BOOK') from dual;
DBMS_METADATA.GET_DDL('VIEW','V_BOOK')
--------------------------------------------------------------------------------
CREATE OR REPLACE FORCE VIEW "OO"."V_BOOK" ("PP", "CNT", "S") AS
select trunc(price,-2) pp,count(1) cnt, sum(price) s from book group by trunc(
SQL> select dbms_metadata.get_ddl('VIEW','BOOK') from dual;
ERROR:
ORA-31603: 对象 "BOOK" 属于类型 VIEW, 在方案 "OO" 中未找到
ORA-06512: 在"SYS.DBMS_SYS_ERROR", line 105
ORA-06512: 在"SYS.DBMS_METADATA", line 628
ORA-06512: 在"SYS.DBMS_METADATA", line 1221
ORA-06512: 在line 1
未选定行
SQL> select distinct object_type from user_objects;
OBJECT_TYPE
------------------
FUNCTION
INDEX
JAVA CLASS
JAVA SOURCE
MATERIALIZED VIEW
PACKAGE
PACKAGE BODY
PROCEDURE
TABLE
TYPE
VIEW
已选择11行。
SQL> select dbms_metadata.get_ddl('MATERIALIZED_VIEW','MV_BOOK1') from dual;
DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','MV_BOOK1')
--------------------------------------------------------------------------------
CREATE MATERIALIZED VIEW "OO"."MV_BOOK1"
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOG
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "LTTS"
BUILD IMMEDIATE
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "LTTS"
DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','MV_BOOK1')
--------------------------------------------------------------------------------
REFRESH FAST ON COMMIT
WITH ROWID USING DEFAULT LOCAL ROLLBACK SEGMENT
ENABLE QUERY REWRITE
AS select trunc(price,-2) pp,count(*) cnt,count(price) cntp,sum(price) s from
,-2)
[本帖最后由 〇〇 于 2009-2-22 16:54 编辑]