Discrepancies: USER_TABLES and USER_SEGMENTS
In a schema HR (deployed when i installed Oracle 10g rel. 2), i run this statement:
SQL> select segment_name from user_segments where segment_type='TABLE';
and the result is:
SEGMENT_NAME
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
Selezionate 6 righe.
If I run this statement:
SQL> select table_name from user_tables;
instead, the result is:
TABLE_NAME
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
COUNTRIES
Selezionate 7 righe.
Why i don't see COUNTRIES table in USER_SEGMENTS ?
Regards.
Hi,
The segment can be anything like table, index or procedure..
Check out the which kind of segment that is like "SEGMENT_TYPE" column from DBA_SEGMENTS
Similar Messages
-
Accessing user_tables and user_tab_columns of oracle from java
hi, i can not access "user_tables" and "user_tab_columns" from java code while i can access them from TOAD.I connect to the database "HR", which is a sample database of oracle, as "normal".When i write:
@Entity
@Table(name="user_tab_columns")
public class USER_TAB_COLUMNS{
}it gives an error that user_tab_columns could not be found on the database.What can i do to access these tables from code?I think you have posted your question in the wrong forum. Try the [JDBC forum|http://forums.sun.com/forum.jspa?forumID=48].
-
User_lobs and user_segments view shows different tablespace for lob segment
Hi,
I am trying to move lob in different tablespace for partitioned table.
I used
alter table <table_name> move partition <partition_name> lob(lob_column) store as (tablespace <tablespace_name>);
alter index <index_name> rebuild partition <partition_name> tablespace <tablespace_name>
ALTER TABLE <table_name> MODIFY DEFAULT ATTRIBUTES TABLESPACE <tablespace_name>
ALTER INDEX <index_name> modify default ATTRIBUTES TABLESPACE <tablespace_name>
Database - 10.2.0.5
OS- HP Itanium 11.31
I can see in user_lob_partitions, user_segments and user_part_tables shows me new tablespace information
whereas user_lobs and user_part_indexes shows me different information regarding tablespace.
I checked some documents in metalink but didnt help me.
I think that I am missing something or doing some step wrong.
Please help.
SQL> select partition_name, lob_partition_name, tablespace_name from user_lob_partitions where table_name in ('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_PUB_LOG') ;
PARTITION_NAME LOB_PARTITION_NAME TABLESPACE_NAME
S2000 SYS_LOB_P8585 USAGE_REORG_TBS
S2001 SYS_LOB_P8587 USAGE_REORG_TBS
S2003 SYS_LOB_P8589 USAGE_REORG_TBS
S2004 SYS_LOB_P8591 USAGE_REORG_TBS
S2005 SYS_LOB_P8593 USAGE_REORG_TBS
S2006 SYS_LOB_P8595 USAGE_REORG_TBS
S2007 SYS_LOB_P8597 USAGE_REORG_TBS
S2008 SYS_LOB_P8599 USAGE_REORG_TBS
S2010 SYS_LOB_P8601 USAGE_REORG_TBS
S2011 SYS_LOB_P8603 USAGE_REORG_TBS
S2012 SYS_LOB_P8605 USAGE_REORG_TBS
S2013 SYS_LOB_P8607 USAGE_REORG_TBS
S2014 SYS_LOB_P8609 USAGE_REORG_TBS
S2015 SYS_LOB_P8611 USAGE_REORG_TBS
S2888 SYS_LOB_P8613 USAGE_REORG_TBS
S2999 SYS_LOB_P8615 USAGE_REORG_TBS
S3000 SYS_LOB_P8617 USAGE_REORG_TBS
S3001 SYS_LOB_P8619 USAGE_REORG_TBS
S3004 SYS_LOB_P8621 USAGE_REORG_TBS
S3005 SYS_LOB_P8623 USAGE_REORG_TBS
S3006 SYS_LOB_P8625 USAGE_REORG_TBS
S3007 SYS_LOB_P8627 USAGE_REORG_TBS
S3008 SYS_LOB_P8629 USAGE_REORG_TBS
S3009 SYS_LOB_P8631 USAGE_REORG_TBS
S3010 SYS_LOB_P8633 USAGE_REORG_TBS
S3011 SYS_LOB_P8635 USAGE_REORG_TBS
S3012 SYS_LOB_P8637 USAGE_REORG_TBS
S3013 SYS_LOB_P8639 USAGE_REORG_TBS
S3014 SYS_LOB_P8641 USAGE_REORG_TBS
S3015 SYS_LOB_P8643 USAGE_REORG_TBS
S3050 SYS_LOB_P8645 USAGE_REORG_TBS
SMAXVALUE SYS_LOB_P8647 USAGE_REORG_TBS
32 rows selected.
SQL> select TABLE_NAME,COLUMN_NAME,SEGMENT_NAME,TABLESPACE_NAME,INDEX_NAME,PARTITIONED from user_lobs where TABLE_NAME in ('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_SUB_LOG') ;
TABLE_NAME COLUMN_NAME SEGMENT_NAME TABLESPACE_NAME INDEX_NAME PAR
TRB1_SUB_ERRS GENERAL_DATA_C SYS_LOB0006703055C00017$$ TRBDBUS1LNN1 SYS_IL0006703055C00017$$ YES
TRB1_SUB_LOG GENERAL_DATA_C SYS_LOB0006703157C00017$$ TRBDBUS1LNN1 SYS_IL0006703157C00017$$ YES
TRB1_PUB_LOG GENERAL_DATA_C SYS_LOB0006702987C00014$$ TRBDBUS1LNN1 SYS_IL0006702987C00014$$ YES
SQL> SQL> select unique segment_name ,tablespace_name from user_Segments where segment_name in (select SEGMENT_NAME from user_lobs where TABLE_NAME in('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_SUB_LOG') );
SEGMENT_NAME TABLESPACE_NAME
SYS_LOB0006702987C00014$$ USAGE_REORG_TBS
SYS_LOB0006703055C00017$$ USAGE_REORG_TBS
SYS_LOB0006703157C00017$$ USAGE_REORG_TBS
SQL> select unique segment_name ,tablespace_name from user_Segments where segment_name in (select INDEX_NAME from user_lobs where TABLE_NAME in('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_SUB_LOG') );
SEGMENT_NAME TABLESPACE_NAME
SYS_IL0006702987C00014$$ USAGE_REORG_TBS
SYS_IL0006703055C00017$$ USAGE_REORG_TBS
SYS_IL0006703157C00017$$ USAGE_REORG_TBS
SQL> select unique index_name,def_tablespace_name from user_part_indexes where table_name in ('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_SUB_LOG');
INDEX_NAME DEF_TABLESPACE_NAME
SYS_IL0006702987C00014$$ TRBDBUS1LNN1
SYS_IL0006703055C00017$$ TRBDBUS1LNN1
SYS_IL0006703157C00017$$ TRBDBUS1LNN1
TRB1_PUB_LOG_PK USAGE_REORG_IX_TBS
TRB1_SUB_ERRS_1IX USAGE_REORG_IX_TBS
TRB1_SUB_ERRS_1UQ USAGE_REORG_IX_TBS
TRB1_SUB_ERRS_2IX USAGE_REORG_IX_TBS
TRB1_SUB_LOG_1IX USAGE_REORG_IX_TBS
TRB1_SUB_LOG_PK USAGE_REORG_IX_TBS
SQL> select unique def_tablespace_name from user_part_tables where table_name in ('TRB1_PUB_LOG','TRB1_SUB_ERRS','TRB1_SUB_LOG');
DEF_TABLESPACE_NAME
USAGE_REORG_TBS
Please let me know if some more details required.>whereas user_lobs and user_part_indexes shows me different information regarding tablespace.
do you see different results after starting a new session after the ALTER statements were issued? -
Syntax of DDL options and related (table) column names
Hi,
where can I find something like a mapping between DDL options and related table column names?
For example I do have the table options PCTFREE, FREELISTS and NOCOMPRESS. The related table columns out of user_tables are PCT_FREE, FREELIST and COMPRESS.
PCT(_)FREE wins an Underscore, FREELIST(S) wins an "S" and it is "NOCOMPRESS" if COMPRESS has a value "Y(es)".
Hope somebody can help.So far I didn't find any information that is not in
the DDL script gernerated from
DBMS_METADATA.get_DDL.Alright, I give you an example:
I create a table with the following DDL:
"CREATE TABLE IntBuch (
int_bunr integer NOT NULL,
int_sdat double precision NOT NULL,
int_hblz char(8) NOT NULL,
int_hkto char(7) NOT NULL,
int_hdat double precision NOT NULL,
KtoNr char(7) NOT NULL,
BLZ char(8) NOT NULL,
CONSTRAINT PK_IntBuch PRIMARY KEY (int_bunr)
USING INDEX
PCTFREE 10
STORAGE (
INITIAL 1000
NEXT 500
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 4096
PCTFREE 20
LOGGING
CREATE UNIQUE INDEX intid
ON IntBuch (int_bunr DESC)
CREATE INDEX hkto
ON IntBuch (int_hblz,int_hkto)
COMMENT ON TABLE IntBuch
IS 'Kommentar zu DB-Tabelle InBuch'
COMMENT ON COLUMN IntBuch.int_sdat IS 'Kommentar zu DB-Spalte int_sdat'
ALTER TABLE IntBuch
ADD CONSTRAINT Gutschrift FOREIGN KEY (int_hkto,int_hblz) REFERENCES Konto
ON DELETE CASCADE
ADD FOREIGN KEY (KtoNr,BLZ) REFERENCES Konto
ADD FOREIGN KEY (int_bunr) REFERENCES Buchung
ON DELETE CASCADE
After that I read the DDL with DBMS_METADATA.get_DDL and I get
" CREATE TABLE "UOENDE"."INTBUCH"
( "INT_BUNR" NUMBER(*,0) NOT NULL ENABLE,
"INT_SDAT" FLOAT(126) NOT NULL ENABLE,
"INT_HBLZ" CHAR(8) NOT NULL ENABLE,
"INT_HKTO" CHAR(7) NOT NULL ENABLE,
"INT_HDAT" FLOAT(126) NOT NULL ENABLE,
"KTONR" CHAR(7) NOT NULL ENABLE,
"BLZ" CHAR(8) NOT NULL ENABLE,
CONSTRAINT "PK_INTBUCH" PRIMARY KEY ("INT_BUNR")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
CONSTRAINT "GUTSCHRIFT" FOREIGN KEY ("INT_HKTO", "INT_HBLZ")
REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ON DELETE CASCADE ENABLE,
FOREIGN KEY ("KTONR", "BLZ")
REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ENABLE,
FOREIGN KEY ("INT_BUNR")
REFERENCES "UOENDE"."BUCHUNG" ("BU_NR") ON DELETE CASCADE ENABLE
) PCTFREE 20 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)
TABLESPACE "USERS"
If there are no more DDLOptions possible than that, it is fine for me. If not, but all kinds of options are to find in only one or two tables of the database ( user_tables for table options, dba_constraints and dba_segments for column options, primary and foreign keys, user_indexes and user_segments for indexes ...), that is fine for me, too. (As long as I get to know which tables are "sufficient" for that.) If it is different than both of that, that's bad.
However if you want to use defaults instead of
absolut values, it is better to remove certain parts,
like the storage clause, from the generated output.I understand this, but I am more interested to have all and not leaving out some of them in order to have the defaults in the database after running the DDL.
A totally different approach could be to
a) create a database link from one DB to another.
b) create table <new_table> as select * from
<old_table@dbLink> where 1=2;I keep that in mind, thanks for that hint. -
Should user_table be used in stored procedure.
Hi,
i want to find my permanent table in user_tables and then drop and recreate it,
can i use this user_tables in my stored procedure for above purpose or is there any view which should be used.
sp is admin sp , used to run offline.
yorus sincerely
Edited by: 944768 on Feb 10, 2013 11:44 PM
Edited by: 944768 on Feb 10, 2013 11:44 PM>
the stored proc is run by single purson to do some admin job and data transfer job offline.
so it checks the existence of table if it exists it drops it then create it, the need was related to release of that Stored proc.
in reality there is not need it can be handeled.
but i wanted to know that can i use user_table in above stored proc to find the existence and then drop and create it when everit runs ?
>
No - an admin user cannot use the USER_TABLES view to see tables owned by a different user. The would need to use the ALL_TABLES or DBA_TABLES view and specify the OWNER in the query.
See ALL_TABLES in the Database Reference
http://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_2105.htm#i1592091
The bigger problem you will have is that dropping the table may cause other objects and code to become invalid and break other processes. Those components would need to be recompiled.
Another issue is: where will you get the DDL to recreate the table?
One source is to use DBMS_METADATA.GET_XML to get the DDL before you drop the table and then submit that XML using the same package to recreate the table.
But doing all of that dynamically (get DDL, drop the table, find/recompile the invalid objects, recreate the table) is very risky and likely to cause errors. And because the process is dynamic you cannot find or fix problems easily so it needs to be bullet-proof.
The time and resources it would take to do the job properly will be excessive compared to just creating scripts to run manually.
Your approach is NOT recommended. -
Record counts of the tables in USER_TABLES
Hello everyone.
Please give me advice, is it possible to enumerate the tables in the USER_TABLES and in the same time to retrieve the record count in every each of them?
To illustrate, I want something like that:
select t.table_name,(select count(*) from t.table_name) from USER_TABLES t
This is only for isllustration. I know that is not the way.
Thank you in advance for your answers.Code could be compacted down a little...
SQL> set serveroutput on
SQL> ed
Wrote file afiedt.buf
1 declare
2 cursor cur_table_count is
3 select table_name from user_tables order by table_name;
4 v_cnt number;
5 begin
6 dbms_output.put_line('Table Name Record Count');
7 dbms_output.put_line('============================== ============');
8 for t in cur_table_count
9 loop
10 execute immediate 'select count(*) from '||t.table_name into v_cnt;
11 dbms_output.put_line(RPAD(t.table_name,31)||v_cnt);
12 end loop;
13* end;
SQL> /
Table Name Record Count
============================== ============
BONUS 0
DEPT 4
EMP 14
SALGRADE 5
PL/SQL procedure successfully completed. -
2x cursor: 1x user_tables + 1 x tab_cols
Hi guys,
I was just wondering whether it is possible to dynamicaly get all user tables then all user columns and write all content to a file.
What I am trying to do is export all the tables listed in user_tables.
I have got the loop already for the user_tables and the loop for the user_columns too,
but then I need to get the column name dynamically and then something like this doesn't work:
OPEN the_cursor_table FOR 'select * from '|| utables.table_name;
LOOP
table_name := utables.table_name;
* FETCH the_cursor_table INTO table_name%rowtype;
EXIT WHEN the_cursor_table%NOTFOUND;
It is not working on the line with an astrix, how can this be fixed?
4Eyescant you generate a script like this. if you want you can make changes and add extra commas so that you can spool it to CSV.
SQL> WITH my_user_tables AS
2 ( SELECT 'test1' AS tab_name, 'user1' AS user_name
3 FROM DUAL
4 UNION ALL
5 SELECT 'test2' AS tab_name, 'user1' AS user_name
6 FROM DUAL
7 UNION ALL
8 SELECT 'test3' AS tab_name, 'user1' AS user_name
9 FROM DUAL )
10 --
11 , my_all_tab_columns AS
12 ( SELECT 'num1' AS col_name, 'test1' AS tab_name
13 FROM DUAL
14 UNION ALL
15 SELECT 'sno1' AS col_name, 'test1' AS tab_name
16 FROM DUAL
17 UNION ALL
18 SELECT 'dno1' AS col_name, 'test1' AS tab_name
19 FROM DUAL
20 UNION ALL
21 SELECT 'num2' AS col_name, 'test2' AS tab_name
22 FROM DUAL
23 UNION ALL
24 SELECT 'sno2' AS col_name, 'test2' AS tab_name
25 FROM DUAL
26 UNION ALL
27 SELECT 'dno2' AS col_name, 'test2' AS tab_name
28 FROM DUAL
29 UNION ALL
30 SELECT 'num3' AS col_name, 'test3' AS tab_name
31 FROM DUAL
32 UNION ALL
33 SELECT 'sno3' AS col_name, 'test3' AS tab_name
34 FROM DUAL
35 UNION ALL
36 SELECT 'dno3' AS col_name, 'test3' AS tab_name
37 FROM DUAL )
38 --
39 SELECT col_name, tab_name
40 FROM my_all_tab_columns
41 WHERE tab_name IN ( SELECT tab_name
42 FROM my_user_tables
43 WHERE user_name = 'user1' );
COL_ TAB_N
num1 test1
sno1 test1
dno1 test1
num2 test2
sno2 test2
dno2 test2
num3 test3
sno3 test3
dno3 test3
9 rows selected.
SQL> WITH my_user_tables AS
2 ( SELECT 'test1' AS tab_name, 'user1' AS user_name
3 FROM DUAL
4 UNION ALL
5 SELECT 'test2' AS tab_name, 'user1' AS user_name
6 FROM DUAL
7 UNION ALL
8 SELECT 'test3' AS tab_name, 'user1' AS user_name
9 FROM DUAL )
10 --
11 , my_all_tab_columns AS
12 ( SELECT 'num1' AS col_name, 'test1' AS tab_name
13 FROM DUAL
14 UNION ALL
15 SELECT 'sno1' AS col_name, 'test1' AS tab_name
16 FROM DUAL
17 UNION ALL
18 SELECT 'dno1' AS col_name, 'test1' AS tab_name
19 FROM DUAL
20 UNION ALL
21 SELECT 'num2' AS col_name, 'test2' AS tab_name
22 FROM DUAL
23 UNION ALL
24 SELECT 'sno2' AS col_name, 'test2' AS tab_name
25 FROM DUAL
26 UNION ALL
27 SELECT 'dno2' AS col_name, 'test2' AS tab_name
28 FROM DUAL
29 UNION ALL
30 SELECT 'num3' AS col_name, 'test3' AS tab_name
31 FROM DUAL
32 UNION ALL
33 SELECT 'sno3' AS col_name, 'test3' AS tab_name
34 FROM DUAL
35 UNION ALL
36 SELECT 'dno3' AS col_name, 'test3' AS tab_name
37 FROM DUAL )
38 --
39 SELECT 'select '
40 || SUBSTR ( MAX ( SYS_CONNECT_BY_PATH ( col_name, ',' )), 2 )
41 || ' from '
42 || tab_name
43 || ';' query
44 FROM ( SELECT tab_name, col_name
45 , ROW_NUMBER ( ) OVER ( PARTITION BY tab_name ORDER BY col_name )
46 rn
47 FROM my_all_tab_columns
48 WHERE tab_name IN ( SELECT tab_name
49 FROM my_user_tables
50 WHERE user_name = 'user1' ))
51 START WITH rn = 1
52 CONNECT BY PRIOR rn = rn - 1 AND PRIOR tab_name = tab_name
53 GROUP BY tab_name
54 ORDER BY tab_name;
QUERY
select dno1,num1,sno1 from test1;
select dno2,num2,sno2 from test2;
select dno3,num3,sno3 from test3;
SQL> -
Query to find all the view name and their size in GB
Hi,
What is the query to find all the view name and their size in GB.I am aware of joining all_views and user_segments but this is not serving the purpose.is there any table i need to join to get the desired result
ThanksYou could of course be thinking of views as they are stored in other RDBMS' as some of them actually create the view as a table on the database with a copy of the data in it and maintain that data as the base tables are updated.
As already mentioned, Oracle just stores the SQL of the View and executes that SQL when the view is queried.
Alternatively, Oracle also has "materialized views" which are created as snapshots of the data and will have a size. This data is updated (refreshed) based on the parameters used when creating the materialized view which means that it will either be, commonly, when a commit is issued or when a refresh is explicitly requested (refresh on demand). -
Hi ,
using the user_segment and especially the blocks column , i get the following results (in scott schema):
SQL> select segment_name , blocks from user_segments where segment_name in ('DEPT','EMP');
SEGMENT_NAME BLOCKS
DEPT 8
EMP 8Using the user_tables and the blocks column , i get the following results :
SQL> SELECT TABLE_NAME , BLOCKS FROM USER_TABLES WHERE TABLE_NAME IN ('DEPT','EMP');
TABLE_NAME BLOCKS
DEPT 5
EMP 5So , is it correct to say that the space allocation for each of these tables is 5/8 =62,5% ...?????
Thanks , a lot
SimonThe difference of those is empty_blocks, isn't it ?That is not the case :
SQL> select segment_name , blocks from user_segments where segment_name in ('DEPT','EMP');
SEGMENT_NAME BLOCKS
DEPT 8
EMP 8
SQL> SELECT TABLE_NAME , BLOCKS , EMPTY_BLOCKS FROM USER_TABLES WHERE TABLE_NAME IN ('DEPT','EMP');
TABLE_NAME BLOCKS EMPTY_BLOCKS
DEPT 5 0
EMP 5 0
SQL> Nicolas. -
PO Receipts Interface Error!!
Hi,
We are on 11.5.10. I am trying to create PO receipts using the interface program "Receiving Transaction Processor". I inserted data into the rcv_headers_interface and rcv_transactions_interface tables. As this dta is for contract labor, i am assuming that there is no need to insert data into shipment_related interface table. Following shows the insert statement I made sure that I am running the process from the correct org (the org that i used in the filed destination_oprganization field). But still the process completes normally but po_interface_errors has a record with error message as :
"RVTSH-189: Subroutine rvtshiline() returned error
Cause: Subroutine rvtshiline() returned an internal error.
Action: Note this error number and the actions you are trying to perform.
Contact your system administrator for"
The receipt gets created succesfully from the form. Anyone knows the issue? Please help me...thanks
Here are the insert statements...
--Insert data into Interface tables
INSERT INTO rcv_headers_interface
(header_interface_id,
GROUP_ID,
processing_status_code,
receipt_source_code,
transaction_type,
auto_transact_code,
last_update_date,
last_updated_by,
creation_date,
created_by,
expected_receipt_date,
comments,
validation_flag,
packing_slip,
vendor_id,
vendor_site_id,
ship_to_organization_id
VALUES (rcv_headers_interface_s.NEXTVAL,
rcv_interface_groups_s.NEXTVAL,
'PENDING',
'VENDOR',
'NEW',
'RECEIVE',
SYSDATE,
fnd_global.user_id,
SYSDATE,
fnd_global.user_id,
SYSDATE,
'test',
'Y',
'ABC',
po_headers.vendor_id,
po_headers.vendor_site_id
po_distributions.destination_organization_id
--Insert record in transactions_interface
INSERT INTO rcv_transactions_interface
(interface_transaction_id,
header_interface_id,
processing_status_code,
receipt_source_code,
transaction_date,
GROUP_ID,
last_update_date,
last_updated_by,
creation_date,
created_by,
transaction_type,
processing_mode_code,
transaction_status_code,
quantity,
unit_of_measure,
source_document_code,
po_header_id,
po_line_id,
po_line_location_id,
po_distribution_id,
to_organization_id,
comments,
interface_source_code,
employee_id,
auto_transact_code,
destination_type_code,
attribute_category,
category_id,
item_description
VALUES (rcv_transactions_interface_s.NEXTVAL,
rcv_headers_interface_s.CURRVAL,
'PENDING',
'VENDOR',
SYSDATE,
rcv_interface_groups_s.CURRVAL,
SYSDATE,
fnd_global.user_id,
SYSDATE,
fnd_global.user_id,
'RECEIVE', --'NEW',
'BATCH',
'PENDING',
2,
po_lines.unit_meas_lookup_code,
'PO',
po_headers..po_header_id,
po_lines.po_line_id,
po_line_locations.po_line_location_id,
po_distributions.po_distribution_id,
po_distributions.destination_organization_id,
'TEST',
'RCV',
1234, --employee_id
'RECEIVE',
'RECEIVING',
po_distributions.destination_organization_id,
45074,
'Standard'
);There are several hits on MOS for this error. Pl see if any are applicable in your case -
121907.1 - RVCTP: RVTSH-140 RVTSH-189 SUBROUTINE RVTSHILINE RETURNED ERROR
286966.1 - RVTSH-140 RVTSH-189 Subroutine rvtshiline() errors returned by ROI
1080050.6 - GET ERRORS RVTSH-140 RVTSH-189 when run Receiving Transaction Processor
371314.1 - Receiving:Data Discrepancies, Errors and Validation Issues after upgrade to or install of 11.5.10 (or 11i.SCM_PF.J)
230259.1 - Receiving Open Interface - Unable to complete Receiving Transactions
303246.1 - 11.5.10: Inbound Receiving Transaction errors with RVTBM-008, RVTBM-120 and RVTSH-189
369258.1 - Receipts Failing with RVTS-189 for Receiving Open Interface Transaction
HTH
Srini -
Cannot display all the tables of the schema!!!
Hi:
I use the oracle sql developer on the windows xp, I found that the tables tab cannot display all the tables of the schema owner, I use the sql "select count(*) from user_tables" I found the result is more than the tab can be display, and I also press the "show more" already.... does anyone can help me ???Similarly, I have 852 tables owned by the connected user (selected count from user_tables and checked the user tables report which has this many records returned), but when I double-click on the "Show More" and select Show All, I only get approximately 375 tables listed.
It doesn't help that the sorting is different - ie ASF_ comes before ASFB in the connection pane but the other way around in the report.
However, it looks as though the problem is that tables that are not analysed (based on the report data in DATE_LAST_ANALYZED) are not being displayed under the Table node. -
Table Statistics Gathering Query
Hey there,
I'm currently getting trained in Oracle and one of the questions posed to me were create a table, insert a million rows into it and try to find the number of rows in it. I've tried the following steps to solve this,
First table creation
SQL> create table t1(id number);
Table created.Data insertion
SQL> insert into t1 select level from dual connect by level < 50000000;
49999999 rows created.Gathering statistics
SQL> exec dbms_stats.gather_table_stats('HR','T1');
PL/SQL procedure successfully completed.Finally counting the number of rows
SQL> select num_rows from user_tables where table_name='T1';
NUM_ROWS
49960410
SQL> select count(*) from t1;
COUNT(*)
49999999My database version is,
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
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 - ProductionI would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
Thank You,
Vishalvishm8 wrote:
Gathering statistics
SQL> exec dbms_stats.gather_table_stats('HR','T1');
PL/SQL procedure successfully completed.I would like to know why there are two different results for the same table when using "num_rows" from the view "user_tables" and the aggregate function "count()" over the same table. Please do keep in mind that i'm studying oracle and this is from a conceptual point of view only. I would like to know how gathering the table statistics works using dbms_stats package works.
Thank You,
VishalBecause you aren't specifying a value for estimate_percent in the procedure call (to gather_table_stats) Oracle will pick an estimate value for you. If you want to sample the entire table you would need to explicitly specify that in your procedure call.
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_stats.htm#ARPLS68582 -
How can i get my scrpit to overwrite or rebuild objects already created?
I am a student studying database design so please bare in mind i am a beginner.
Basically i want my script to be able to be run again and again on the same system. When it does this i want it to overwrite or rebuild the objects already made by the script before(in this case a number of tables with PK and FK).
At the moment if i do this it just says the objects and referential integrity already exists? Is there a way i can do this so it overwrites them? By the way the tables contain no data.
Thanks in advance!
Edited by: Jay on 04-Nov-2010 04:25You can individually write a series 'drop table' and 'drop constraint' statements in to your script for each table in your schema, which is fine for a small number of fixed tables/constraints. When your schema expands (as they are wont to do), it might become a little laborious to copy them all out.
Jarola's procedure references two special system views named "USER_TABLES" and "USER_CONSTRAINTS" which contain information about the relevant types of user-owned database objects in your schema (there's another view called "USER_OJBECTS" as well which covers similar territory) and generates the 'drop' statements dynamically (i.e 'on the fly'), which is significantly easier and less prone to error or omission.
You only need to run his code "create procedure" code once and you can reference the procedure anywhere in your script (or other scripts). It also means that you could potentially re-use his code in another schema for the same purpose. -
Use variables in a SELECT INTO FROM command
Hi,
How do I use variables within a select into from command? I want to loop through SYS.DBA_TABLES using a cursor and count the number of rows in a
selection of tables an then insert into a cardinality table.
The count of rows will be stored in a variable called CNT, that bit is easy however I need a variable in the FROM clause because that
value changes with every iteration of the cursor.
e.g.
CNT := 0;
TN := "MyTable";
select count(*) into CNT FROM TN;
insert into cardinality (table_name, row_count) values (TN, CNT);
This is Oracle 9i and I need the row counts in a separate table as they are shipped over to a different environment for analysis purposes.
Any ideas?
Regards
Dave
Edited by: Yorky001 on Sep 15, 2010 10:32 AMHi,
Thanks for the info, unfortunately I can get neither example to work on this 9i system, could well be pilot error as I only ever get
to do any Oracle about once per year. In the first query I have tried both "user_tables" and SYS.DBA_TABLES, same result.
set serveroutput on size 1000000;
DECLARE
row_count INTEGER;
vstr VARCHAR2(500);
vstr1 VARCHAR2(500);
BEGIN
vstr := 'SELECT count(*) FROM ';
dbms_output.put_line(vstr);
FOR i IN (SELECT table_name FROM user_tables WHERE rownum < 10) LOOP
vstr1 := vstr || i.table_name;
EXECUTE IMMEDIATE vstr1
INTO row_count;
dbms_output.put_line(i.table_name || ':' || row_count);
END LOOP;
END;
This one complains about the execute immediate line.
Error report:
ORA-00933: SQL command not properly ended
ORA-06512: at line 12
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
BEGIN
FOR i IN (select
table_name,
to_number(
extractvalue(
xmltype(
dbms_xmlgen.getxml('select count(*) c from '||table_name))
,'/ROWSET/ROW/C')) count
from user_tables
where rownum<6) LOOP
dbms_output.put_line(i.table_name || ':' || i.count);
END LOOP;
END;
ORA-19206: Invalid value for query or REF CURSOR parameter
ORA-06512: at "SYS.DBMS_XMLGEN", line 121
ORA-06512: at line 1
ORA-06512: at line 2
19206. 00000 - "Invalid value for query or REF CURSOR parameter"
*Cause: The queryString argument passed to DBMS_XMLGEN.newContext was not a valid query, or REF CURSOR.
*Action: Rewrite the query so that the queryString argument is a valid query or REF CURSOR. -
Oracle.xml.sql.query.OracleXMLQuery GetXML -withDTD
I'm trying to create a dtd for each table in my schema. I've created a java program that loops through the user_tables and I am then trying to create the DTD with oracle.xml.sql.query.OracleXMLQuery -withDTD. I am able to make it work using the XSU Command Line Utility, but I'm having a hard time trying to find out where the -withDTD flag goes inside my java program. Anyone know how to use the -withDTD option inside of a java program?
Thanks[from XmlRpc-Java]
As a result, my XML
is contained in a String instead of an InputStream.
It is possible to convert a String to an InputStream using
StringBufferInputStream, but this class is deprecated in favor of
StringReader (as StringBufferInputStream does not properly convert
characters into bytes).
For the default HTTP transport, an InputStreamReader could be used to
wrap the InputStream before calling parse().
Ultimately, the InputStream is converted to an InputSource for use by
the SAX parser. InputSource will accept a Reader as well.
[from XmlRpc-Java]
There should be a way to go from "getXMLString()" to "parse(Reader)" also. In the meantime I'm stuck.
null
Maybe you are looking for
-
I have bought a Idjay system and I have the App on the 4S phone however the phone is not aknowledging the system. After googling we found that their is an issue with IOS7 for this system. So we tried an Itouch, its on IOS6 but doesnt work. Then tried
-
Songs I have on iPhone now no longer appear with iTunes Match
I had some albums on both my Mac and my iPhone. Now with Match, the album doesn't appear on my iPhone-even though I manually had uploaded it. Match also doesn't load up all my music: I have a mere 2,400 songs-and the last 100 songs have been a nightm
-
Dts.Events.FireInformation: Output not coming through to recordset
I am using SQL Server 2008. I have a SQL Server T-SQL procedure that uses a shell command to execute a batch file. The batch file uses DTExec to execute an SSIS package. The T-SQL procedure is called from a Microsoft Access from end using ADODB.
-
Flash will not display on cfm page
For some reason my coldfusion server will not display any Flash (including Flash Forms) If I change the page to html it displays fine, also there are no issues with my dev machine, both machines are running cf8. Any ideas? Thanks in advanced Cavan
-
Ipod nano touchpad doesnt work in heat?
I noticed that when my ipod nano is in the sun and mainly in heat or hot conditions the touchpad will not work. i can still click everything and turn it on and off but the volume gets screwed up and i cant control it to go up or down. the volume is a