Finding Total Table Count in a Schema in Oracle:
SELECT COUNT(*) Total_Tables FROM DBA_TABLES WHERE OWNER = 'EGRD_HC_2A';
Tables with Row Count:
1) SELECT TABLE_NAME, NUM_ROWS, TABLESPACE_NAME, AVG_ROW_LEN, COMPRESSION FROM DBA_TABLES WHERE OWNER = 'EGRD_HC_2A' ORDER BY NUM_ROWS desc;
2) SELECT TABLE_NAME, NUM_ROWS, TABLESPACE_NAME, AVG_ROW_LEN, COMPRESSION FROM USER_TABLES WHERE TABLESPACE_NAME IN('SYSTEM','EGRD_HC_2A') ORDER BY NUM_ROWS desc;
3)
DECLARE
val NUMBER;
BEGIN
FOR I IN (SELECT TABLE_NAME FROM USER_TABLES) LOOP
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || i.table_name INTO val;
DBMS_OUTPUT.PUT_LINE('Table: ' ||i.table_name || ', Rows: ' || val );
END LOOP;
END;
/
Monday, September 18, 2017
Row Count in Table wise in Oracle
Wednesday, September 6, 2017
Increase CPU by Java Example
Increase CPU Load by Java Example
1) Will take 25% CPU in Eclipse, Run 4 instances for 100% CPU.
package utility;
public class BumpCPU {
public static void main(String[] args) {
for(; ;) {
}
}
}
2) Keep all the Processors in System busy resulting 100% CPU Usage.
package utility;
//Will take 100% CPU, All Processors will be bombarded for creating threads and will be busy by JVM.
public class BurnCPU {
public static void main(String[] args) {
int count = Runtime.getRuntime().availableProcessors();
System.out.println("No of Processors: "+count);
for(int i = 0; i < count; i++) {
new Thread(new Runnable() {
public void run() {
while(true); //Thread keep running.
}
}).start();
}
}
}
------Run above programs and check "top" command output------
Subscribe to:
Posts (Atom)