Avg_row_leng in dba_tables
Hi
Can somebody answer my querries
Is "avg_row_len" in dba_tables is in Bytes if not then what is its units ???
Will "avg_row_len"*"num_row" give table physically occupied space in terms of bytes in a tablespac ??Thanks in advacne
Bye
KVSS
yes..u are correct.
avg_row_len is in bytes and "avg_row_len"*"num_row" will give table physically occupied space in terms of bytes in a tablespace
Similar Messages
-
Accessing DBA_TABLES from PL/SQL
Hi all,
Can I access DBA_TABLES from a PL/SQL block?
Following is the code I tried:
SQL> SHOW USER
USER is "SYSTEM"
SQL> ED
Wrote file afiedt.buf
1 CREATE OR REPLACE PACKAGE BODY BARAKAU
2 AS
3 PROCEDURE UPPER_COLS ( P_USER VARCHAR2, P_TABLE VARCHAR2 ) IS
4 BEGIN
5 -- loop through tables
6 FOR T IN ( SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)
7 AND OWNER=UPPER(P_USER) ORDER BY TABLE_NAME) LOOP
8 DBMS_OUTPUT.PUT_LINE(T.TABLE_NAME || ' processed');
9 END LOOP;
10 END UPPER_COLS;
11* END BARAKAU;
SQL> /
Warning: Package Body created with compilation errors.
SQL> SHOW ERROR
Errors for PACKAGE BODY BARAKAU:
LINE/COL ERROR
6/13 PL/SQL: SQL Statement ignored
6/36 PL/SQL: ORA-00942: table or view does not exist
8/4 PL/SQL: Statement ignored
8/25 PLS-00364: loop index variable 'T' use is invalid
SQL> L 6
6* FOR T IN ( SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)Oracle 11g on WindowsHi,
SQL> SHOW USER
User is "SYS"
SQL>
Package created
Package body created
No errors for PACKAGE BODY SYS.BARAKAUPackage creation:
CREATE OR REPLACE PACKAGE BARAKAU AS
PROCEDURE UPPER_COLS(P_USER VARCHAR2,
P_TABLE VARCHAR2);
END BARAKAU;
CREATE OR REPLACE PACKAGE BODY BARAKAU AS
PROCEDURE UPPER_COLS(P_USER VARCHAR2,
P_TABLE VARCHAR2) IS
BEGIN
-- loop through tables
FOR T IN (SELECT TABLE_NAME
FROM DBA_ALL_TABLES
WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)
AND OWNER = UPPER(P_USER)
ORDER BY TABLE_NAME)
LOOP
DBMS_OUTPUT.PUT_LINE(T.TABLE_NAME || ' processed');
END LOOP;
END UPPER_COLS;
END BARAKAU;
SHOW ERRORSNote: It's not a good idea create specific packages or other objects with users like sys or system...
Regards, -
Db_keep_cache_size and cache in dba_tables
Hello All:
I have recently alter a table to cache it in db_keep_cache pool however i do not see the change reflected in dba_tables in cache column. Is this expected behaviour?
Thanks
S~The CACHE clause is specified when you create the table. It indicates how the blocks of this table handled in regular buffer cache. It's separate setting from keep cache.
CACHE
For data that is accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the most recently used end of the least recently used (LRU) list in the buffer cache when a full table scan is performed. This attribute is useful for small lookup tables.
Once you put your table in keep pool, the BUFFER_POOL should indicate which pool this object belong to.
select buffer_pool from dba_tables
2 where table_name='TEST1'
3 /
BUFFER_
KEEP -
Empty TABLESPACE_NAME in DBA_TABLES
In what situations will the TABLESPACE_NAME field in the DBA_TABLES be empty for a non IOT table?
Regards,
Charles TheophilusA partitioned table simply doesn't have a tablespace ...
Tablespaces then are "attributed" to partitions or to subpartitions and this information can be seen in DBA_TAB_PARTITIONS -
Avg_space in dba_tables
Hi
I want to confirm that whether avg_space in dba_tables indicate free space below high water mark or not.
Regards
JewelHi Jewel,
you want to know the occupied space of the table? or HWM of the table?
check metalink note *How to Determine Real Space used by a Table (Below the High Water Mark) [ID 77635.1]* -
Chang_cnt count in dba_tables ...
Hi,
I have following tables which have chain_cnt count is > 0.
what is a impact for this count in performance of thease tables ...
What should i do to make it this as 0 ...
Thanks in advance
SSM
==================================================
SQL> select table_name,chain_cnt from dba_tables
2* where chain_cnt > 0
SQL> /
TABLE_NAME CHAIN_CNT
TTPLOC006730 2616
TTPLOC002730 123
TTIHRA360730 127
TTIHRA100730 877
TTDPUR920730 10
TTFGLD201730 87
TTDPUR901730 549
TTFGLD018730 2492
TTDIND902730 2
TTFCMG112730 413
TTFCMG110730 103
TABLE_NAME CHAIN_CNT
TTFCMG100730 860
TTFACP954730 391
TTFGLD418930 119
TTFGLD201930 10
TTFCMG112930 90
TTFCMG100930 269
17 rows selected.
SQL>You should compare chain_cnt to num_rows to find out whether it is really a problem. You should also check avg_row_size, to verify whether your records aren't bigger than db_block_size by design (in which case no measure would help).
You can reorganize a table by issuing
alter table <table_name> move tablespace <original_tablespace>
Sybrand Bakker
Senior Oracle DBA -
Query join dba_objects and dba_tables
dear all.
i want to get : list of owners, tablespace_name where the table was created, table_name and the date created column of that table_name in tablespaces t1,t2,t3"
i try to do the script with dba_tables and dba_objects but it shows a lot of records. and the object_id exist only in dba_objects but not in dba_tables.
my query was:
select t.owner, o.created, o.object_name,
t.table_name, t.tablespace_name
from dba_tables t
--,dba_objects o
where
--(o.object_type='TABLE' and o.object_name=t.table_name)
--and
t.tablespace_name in ('t1','t2)
please could you help me??
thanksDo you want that?
select o.owner,t.tablespace_name,t.table_name,o.created from
dba_objects o,
dba_tables t
where o.owner =t.owner and o.object_name=t.table_name
and t.tablespace_name in ('T1','T2','T3') -
When I describle dba_tables either from sysdba login or a user with dba login. I get the following error.
ORA-00942: table or view does not exist
I can access all othe dba_ views. This is on a 10g test database. I don't know whether it was like this from the beginning or I messed up something. I noticed this right after moving a datafile (non system related) to a different folder. I am not sure how that will affect any dba_ views.
Does anybody have any idea on how to troubleshoot this?
Thanksordba wrote:
What are the results for
select * from dba_tab_privs where table_name = 'DBA_TABLES';
show user
desc dba_tables;
select count(*) from dba_tables;
SQL> select * from dba_tab_privs where table_name = 'DBA_TABLES';
GRANTEE OWNER TABLE_NAME
GRANTOR PRIVILEGE GRA HIE
SELECT_CATALOG_ROLE SYS DBA_TABLES
SYS SELECT NO NO
ORDSYS SYS DBA_TABLES
SYS SELECT YES NO
MDSYS SYS DBA_TABLES
SYS SELECT NO NO
SQL> show user
USER is "SYS"
SQL> desc dba_tables
ERROR:
ORA-04043: object dba_tables does not exist
SQL> select count(*) from dba_tables;
select count(*) from dba_tables
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> Everything checks out correctly but still can't access dba_tables. This is a database that got installed on my PC as part of JD Edwards demo install. So it may not be up to date with patches. Do you think it's a bug?
Thanks -
Cann't able to see the num_rows in dba_tables for the particular schems's
Hi ,
I am getting confusion when i chked in dba_tables,but when i chk in the schema getting rows.can any one help on this. Thanks!!
SQL> select table_name,num_rows from dba_tables where owner like 'ORCL';
TABLE_NAME NUM_ROWS
AUDITTRAIL
SQL> conn orcl@XE
Enter password:
Connected.
SQL> select count(*) from AUDITTRAIL;
COUNT(*)
20974Hi
Use DBMS_STATS package to view and modify optimizer statistics gathered for database objects.
exec dbms_stats.gather_table_stats(ownname=>'SYS',tabname=>'ORCL',estimate_percent=>30,method_opt=>'FOR ALL COLUMNS SIZE 1',degree=>4)
THEN
select table_name,num_rows from dba_tables where owner like 'ORCL'; -
12c: redaction_policies table not visible in dba_tables, dictionary
The table redaction_policies is visible when we describe it or search tab but is not listed in dictionary or dba_tables.
NCDB@NCDB> desc redaction_policies
Name Null? Type
OBJECT_OWNER NOT NULL VARCHAR2(128)
OBJECT_NAME NOT NULL VARCHAR2(128)
POLICY_NAME NOT NULL VARCHAR2(128)
EXPRESSION NOT NULL VARCHAR2(4000)
ENABLE VARCHAR2(7)
POLICY_DESCRIPTION VARCHAR2(4000)
NCDB@NCDB> select table_name from dba_tables where table_name like '%REDA%';
no rows selected
NCDB@NCDB> select table_name from dictionary where table_name like '%REDA%';
no rows selected
NCDB@NCDB> select tname from tab where tname like '%REDA%';
TNAME
REDACTION_COLUMNS
REDACTION_POLICIES
REDACTION_VALUES_FOR_TYPE_FULL
what could be the reason?
RegardsI'd say I wouldn't expect it to be returned from dba_tables, since it's a datadictionary view, just like V$SESSION etc.
SQL> select * from dba_tables where table_name = 'V$SESSION';
no rows selected
However, based on the docs:
Configuring Oracle Data Redaction Policies
I'd expect to see it returned from dictionary, just like:
SQL> select * from dictionary where table_name = 'V$SESSION';
TABLE_NAME
COMMENTS
V$SESSION
Synonym for V_$SESSION
1 row selected.
But, since I'm not on 12c now, I can't really add much more. -
Cannot Drop Table that Shows in dba_tables
In my IDE I see two tables that I no longer need. I created them as a test to see the difference between LOGGING vs NOLOGGING. Now I want to drop the tables.
I issue the command drop table customers_no_logging.
The system responds with ORA-00942: table or view does not exist.
However, select table_name from dba_tables returns the table names in question.
Even in sqlplus I get the same result:
SQL> select table_name from dba_tables where owner = 'RUB';
TABLE_NAME
CUSTOMERS
INV_ITEM_MASTER
INV_SITE
CUSTOMERS_w_log
CUSTOMERS_no_log
5 rows selected.
SQL> drop table CUSTOMERS_no_log;
drop table CUSTOMERS_no_log
ERROR at line 1:
ORA-00942: table or view does not exist
How can I drop these tables?
Thanks,
GregoryI was connected as RUB in my IDE and SYS in SQLPlus.
I have connected as RUB in SQLPlus and tried
SQL> drop table "RUB.CUSTOMERS_no_log";
drop table "RUB.CUSTOMERS_no_log"
ERROR at line 1:
ORA-00942: table or view does not exist
Maybe I need to stop and restart the DB?
Gregory -
Hi All,
I am a newbie to Oracle, was checking total no. of tables present in the DB, but got little confused now.
I tried querying DBA_SEGMENTS, DBA_OBJECTS and DBA_TABLES but got different outputs.
SQL> select object_type,count(1) from dba_objects where OBJECT_TYPE='TABLE' group by object_type;
OBJECT_TYPE COUNT(*)
TABLE 2437
SQL> select segment_type,count(1) from dba_segments where segment_type='TABLE' group by segment_type;
SEGMENT_TYPE COUNT(*)
TABLE 1631
If a table is a partitioned one, then each partition will be considered as a different segment hence I checked for table partition also.
SQL> select segment_type,count(*) from dba_segments where segment_type like 'TABLE_%' group by segment_type;
SEGMENT_TYPE COUNT(*)
TABLE SUBPARTITION 32
TABLE PARTITION 215
still the addition of above two does not give (32+215+1631=1878), i.e., not 2437
Then tried querying DBA_TABLES:
SQL> select count(1) from dba_tables;
COUNT(1)
2417
could you please help me to understand difference between these three and which one is the correct answer ?Prior to 11.2.0.3, Indexes on LOB columns are not included under DBA_OBJECTS, Whereas From 11.2.0.3 there is a change in which indexes on LOB columns are now included in DBA_OBJECTS.
DBA_TABLES VS DBA_SEGMENTS
DBA_TABLES includes CLUSTERED TABLES, TEMPORARY, PARTITIONED, and INDEX ORGANIZED tables that are not included in DBA_SEGMENTS as they have no storage allocations
DBA_SEGMENTS contains TYPED (for internal use only) tables ( bitand(TAB$.property, 1) = 0 ) that are not included in DBA_TABLES
DBA_TABLES VS DBA_OBJECTS
DBA_TABLES includes the internal table _default_auditing_options_ that is not included in DBA_OBJECTS
DBA_OBJECTS include TYPED (for internal use only) tables ( bitand(TAB$.property, 1) = 0 ) that are not included in DBA_TABLES
DBA_SEGMENTS VS DBA_OBJECTS
DBA_SEGMENTS includes the internal table _default_auditing_options_ that is not included in DBA_OBJECTS
DBA_OBJECTS include CLUSTERED TABLES, TEMPORARY, PARTITIONED, and INDEX ORGANIZED tables that are not included in DBA_SEGMENTS as they have no storage allocations
If you have access to My Oracle Support, Please check Note 363048.1 : WHY DO DBA_TABLES DBA_OBJECTS AND DBA_SEGMENTS DIFFER WHEN SELECTED FOR TABLES?
Regards,
Suntrupth -
PL/SQL report errors: ORA-01422
Hi all,
(before i you read i would like to say i have searched the net for this error code but nothing shows up like this problem..)
I am getting an error problem when i select certain Schemas from a list on an apex app. page, it only works for some schemas not all..
When i select one schema, it is supposed to display one row.. when i select [ALL] it is supposed to show them all.
It does work if i select '[ALL]' from the select list (p3_schema_name), just not for every single individual one.
the error code:
ORA-01422: exact fetch returns more than requested number of rows
declare
vSchema varchar2(20);
vStmt varchar2(1000);
vVersion number(5);
vDBName varchar2(20);
vHostName varchar2(80);
vStmt2 varchar2(1000);
vVersion2 number(5);
vDBName2 varchar2(20);
vServer2 varchar2(80);
vSchema2 varchar2(80);
CURSOR c_schemas IS
select owner from dba_tables@P3_DB_NAME.db_link where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
begin
IF :P3_SCHEMA_NAME != '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vServer2 := :P3_SERVER_NAME;
vSchema2 := :P3_SCHEMA_NAME;
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM';
Execute Immediate vStmt2 into vDBName2, vVersion2;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td>');
htp.p(vServer2);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName2);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema2);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion2);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
htp.p('</tr>');
htp.p('</table>');
ELSE IF :P3_SCHEMA_NAME = '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vHostName := :P3_SERVER_NAME;
vDBName := :P3_DB_NAME;
open c_schemas;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
LOOP
FETCH c_schemas INTO vSchema;
EXIT WHEN c_schemas%NOTFOUND;
vStmt := 'select max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link where DDH_SCHEMA_NR = (select max(DDH_SCHEMA_NR) from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link) and rownum < 2' ;
Execute Immediate vStmt into vVersion ;
htp.p('<tr>');
htp.p('<td>');
htp.p(vHostName);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
END LOOP;
htp.p('</tr>');
htp.p('</table>');
CLOSE c_schemas;
END IF;
END IF;
END;I have checked the DDH_SCHEMA_NR for repeating entries of the highest number.. some of the ones that dont work do have repeating entries some don't.
Sorry if this is confusing, i have tried to explain it as best as i can.
Thanks in advance for any help.
AshleighHello Ashleigh,
Based on your code, I'd start by running this piece of SQL via command-line (thru SQL Workshop, SQL*Plus, Toad, etc.), replacing &P3_SCHEMA_NAME. and &P3_DB_NAME. with values that are currently causing the routine to fail and see if it returns more than one row. I don't know your data, but DISTINCT and GROUP BY are typically used to return multiple (though grouped/summarized) rows. It appears to be the only statement that would cause the error your seeing (more than one row being returned into single variables).
select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM;I'm actually surprised that the code runs at all. I didn't think 'execute immediate' would know what to do with substitutions indicated as "&something." (I've typically seen that when substituting in dynamic HTML/Javascript code but maybe I'm learning something new). But since you already have vServer2 and vSchema2, I'd be more apt to code it as:
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from ' ||
vSchema2 || '.ddl_log@' || vServer2 || '.db_link GROUP BY DDH_DB_NM';Hope this helps,
John -
Problem while dropping a table
Dear All,
I am facing a problem while dropping a table in Oracle 10g.
I am able to find the number of records in the table but unble to delete it.
SQL> select count(*) from merchant_audit;
COUNT(*)
30028278
SQL> drop table merchant_audit;
drop table merchant_audit
ERROR at line 1:
ORA-00942: table or view does not exist
I have to drop this table from the database. Please help.
regards,
SanthoshHi,
IS it a table ? Is it your table ?
Read this example :
sqlplus scott/*****
SQL> create table merchant_audit(col1 number);
Table created.
SQL> create public synonym merchant_audit for merchant_audit;
Synonym created.
SQL> grant select on merchant_audit to merchant;
Grant succeeded.
SQL> conn merchant/merchant
Connected.
SQL> select count(*) from merchant_audit;
COUNT(*)
0
SQL> drop table merchant_audit;
drop table merchant_audit
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>
See owner into the dba_tables, and if synonym into dba_synonyms.
Nicolas.
Message was edited by:
Nicolas Gasparotto -
hi,
I am looking for the best practice about getting the catalog of a database.
I have seen that I can make some select in system-tables(or views) such as DBA_TABLES and DBA_VIEWS, or DBA_CATALOG, but is that the best way to grab thses informations ?
(I ask this question because It seems a strange way to me to get the table names using a simple select, but getting column info using a specialized function, OCIDescribeAny(). this does not look like a coherent API...)
thanks for your advice
cdin the same idea, why use OCIDescribeAny instead of doing an appropriate select in DBA_TAB_COLUMNS ?
cd
Maybe you are looking for
-
Crystal report - how to split a field into more fields
Hello, I`m new to Crystal reports and I`ve got a trouble. I have field which contains an address - street, city, zip code. The example is: STEHLIKOVA 977 165 00 PRAHA 620 - SUCHDOL 165 00. What I need to achieve is to split this string into three sep
-
if to read the data from a RT table which of the following function module will be best . <b>pyxx_read_payroll_result</b> or <b>RP_FILL_WAGE_TYPE_TABLE</b> what i am doing is i am filling the rgdir table using the function module <b>cu_read_rgdir</b>
-
Time Machine: changing external HDD
Dear All, I'km kinda new to mac, just recently made the switch so if my question has been answered already for like a hundred times I'm really sorry. I started using time machine a week ago using my smaller External HDD, a 160GB one. I have bought a
-
Hello Me and my Brother both have iMac G5's, which are both connected to the same network and router. But in the Network panel in the finder window, he can see my User and access my files, but I cannot see his user at all. Is this a problem with my I
-
ADF Swing - what happened to 'Display panel.java'
When editing a for with embedded panels, in Jdev 10, when you right-click on the panel there is an option 'Display panel.java', that opens embedded panel for edit. I don't see this option in 11gTP3