Query to find tables in database having maximum records or data
hello
how can i find 10 high volume tables in my database
Regards
Hi user;
Please try below query:
How many schema we have and their size
set pages 999
col "size MB" format 999,999,999
col "Objects" format 999,999,999
select obj.owner "Owner" ,
obj_cnt "Objects" , decode(seg_size, NULL, 0, seg_size) "size MB" from
(select owner, count(*) obj_cnt from dba_objects group by owner) obj ,
(select owner, ceil(sum(bytes)/1024/1024) seg_size from dba_segments group by owner) seg where obj.owner = seg.owner(+) order by 3 desc ,2 desc, 1
To find Ten bigest object on our db
col owner format a15
col segment_name format a30
col segment_type format a15
col mb format 999,999,999
select owner , segment_name , segment_type , mb from (
select owner , segment_name , segment_type , bytes / 1024 / 1024 "MB" from dba_segments
order by bytes desc ) where rownum < 11
Regard
Helios
Similar Messages
-
How to find tables from database having no partition
Hello Sir,
How to find tables from oracle database having no partitions?
Thank you.
-Mal@SB,
SQL> SELECT OWNER, TABLE_NAME FROM DBA_TABLES
2 MINUS
3 SELECT OWNER, TABLE_NAME FROM DBA_TAB_PARTITIONS;
SELECT OWNER, TABLE_NAME FROM DBA_TAB_PARTITIONS
ERROR at line 3:
ORA-00904: "OWNER": invalid identifier@OP,
select table_name,partitioned from dba_tables where partitioned='YES';
select table_name,partitioned from dba_tables where partitioned='NO';
Regards
Girish Sharma
Edited by: Girish Sharma on Jul 1, 2011 9:27 AM -
Writing a query to find out who is having a given responsibility name.
Hi,
I am new to Oracle Apps and have no idea about its tables. Can anyone please help me in writing a query to find out who is having a given responsibility name.
Thanks in advance.
Regards
HimanshuHi
you can get required data by using this query
select usr.user_name
, res.responsibility_name
from fnd_user usr
, FND_USER_RESP_GROUPS_DIRECT usrrep
, fnd_responsibility_tl res
where usr.user_id=usrrep.user_id
and usrrep.responsibility_id=res.RESPONSIBILITY_ID
group by usr.user_name,res.responsibility_name
Regards,
Venky -
Find - tables with largest number of records?
Hi,
I need to find tables with largest number of records. Any transaction show this details?
aRsGo to transaction DB02, then click on the button that reads, "Space Statistics", the dialog box, click ok, leave the "*" for all tables, In the next screen put your cursor in the appropriate column labeled as Rows and click the sort button. Now you will see your biggest tables at the top of the list.
Regards,
Rich Heilman -
SQL query to find top 5 users having more rows/data in table
Dear experts,
OS = HP-UX
Database = Oracle 9.2.0.8
AC users = 600
Ex:-
select * from all_users where username like 'AC%';
AC_1
AC_2
AC_3
AC_4
AC_5
AC_6
AC_.
AC_.
AC_.
AC_600
Each AC user having same tables INCOMING, OUTGOING
Now i need to find top 5 users having more rows/data in INCOMING , OUTGOING tables. I tried this:
SQL>conn AC_1/pwd
select 'select count(*) from '||table_name||';' from user_tables;
But i get max counts info only for this AC_1 user , however, i need top 5 users having more rows/max counts query.
Thank you,source : oracle forums
May be , this one.. not tested though.
Before doing this you need to have select_catalog_role
WITH tmp
AS (SELECT owner,
table_name,
TO_NUMBER (
EXTRACTVALUE (
xmltype (
DBMS_XMLGEN.getxml (
'select /*+ PARALLEL*/ count(*) c from '
|| table_name)),
'/ROWSET/ROW/C'))
Cnt
FROM dba_tables
WHERE 1 = 1 AND table_name IN ('INCOMING', 'OUTGOING')),
tmp1
AS (SELECT a.*,
MAX (cnt)
OVER (PARTITION BY a.table_name ORDER BY a.cnt DESC)
maxcnt
FROM tmp a)
SELECT DISTINCT a.*
FROM tmp a, tmp1 b
WHERE a.cnt = b.maxcnt AND a.table_name = b.table_name; -
Query to find the user is having access to sql server DB
Hi,
Please help me in this.
Query to find the whether the user is having access to sql server DB.
Cheers,
sajithTUBBY_ORCL?Select 1 from dual where 'ORACLE' = 'SQL SERVER';
no rows selected
Elapsed: 00:00:00.01 -
Need a Query to find whether the database needs any media recovery...
Hi,
I am at the mount stage of a database and yet be opened.at this stage any Query is available or any other way is there to find whether the database needs any media recovery or Instance recovery..?
my objective is before opening the database i need to make sure it is consistent or inconsistent and any form of recovery is needed..
thanks ®ards,
Ragunath
Edited by: ragu.dba.in on Mar 6, 2013 12:57 AMHi Ragunath,
Use these queries , SCN should be consistent .. no fuzzy files, check for recovery of files in v$recover_file .. pass sufficient archives & fulfill the checks before open reset-logs
set line 900
set pages 900
set echo on
alter session set nls_date_format='dd-mon-yyyy hh24:mi:ss';
set numwidth 13
col CHECKPOINT_CHANGE# for 9999999999999999
col CHANGE# for 9999999999999999
column error format a10
column member format a60
show parameter db_recover
select * from v$recover_file;
select file#, status from v$datafile;
select file#, checkpoint_change#, checkpoint_time, error from v$datafile_header;
select distinct status from v$backup;
select distinct checkpoint_change# from v$datafile_header;
select hxfil file_id, fhscn scn, fhthr thread, fhrba_seq sequence, fhsta status from x$kcvfh;
select distinct fhscn from x$kcvfh;
select hxfil file_id, fhtnm tablespace_name from x$kcvfh;
##### Fuzzy Check ####
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
set feedback on
set heading on
set pagesize 1000
set linesize 175
column checkpoint_change# format 999999999999999999999
select status, checkpoint_change#, fuzzy,
to_char(checkpoint_time, 'DD-MON-YYYY HH24:MI:SS') as checkpoint_time,
count(*)
from v$datafile_header
group by status, checkpoint_change#, fuzzy, checkpoint_time
order by status, checkpoint_change#, fuzzy, checkpoint_time;Thanks,
Ajay More
http://www.moreajays.com -
Sql query across multiple tables ina database
I have 3 MS Access tables in database that are linked by keyed fields in the table. Is there a way to fetch only certain records that match a criteria across all three of these tables using the database connectivity toolset VIs?
Thanks. I am trying to mechanize/run an SQL query like this
SELECT Code_Type.Code_NUM, Code_Type.Code_Word, Word_Type.Parm_Label, Word_Type.Word_Sequence, Word_Type.Num_Words, Parameter_Label.Parm_Label, Parameter_Label.Parm_Name, Parameter_Label.Num_Bits, Parameter_Label.Num_Bits
FROM (Code_Type INNER JOIN Word_Type ON Code_Type.Code_Word = Word_Type.Code_Word) INNER JOIN Parameter_Label ON Word_Type.Parm_Label = Parameter_Label.Parm_Label;
while using the VIs in the database connectivity toolset. How do I code this using these VIs? I dont see an example of a straight SQL string like this being able to be put into the VIs. -
How to find table with colum that not support by data pump network_link
Hi Experts,
We try to import a database to new DB by data pump network_link.
as oracle statement, Tables with columns that are object types are not supported in a network export. An ORA-22804 error will be generated and the export will move on to the next table. To work around this restriction, you can manually create the dependent object types within the database from which the export is being run.
My question, how to find these tables with colum that that are object types are not supported in a network export.
We have LOB object and oracle spital SDO_GEOMETRY object type. our database size is about 300G. nornally exp will takes 30 hours.
We try to use data pump with network_link to speed export process.
How do we fix oracle spital users type SDO_GEOMETRY issue during data pump?
our system is 32 bit window 2003 and 10GR2 database.
Thanks
Jim
Edited by: user589812 on Nov 3, 2009 12:59 PMHi,
I remember there being issues with sdo_geometry and DataPump. You may want to contact oracle support with this issue.
Dean -
Query to Find Table and Column Name by using a value
Dear Legends,
I hope and surfed in our forums and google to find the Table Name and Column Name by having a value(Number/String). And my where clauses are
where owner NOT IN ('SYS','SYSTEM') and
data_type IN ('CHAR','VARCHAR2','NUMBER')
May I have your help for building the query. and my query as follows
select a.owner, c.column_name, c.data_type, c.owner, c.table_name
from dba_objects a, all_tab_cols c
where a.owner NOT IN ('SYS','SYSTEM') and
where c.owner NOT IN ('SYS','SYSTEM') and
where c.data_type IN ('CHAR','VARCHAR2')
order by a.owner
Thanks,
KarthikYou can use
select * from user_tab_columns a, user_tables b
where a.table_name = b.table_name
and a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR');
Or if you want to user DBA_* tables, you can use.
select * from dba_tab_columns a, dba_tables b
where a.table_name = b.table_name
and a.owner = b.owner
and a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR')
and b.owner not in ('SYS', 'SYSTEM');
And now when I look a bit more closely, you don't need DBA_TABLES there. dba_tab_columns alone is sufficient. And requirement is still not clear yet. Why you need a group by there? If I get it right, you can use this.
select * from dba_tab_columns a
where a.data_type in ('NUMBER', 'VARCHAR2', 'NCHAR', 'CHAR')
and a.owner not in ('SYS', 'SYSTEM');
Whether you use group by or not, the query will give you the same output.
Ishan -
Query to find tables whcih are renamed
Hi,
Can anyone help me with a query to list the tables which are renamed or a ttribute of a specific table which will give the result.
Example: If database is renamed then create_date from sys.databases gives the database renamed.
Similar I want for tables
ThanksHi cnk_gr,
Actually I dont want to rename tables want to list the tables whicha re renamed comaring the time.
Can you suggest how could this be achievedusing sp_rename?
Thanks.
Hi Priyanka,
As for as i know, there is no way to track the changes done by sp_rename, unless if you already plan this case as
cnk_gr mentioned with adding extendedproperty, or you can write your version of SP_rename like SP_rename1 which internally calling SP_rename and track the changes on a table
below is the code the changes the object name, i dont know what %% the statement is doing, but i think it may be updating the objectname in physical location where the objectname is saved(just the reference is changed from old name to new name)
-- update the object name
EXEC %%Object(ID = @objid).SetName(Name = @newname)
May be you can compare the schema between similar other server like reporting server or restore a backup, which doesn't have the rename applyed and find out the differnence.
Note: when you rename a table in SSMS, it internally calling sp_rename to change the table name
Thanks
Saravana Kumar C -
Query to find tables with excessive initial extent settings
After loading a database dump we found many tables occupying large space due to large initial extents storage parameter but with very few rows and am trying to determine if it would be worth the effort to reorganize the entire schema. In other words, we are looking for a query to compare the estimated actual space that would be occupied by the table rows vs. the current size to see the space savings if we were to reorganize.
I hacked out a script to calculate the estimated size using the table stats (or 64K if estimate is lower) and compared that vs. the extents allocated to each table but this seems a rather inexact way of doing it. Is there a more accurate approach?
Doing this on Oracle database 10.2.0.4 on Windows Server 2003 SE
SELECT a.table_name,
b.table_size_MB,
ROUND((a.num_rows * a.avg_row_len) / (1024 * 1024),2) calc_size_MB,
b.table_size_MB - GREATEST(ROUND((a.num_rows * a.avg_row_len) / (1024 * 1024),2), 0.0625) savings_MB
FROM dba_tables a,
(SELECT segment_name, sum(bytes)/(1024*1024) table_size_MB
FROM dba_extents
WHERE tablespace_name like 'PMDX' and segment_type = 'TABLE'
GROUP BY segment_name) b
WHERE a.owner = 'CAS' and a.table_name = b.segment_name
ORDER BY b.table_size_MB desc
TABLE_NAME TABLE_SIZE_MB CALC_SIZE_MB SAVINGS_MB
TPM06_POL_DATA_WRK_PREV 640 493.46 146.54
TPM06_POL_DATA_WRK_CURR 640 496.57 143.43
TPM06_POL_DATA_201006 640 496.8 143.2
TPM06_POL_DATA_201005 640 494.87 145.13
TPM06_POL_DATA_201004 640 490.45 149.55
TPM07_MOV_DTLS_WRK 256 198.66 57.34
...Hi,
Didn't you check the dba_extents view with respect to the tables which you estimated.
After loading a database dump we found many tables occupying large space due to large initial extents storage parameterYou might have modified the initial extent size before to your load by pre-created tables ,which might helped out with current situation prior to this as you might be well known with your current database. Does the segement using Autoallocate or Uniform. What is the block size of DB.
- Pavan Kumar N -
Mysql query (search multiple tables in database)
I have 12 tables in a database - january through to december.
I need to search all 12 tables for 'keyworrd' phrases submitted by the user through a search form.
Must be a more streamlined way of doing it than below using 'UNION'. I have incorporated 2 tables in the below query but I need a more 'condensed' query for all 12 tables?
$sql = ('SELECT * FROM january WHERE tourTitle = "'.$keyword.'" UNION SELECT * FROM february WHERE tourTitle = "'.$keyword.'"');
Cheers
Osbregent wrote:
>That's what I did last year but thought I'd break it down this year into 12 easier to work with tables.
No, Ben is correct. Using 1 table for each month is absolutely the wrong way. It violates basic rules of normalization and causes all sorts of problems.
>Breaking it down appeals to be more so I can keep all the relevant months
>together instead of potentially becoming scattered throught-out one table.
That's what you use the Order By clause for.
>If by any chance the client says they want to update x, y or z I can go
>straight to the month in question without the necessity to flip through
>dozens of pages in phpMyAdmin as there is no real CMS management in place for this process.
Not sure what you are saying. Performing inserts, updates and queries is much simpler using a single table.
Whenever someone asks for a way to search through multiple tables, it tells me that the data structure is not designed well.
When I did this job last year there was about 60 pages created in phpMyAdmin. The records for January could be anywhere on those 60 pages as I may have to add additional records much later on in the process.
My thinking behind this was to keep all the month entries together so I could view them easily in phpMyAdmin.
Now due to my lack of knowlege about phpMyAdmin it could be possible to create a query to show only the january entries, I suspect it can do this.
I agree it is a lot simpler using 1 table to select and search through BUT I need if the ocassion arises to be able to view all the january or february entries etc one after the other, not 10 on page 2 and 3 on page 7 and 5 more on page 47 of phpMyAdmin.
So i quess what I really need is to write a select query in phpMyAdmin which only shows the selected entries for the month requested. I have not done much investigation into what phpMyAdmin can do........so I suppose I need to.
EDITED:
Arrgh you see IT WAS SO SIMPLE:
SELECT * FROM `tours` WHERE month = "March"
It's because I'm frightened of the bloody thing in case I mess something up! -
Need query to find out standby database sync information
Hi All,
Please provide me query which give me information about how many standby database configured .I need to generate report hourly sync information of database in our project. I have more than 120 production db and some db having more than one standby database.some of then at local satndby (some of database (prod) in datacenter and some of database in DR datacenter)
Does it it possible to configure in 12c oem?.If it is possible guide me.How can I create report for all databases sync status within one report?
Thanks
GaneshHello;
I like this one:
Monitor Data Guard Transport
Best Regards
mseberg -
Need a query to find Table Dependancy
Hi Experts,
I am in a need to find out which are all tables refer to particular table 'ABC' and / or it's column 'column_1', since I am new to environment and have about 500 + tables.
Please tell me what are the various ways, I can achieve above requirement?
Regards,
MSuser_cons_columns
Information about accessible columns in constraint definitions
OWNER
Owner of the constraint definition
CONSTRAINT_NAME
Name associated with the constraint definition
TABLE_NAME
Name associated with table with constraint definition
COLUMN_NAME
Name associated with column or attribute of object column specified in the constraint definition
POSITION
Original position of column or attribute in definition
Also try this, DBMS_METADATA
set long 9999
select dbms_metadata.get_ddl('TABLE','ABC') FROM DUAL;
Edited by: rajeysh on Jun 21, 2011 2:44 AM
Edited by: rajeysh on Jun 21, 2011 2:44 AM
Maybe you are looking for
-
Unable to capture field values in Master agreement Line Items
I am trying to get the field values from master agreement line items page. I have written the following code to get the line item details which is working fine to capture part number and quantity-> agreementBean = doc.getRootParentIBean(); lineItemCo
-
Connection issue on 32 bit Linux OBIEE with Postgres and Mysql
I am having trouble running reports on 32 bit Linux OBIEE version 10.1.3.4.0 and 10.1.3.4.1 with Postgres or Mysql as data source . I can connect to same data source (postgres and Mysql) from presentation services on windows box and also run queries
-
Hi, I have a curve 9300, and I can't set up my YMAIL account. It is a Yahoo mail account, but it seems different from the normal yahoo account. I tried with the yahoo account ([email protected]) it was easy, but with the ymail account I can't do this
-
RHINTE30 Merging identical IT0001 records
Hi Experts, We have RHINTE30 scheduled in the system and we are getting concern on RHINTE30 behavior of merging identical IT0001 records. As by merging, we are loosing history of changes. Is there a way we can use this report to removing the inconsis
-
Cairngorm value object doesn't match cfc object?
I have built a cfc vo class and flex vo class PersonVO.as package com.abc.CESF.Bursary.vo import com.adobe.cairngorm.vo.IValueObject; [RemoteClass(alias="Bursary.cfcs.PersonVO")] public class PersonVO implements IValueObject public var firstname:Stri