Está en la página 1de 6

MUESTRA LOS BYTES DEL TABLESPACE SELECT BYTE FROM DBA_DATA_FILES; MUESTRA LOS TABLESPACE SELECT TABLESPACE_NAME FROM

USER_TABLESPACE; Examen 2 2.-create tablespace tbs1 de 10 mb con manejo de extend local, extend no automatico y que permita loggin CREATE SMALLFILE TABLESPACE "TBS1" DATAFILE '/u01/app/oracle/product/oradata/dba/tbs1' SIZE 10M LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO Desc dba_tablespace; select tablespace_name from user_tablespace; select tablespace_name bytes from dba_data_files;

crear un tablespace temporal temp1 de 10 mb 3.- crear un usuario tec1 con password tec 1 que tenga asignado como tablespace temporal a temp1 y

para trabajo a tbs1 create user tec1 identified by tec1 default tablespace tbs1 temporary tablespace temp1 account unlock;

4.- agregar a tbs1 un datafile de 10mb y al temp1 de 5 mb (hacer y mostrar via sql) SQL> alter tablespace tbs1 add datafile '/u01/app/oracle/product/oradata/dba/tbs2.dbf' size 10M; Tablespace altered. Desc dba_tablespace; select tablespace_name from user_tablespace; select tablespace_name bytes from dba_data_files; SQL> alter tablespace temp1 add tempfile '/u01/app/oracle/product/oradata/dba/temp2.dbf' size 5M; Tablespace altered. 5.- crear una secuencia s1 con valores resiclados de 1 hasta 1000 iniciando de 1 e incrementando en 1 SQL> grant create sequence to tec1; Grant succeeded. SQL> conn tec1/tec1 Connected. SQL> create sequence s1 start with 1 increment by 1 maxvalue 1000; cycle; Sequence created.

6.- crear tabla tabla1 con c1 varchar(5), c2(varchar(5), c3 int y llenar el tablespace al 50% SQL> conn tec1/tec1 Connected. SQL> create table tabla1 (c1 varchar2(5), c2 varchar2(5), c3i int); Table created. llenar la tabla SQL> insert into tabla1 values('Rocio','hola',s1.nextval); 1 row created. 7.- Crear un rol rol2 que solo pueda leer la tabla1 y modificar el campo c1 de la tabla1. Crear un usuario tec2 que tenga asignado el rol2 mostrar rol asignado y que permita hacerlo

Rocio hola Rocio hola Rocio hola Rocio hola Rocio hola Rocio hola

23 24 25 26 27 28

614400 rows selected. SQL> select * from tec1.tabla1 SQL> update tec1.tabla1 set c1='yo' where c3I=1; 8192 rows updated. esto no lo puede hacer SQL> drop table tec1.tabla1; drop table tec1.tabla1 * ERROR at line 1: ORA-01031: insufficient privileges 9.- con el usuario tec1, crear tabla temporal llamada temp_employees con todo el contenido de la tabla employees de hr. mostrar mapa de extents del tablespace correspondiente select * from hr.employees
CREATE GLOBAL TEMPORARY TABLE "TEC1"."TEMP_EMPLOYEES" ON COMMIT PRESERVE ROWS AS select * from hr.employees

También podría gustarte