Here i am listing some SAP Oracle SQL commands which are very useful useful many occasions.

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 Offline 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 statistics 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);

Leave a Reply

Your email address will not be published. Required fields are marked *