home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / db / rdbms71 / catsvrmg.sql < prev    next >
Text File  |  1994-08-07  |  4KB  |  94 lines

  1. rem 
  2. rem $Header: catsvrmg.sql 7010300.1 94/02/24 18:24:11 snataraj Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1991 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      catsvrmg.sql - Create the views and tables required for Server Manager
  7. Rem    DESCRIPTION
  8. Rem      
  9. Rem    RETURNS
  10. Rem 
  11. Rem    NOTES
  12. Rem      Connects as internal (no password)
  13. Rem    MODIFIED   (MM/DD/YY)
  14. Rem     msinykin   01/25/94 -  update version number 
  15. Rem     barthur    01/23/94 -  Remove the sm$security items we no longer need 
  16. Rem     barthur    01/11/94 -  Add DROP SYS.SM$ROLE_TREE
  17. Rem     barthur    12/30/93 -  Add new views and table for improvements to secu
  18. Rem     ameyer     10/28/93 -  Updated version number to match database (7.1.2)
  19. Rem     ameyer     10/21/93 -  Fixed sm$version.version_number to be VSNNUMBER.
  20. Rem                         -  Also removed old tables and @@catnosvm.sql
  21. Rem     ameyer     10/12/93 -  Added sm$version and comments. 
  22. Rem     durry      09/22/93 -  add public alias for v$sess_io 
  23. Rem     sstorkel   09/10/93 -  Remove connect command. 
  24. Rem     barthur    07/30/93 -  Change sm$ts view for the new tablespace select 
  25. Rem     msinykin   06/21/93 -  Clean up views. 
  26. Rem     barthur    05/07/93 -  Creation 
  27.  
  28. REM List of Server Manager Tables and views
  29. REM These need to be created by SYS when Server Manager is installed.
  30. REM
  31. REM This script needs to be run as INTERNAL or SYS
  32. REM
  33.  
  34. REM For debugging
  35. REM set echo ON
  36.  
  37. REM You *must* be connected as SYS or INTERNAL for this script to
  38. REM work correctly.
  39.  
  40. REM sm$version
  41. REM Version_number is conceptually VSNNUMBER(version_text).
  42. REM In the case of '7.1.2.0.0', it's hex 0x07102000
  43. REM converted to decimal 118497280.
  44. create or replace view sys.sm_$version as
  45.     select '7.1.3.0.0' version_text, 118501376 version_number, created
  46.     from sys.dba_objects where owner = 'SYS' and object_name = 'SM_$VERSION';
  47. grant select on sys.sm_$version to public;
  48. drop public synonym sm$version;
  49. create public synonym sm$version for sys.sm_$version;
  50.  
  51. REM sm$ts_avail
  52. create or replace view sys.sm$ts_avail as
  53.     select tablespace_name, sum(bytes) bytes from dba_data_files
  54.     group by tablespace_name;
  55.  
  56. REM sm$ts_used
  57. create or replace view sys.sm$ts_used as
  58.     select tablespace_name, sum(bytes) bytes from dba_segments
  59.     group by tablespace_name;
  60.  
  61. REM sm$ts_free
  62. create or replace view sys.sm$ts_free as
  63.     select tablespace_name, sum(bytes) bytes from dba_free_space
  64.     group by tablespace_name;
  65.  
  66. REM sm$audit_config
  67. create or replace view sys.sm$audit_config
  68.     ( audit_type, schema_user, audit_target) as
  69.     select 'Object', owner, object_type || ' ' || object_name
  70.     from sys.dba_obj_audit_opts
  71.     where ALT != '-/-' OR AUD != '-/-' OR COM != '-/-' OR DEL != '-/-'
  72.        OR GRA != '-/-' OR IND != '-/-' OR INS != '-/-' OR LOC != '-/-'
  73.        OR REN != '-/-' OR SEL != '-/-' OR UPD != '-/-' OR REF != '-/-'
  74.        OR EXE != '-/-'
  75.     union all select 'Privilege', user_name, privilege
  76.     from sys.dba_priv_audit_opts
  77.     union all select 'Statement', user_name, audit_option
  78.     from sys.dba_stmt_audit_opts;
  79.  
  80. REM sm$integrity_cons
  81. create or replace view sys.sm$integrity_cons as
  82. select owner || '.' || table_name table_name, constraint_name,
  83.     decode(status, 'ENABLED', 'Y', NULL) enabled from sys.dba_constraints;
  84.  
  85. REM Now, make v$sess_io public.
  86. REM This is here as a workaround for bug #149629.  Basically, there is a bug
  87. REM in catalog.sql.  It fails to create the view and public synonym for
  88. REM v$sess_io.  This makes it impossible for regular DBA's to run monitors
  89. REM using this view.
  90. REM This should disappear at some point.
  91. create or replace view sys.v_$sess_io as select * from sys.v$sess_io;
  92. drop public synonym v$sess_io;
  93. create public synonym v$sess_io for sys.v_$sess_io;
  94.