IN ORACLE NOTE: Run the SQL Command Line as Administrator all the times.
1. CREATE PERFSTAT TABLE
CREATE TABLESPACE perfstat DATAFILE 'C:\oraclexe\oradata\XE\perfstat.dbf' SIZE 1000M REUSE EXTENT MANAGEMENT LOCAL UNIFORM SIZE 512K SEGMENT SPACE MANAGEMENT AUTO PERMANENT ONLINE;
2. RUN THE SPCREATE.SQL SCRIPT TO INSTALL STATSPACK
@C:\oraclexe\app\oracle\product\10.2.0\server\RDBMS\ADMIN\spcreate. sql This will ask for password for perfstat user, enter the password you want. Then it will ask for default tablespace to be assigned, enter perfstat (tablespace name created in the first step). Then, for temporary tablespace, enter the tablespace temp. If, your oracle is working correctly and all the above steps are performed properly, your user will be created with no errors.
3. LOGIN TO ORACLE AS PERFSTAT USER
CONNECT PERFSTAT/<YOUR-PASSWORD>
4. TAKE THE SNAPSHOT OF THE PRESENT STATE OF DATABASE
EXECUTE STATSPACK.SNAP; If the perfstat user is created perfectly with all the inbuilt installations and tables, then this inbuilt procedure will run successfully else it will throw an error that it is not defined.
5. PERFORM ANY TRANSACTION IN THE DATABASE
This step is done to change the state of the database so that we can again take a snapshot of the new state of database and generate a report for the condition of database between these two states. Example query: CREATE TABLE EMPLOYEE (NAME VARCHAR2(30)); INSERT INTO EMPLOYEE VALUES (PERFSTAT);
6. AGAIN TAKE THE SNAPSHOT OF THE SYSTEM
EXECUTE STATSPACK.SNAP;
7. NOW, FOR TE REPORT TO BE GENERATED YOU NEED THE SNAP
ID select name,snap_id,to_char(snap_time,'DD.MM.YYYY:HH24:MI:SS') "Date/Time" from stats$snapshot, v$database; This will return all the snapshots taken of your system with their name, snap_id and date/time. From this, you can note down the two most recent snap_id for your report generation. Take the first one as begin_snap_id and the recent one as end_snap_id.
8. RUN THE SCRIPT SPREPORT.SQL
@C:\oraclexe\app\oracle\product\10.2.0\server\RDBMS\ADMIN\spreport. sql This will first ask for begin_snap_id and then end_snap_id. Enter the values which were returned from the previous step. It will then ask for report name, enter any name you want. After the completion of this step successfully, your report will be generated in .lst format and you can view the report in /bin folder of your oracle. You can then study and analyse the report and study the state and working of the system. YOU CAN REFER THESE LINKS BELOW FOR MORE DETAILED ANALYSIS OF REPORT AND ALSO FOR THE STEPWISE EXECUTION OF STATSPACK