daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4.  
  5.  
  6. /*UTL FILE ukoly*/
  7.  
  8. create user utluser identified by utluser quota 100M on users
  9. create role adbs;
  10. grant resource,connect to adbs;
  11.  
  12. create directory INPUT as 'C:\app\utladdr' /*vytvri adresar*/
  13.  
  14. CREATE OR REPLACE PROCEDURE printutlfile(p_fName VARCHAR2) IS
  15.  f utl_file.file_type;
  16.  line VARCHAR2( 1024 );
  17. BEGIN
  18.   f := utl_file.fopen( 'INPUT' , p_fName , 'r' );
  19.   LOOP
  20.     UTL_FILE.GET_LINE( f , line );
  21.     dbms_output.put_line ( 'create user ' || line || ' identified by changeme quota 100m on users' );
  22.     execute immediate 'create user ' || line || ' identified by changeme quota 100m on users';
  23.   END LOOP;
  24. EXCEPTION
  25. WHEN NO_DATA_FOUND THEN UTL_FILE .FCLOSE( f );
  26. END;
  27.  
  28. set serveroutput on; /*presmerovani vystupu do okna*/
  29.  
  30. execute printutlfile('test.txt');
  31.  
  32. select * from dba_users where username = 'test1';
  33.  
  34. select * from dba_users;
  35.  
  36.  
  37.  
  38. /*FAST_START_MTTR_TARGET - udava dobu zotaveni - nastavuje dobu mezi kontrolními body*/
  39. alter system set FAST_START_MTTR_TARGET = 120 scope = both;
  40.  
  41. select * from v$instance_recovery
  42.  
  43.  
  44. select * from V$LOG
  45.  
  46. /*ARCHIVACE REDO LOG SOUBORU */
  47. select log_mode from V$DATABASE
  48.  
  49. /* musi byt v mounted rezimu (shutdown immediate) + (startup mount)*/
  50. ALTER DATABASE ARCHIVELOG;
  51.  
  52.  
  53. /*flesh recovery */
  54. alter system set db_recovery_file_dest_size = 2000m scope = both
  55. alter system set db_recovery_file_dest = 'C:\app' scope = both
  56.  
  57.  
  58.  
  59. /*simulace blokovani*/
  60.  
  61. create user s1 identified by s1 quota 100M on users;
  62. grant resource,connect to s1;
  63. create user s2 identified by s2 quota 100M on users;
  64. grant resource,connect to s2;
  65.  
  66.  
  67. grant update,select on blocktable to s2;
  68.  
  69.  
  70.  
  71. select blocking session, sid, serial#, wait class,
  72. seconds in wait from v$session where blocking session is not NULL;
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. create table stored_times (datetime date);
  80.  
  81. begin
  82. dbms_scheduler.create_job (
  83. job_name => 'timejob' ,
  84. job_type => 'plsql_block' ,
  85. job_action => 'insert into stored_times
  86. values ( sysdate ) ' ,
  87. start_date => sysdate ,
  88. repeat_interval => 'freq=MINUTELY; interval=1' ,
  89. enabled => true ,
  90. auto_drop => false ) ;
  91. end;
  92.  
  93. begin
  94. dbms_scheduler.drop_job (job_name => 'timejob');
  95. end;
  96.  
  97. select * from stored_times;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top