Inserting random values on a table

This query creates a table in tablespace admin_tbs, modify this tablespace as you need:
CREATE TABLE random_data (
  id           NUMBER,
  small_number NUMBER(5),
  big_number   NUMBER,
  short_string VARCHAR2(50),
  long_string  VARCHAR2(400),
  created_date DATE,
  CONSTRAINT random_data_pk PRIMARY KEY (id)
) TABLESPACE admin_tbs;
and this one insert random data in the table named random_data created in the previous step:
INSERT /*+ APPEND */ INTO random_data
SELECT level AS id,
       TRUNC(DBMS_RANDOM.value(1,5)) AS small_number,
       TRUNC(DBMS_RANDOM.value(100,10000)) AS big_number,
       DBMS_RANDOM.string('L',TRUNC(DBMS_RANDOM.value(10,50))) AS short_string,
       DBMS_RANDOM.string('L',TRUNC(DBMS_RANDOM.value(100,400))) AS long_string,
       TRUNC(SYSDATE + DBMS_RANDOM.value(0,366)) AS created_date
FROM   dual
CONNECT BY level <= 500000;
COMMIT;
finally, use WRH$_FILESTATXS or DBA_HIST_FILESTATXS to get reports about disks performance and wait times. WRH$_FILESTATXS Contains database statistics during 24 horus every 5 seconds DBA_HIST_FILESTATXS Contains database statistics during 24 horus every hour

Comments

Popular posts from this blog

Oracle Historical Session Information with ASH >10g

Purging and archiving Oracle alert.log and listener.log

Check sessions and processes limits in Oracle