Quantcast
Channel: SCN : All Content - SAP on Oracle
Viewing all articles
Browse latest Browse all 2104

Handy Oracle SQL commands

$
0
0

Here i am sharing  some Oracle SQL commands which are very useful many times.

 

1.Count no. of records in a table

     select count(*) from sapsr3.vbfs;

 

 

2. Count no. of sessions in db

SELECT inst_id, count(*) "DB Sessions" FROM gv$session  WHERE type = 'USER' GROUP BY inst_id;

 

 

3.Check status of file in recovery

  select FILE#,STATUS from v$datafile where status like '%REC%';

 

 

4. Check status of file in Offilne state

  select FILE#,STATUS from v$datafile where STATUS like 'OFFLINE';

 

 

5. Rebuild index online

  alter index "SAPSR3"."RSSTATMANREQMAP~PT" rebuild online;

 

 

6.Check last optimizer statiscs run

  select TABLE_NAME, STATUS, LAST_ANALYZED from DBA_TABLES where TABLE_NAME='VBFS';

 

 

7. Determine file name from file id.

  select FILE_NAME from dba_data_files where FILE_ID in (56,59,60,61,62,63,65,66,67,68);


Viewing all articles
Browse latest Browse all 2104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>