-- We recently upgraded our database from 8i to 9i (yeah, yeah... we 
-- have fallen behind the times!)

-- The product_user_profile table did not get transfered over. To rebuild 
-- it, I just created the following query, which in turn created all of 
-- the insert statements to rebuild that table as it was!

select 'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''ALTER'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)||
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''AUDIT'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''CONNECT'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''CREATE'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''DELETE'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''DROP'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''GRANT'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''HOST'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''INSERT'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''LOCK'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''NOAUDIT'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''RENAME'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''REVOKE'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''TRUNCATE'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''UPDATE'',NULL,NULL,''DISABLED'',NULL,NULL);'||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''VALIDATE'',NULL,NULL,''DISABLED'',NULL,NULL);' ||chr(10)||
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''COMMIT'',NULL,NULL,''DISABLED'',NULL,NULL);' ||chr(10)|| 
       'INSERT INTO PRODUCT_USER_PROFILE VALUES (''SQL*Plus'',UPPER('''||username||'''),''ROLLBACK'',NULL,NULL,''DISABLED'',NULL,NULL);' ||chr(10)||
       'commit;'   	    	   	   	   	   	   	   	   	   	   	   	   
from dba_users where username like 'OPS$%' and username not in ('OPS$NOT','OPS$REAL','OPS$NAMES') ;