SHARE
TWEET

evfqev2eqv2eq

a guest Jan 26th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create user tablas_se identified by tablas_se
  2. default tablespace users
  3. temporary tablespace temp
  4. quota unlimited on users;
  5.  
  6. create user tablas_sm identified by tablas_sm
  7. default tablespace users
  8. temporary tablespace temp
  9. quota unlimited on users;
  10.  
  11. grant create session, create table to tablas_sm;
  12. grant create session, create table to tablas_se;
  13.  
  14. -------------------------------------------------
  15.  
  16. New connection
  17. Name: Conexion SC
  18. User: tablas_sc
  19. Pass: tablas_sc
  20. Connection type: TNS
  21. Network Alias: BD04/Test
  22.  
  23. (hacer lo mismo con sm y se)
  24. -------------------------------------------------
  25.  
  26. ** alterar pass
  27. alter user tablas_se by tablas_se
  28.  
  29. -------------------------------------------------
  30. ** DESDE TABLAS_SC **
  31.  
  32. create table Facultades(
  33. IdFacultad number constraint pk_Facultades primary key,
  34. NombreFacultad varchar2(30),
  35. Edificio varchar2(3));
  36.  
  37. ** Para revisar si existe, desde system
  38. select owner, object_name, object_type
  39. from dba_objects
  40. where owner like 'TABLAS%';
  41. **
  42.  
  43. Create table Carreras(
  44. IdCarrera number constraint pk_Carreras primary key,
  45. NombreCarrera varchar2(30),
  46. Facultad constraint fk1_Carreras references Facultades);
  47.  
  48. grant references on carreras to tablas_se;
  49.  
  50. Create table CursosC(
  51. Carrera constraint fk1_CursosC references Carreras,
  52. IdCurso number,
  53. NombreCurso varchar2(30),
  54. Creditos number,
  55. constraint pk_CursosC primary key(Carrera, IdCurso));
  56.  
  57. grant references on cursosc to tablas_sm;
  58.  
  59. select object_name, object_type
  60. from user_objects;
  61.  
  62. ** DESDE TABLAS_SE **
  63.  
  64. create table estudiantes(
  65. Carnet number constraint pk_estudiantes primary key,
  66. NombreEstudiante varchar2(30),
  67. Sexo varchar2(1),
  68. Telefono varchar2(7),
  69. Provincia varchar2(30));
  70.  
  71. grant references on estudiantes to tablas_sm;
  72.  
  73. Create table asociado(
  74. Carrera constraint fk1_Asociado references tablas_sc.Carreras,
  75. Estudiante constraint fk2_Asociado references Estudiantes,
  76. Desde date,
  77. Hasta date,
  78. constraint pk_asociado primary key (Carrera, Estudiante));
  79.  
  80.  
  81. ** DESDE SYSTEM **
  82. from dba_tab_privs
  83. where grantee like 'TABLAS%' or grantor like 'TABLAS%';
  84.  
  85. ** DESDE TABLAS_SM **
  86.  
  87. Create table Grupos(
  88. Carrera number,
  89. Curso number,
  90. NumeroGrupo number,
  91. Cuatrimestre varchar2(30),
  92. Aula varchar2(4),
  93. Horario varchar2(10),
  94. Capacidad number,
  95. constraint fk1_Grupos foreign key(Carrera,Curso) references tablas_sc.CursosC,
  96. constraint pk_Grupos primary key(Carrera,Curso,NumeroGrupo,Cuatrimestre));
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