sisandes.files.wordpress.com  · web viewde esta forma para conectarse a la base de datos (con las...

21
PRACTICA1 COMO CREAR UN ALIAS? Hacemos click en todos los programas,selecciona oracle para windows N, SQL Net Easy Configuration. seleccione Add Database Alias como se muestra en la imagen y de click en okey. Escriba un alias en el campo de la base de datos alias y presione okey Seleccione el protocolo de trabajo

Upload: others

Post on 24-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

PRACTICA1

COMO CREAR UN ALIAS?

Hacemos click en todos los programas,selecciona oracle para windows N, SQL Net Easy Configuration.

seleccione Add Database Alias como se muestra en la imagen  y de click en okey.

Escriba un alias en el campo de la base de datos alias y presione okey

Seleccione el protocolo de trabajo

Page 2: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

coloque la ip del host  y el nombre de la instancia de la base de datos

Confirmará la creación del alias

COMO CONECTARSE A ORACLE  DESDE SQL PLUS

De esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado, el password y en la cadena de conexión pones el alias creado (en este ejemplo, clioracle). Por ejemplo, si utilizamos la versión de SQL Plus que viene con developer y que podrás encontrar el grupo de programas Oracle para Windows NT-developer tendrás que poner dicha cadena de conexión, por ejemplo:

Page 3: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

CREATE TABLESPACE "TBLSEPTIMO"

LOGGING

DATAFILE 'C:\ORA9I\ORADB\ORADATA\ORACLE\TBLSEPTIMO.ora' SIZE

10M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

crear un usuario

CREATE USER "HEMARTINEZ" PROFILE "DEFAULT"

IDENTIFIED BY "123456" DEFAULT TABLESPACE "TBLSEPTIMO"

TEMPORARY TABLESPACE "TEMP"

ACCOUNT UNLOCK;

GRANT "CONNECT" TO "HEMARTINEZ";

conseder roles a un usuario desarrolador

GRANT "RESOURCE" TO "HEMARTINEZ";

ALTER USER "HEMARTINEZ" DEFAULT ROLE ALL

CREAR TABLA CON CLVE PRIMARIA EN ORACOL

Page 4: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

CREATE TABLE "HEMARTINEZ"."ALUMNO" ("COD_ALUMNO" NUMBER(5) NOT

NULL, "NOM_ALUMNO" VARCHAR2(50) NOT NULL, "DIR_ALUMNO"

VARCHAR2(50) NOT NULL, "TEL_ALUMNO" VARCHAR2(10) NOT NULL,

"REP_ALUMNO" VARCHAR2(50) NOT NULL,

CONSTRAINT "PK_ALUMNOS" PRIMARY KEY("COD_ALUMNO"))

TABLESPACE "TBLSEPTIMO"

CREATE TABLE "HEMARTINEZ"."MATERIAS" ("COD_MATERIA" NUMBER(5) NOT

NULL, "NOM_MATERIA" VARCHAR2(20) NOT NULL, "PENSUM"

VARCHAR2(30) NOT NULL, "NUM_CREDITOS" VARCHAR2(10) NOT NULL,

CONSTRAINT "PK_MATERIAS" PRIMARY KEY("COD_MATERIA"))

TABLESPACE "TBLSEPTIMO"

CREATE TABLE "HEMARTINEZ"."NOTAS" ("NOTA1" VARCHAR2(2) NOT NULL,

"NOTA2" VARCHAR2(2) NOT NULL, "NOTA3" VARCHAR2(2) NOT NULL,

"COD_ALUMNO" NUMBER(5) NOT NULL, "COD_MATERIA" NUMBER(5) NOT

NULL, "COD_NOTAS" NUMBER(5) NOT NULL,

CONSTRAINT "PK_NOTAS" PRIMARY KEY("COD_NOTAS"))

TABLESPACE "TBLSEPTIMO"

ALTERAR TABLA

ALTER TABLE "HEMARTINEZ"."NOTAS"

ADD (CONSTRAINT "FK_NOTASMATERIAS" FOREIGN KEY("COD_MATERIA")

REFERENCES "HEMARTINEZ"."MATERIAS"("COD_MATERIA"))

ALTER TABLE "HEMARTINEZ"."NOTAS"

ADD (CONSTRAINT "FK_NOTASALUMNOS" FOREIGN KEY()

REFERENCES "HEMARTINEZ"."ALUMNO"())

Page 5: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'NOTAS' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT username FROM sys.dba_users ORDER BY username

SELECT table_name FROM sys.dba_all_tables WHERE owner LIKE ('HEMARTINEZ') AND nested <> 'YES' ORDER

BY table_name

SELECT column_name FROM sys.dba_tab_columns WHERE owner LIKE ('HEMARTINEZ') AND table_name like

('MATERIAS') ORDER BY column_name

ALTER TABLE "HEMARTINEZ"."NOTAS" ADD (CONSTRAINT "FK_NOTASMATERIAS" FOREIGN KEY("COD_MATERIA")

REFERENCES "HEMARTINEZ"."MATERIAS"("COD_MATERIA"))

SELECT table_name, iot_type FROM sys.dba_all_tables WHERE owner = ? and nested <> 'YES' AND

(iot_type is null or iot_type = 'IOT') ORDER BY 1

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS' and index_type = 'IOT - TOP'

Page 6: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'NOTAS' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'NOTAS' AND c.char_length > 0 ORDER BY column_id

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'NOTAS' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

Page 7: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT table_name FROM sys.dba_constraints WHERE owner = 'HEMARTINEZ' AND constraint_name =

'PK_MATERIAS'

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'NOTAS' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'NOTAS' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT tablespace_name FROM sys.dba_tablespaces ORDER BY tablespace_name

SELECT DISTINCT u.name FROM sys.obj$ o, sys.user$ u WHERE o.owner# = u.user#

SELECT table_name, iot_type FROM sys.dba_all_tables WHERE owner = ? and nested <> 'YES' AND

(iot_type is null or iot_type = 'IOT') ORDER BY 1

ALTER TABLE "HEMARTINEZ"."NOTAS" ADD (CONSTRAINT "NOTAS_UK71277588992687" UNIQUE())

SELECT table_name FROM sys.dba_all_tables WHERE owner LIKE ('') AND nested <> 'YES' ORDER BY

table_name

SELECT table_name FROM sys.dba_all_tables WHERE owner LIKE ('HEMARTINEZ') AND nested <> 'YES' ORDER

BY table_name

SELECT column_name FROM sys.dba_tab_columns WHERE owner LIKE ('HEMARTINEZ') AND table_name like

('ALUMNO') ORDER BY column_name

Page 8: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

ALTER TABLE "HEMARTINEZ"."NOTAS" ADD (CONSTRAINT "FK_NOTASALUMNOS" FOREIGN KEY("COD_ALUMNO")

REFERENCES "HEMARTINEZ"."ALUMNO"("COD_ALUMNO"))

SELECT table_name, iot_type FROM sys.dba_all_tables WHERE owner = ? and nested <> 'YES' AND

(iot_type is null or iot_type = 'IOT') ORDER BY 1

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS' and index_type = 'IOT - TOP'

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'NOTAS' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'NOTAS' AND c.char_length > 0 ORDER BY column_id

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

Page 9: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'NOTAS' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

SELECT table_name FROM sys.dba_constraints WHERE owner = 'HEMARTINEZ' AND constraint_name =

'PK_ALUMNOS'

SELECT table_name FROM sys.dba_constraints WHERE owner = 'HEMARTINEZ' AND constraint_name =

'PK_MATERIAS'

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'NOTAS' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'NOTAS' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

Page 10: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT tablespace_name FROM sys.dba_tablespaces ORDER BY tablespace_name

SELECT * FROM user_role_privs WHERE granted_role='DBA' OR granted_role='ANALYZE ANY'

SELECT * FROM user_role_privs WHERE granted_role='DBA' OR granted_role='ANALYZE ANY'

SELECT initial_extent/1024, next_extent/1024, pct_increase, min_extents, max_extents, pct_free,

pct_used, ini_trans, max_trans, NULL, NULL, logging , cache, degree, degree, monitoring,

buffer_pool FROM sys.dba_tables WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS' AND table_name =

'NOTAS'

SELECT decode(freelists, 0, 1, null, -1, freelists), decode(freelist_groups, 0, 1, null, -1,

freelist_groups) FROM sys.dba_all_tables WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT object_name "Object", object_type "Object Type" FROM sys.dba_objects WHERE owner =

'HEMARTINEZ' and (object_type not like '%JAVA%' AND object_type not in('DATABASE LINK',

'SYNONYM')) UNION SELECT NVL(l.longname, s.object_name) "Object", s.object_type "Object Type "

FROM sys.dba_objects s, javasnm l WHERE s.object_name = l.short(+) and s.owner = 'HEMARTINEZ' and

(s.object_type like '%JAVA%' OR s.object_type = 'SYNONYM') ORDER BY 1, 2

SELECT decode(iot_type,'IOT','Yes','No') " ", table_name "Table", tablespace_name "Tablespace",

NLS_INITCAP(partitioned) "Partitioned", num_rows "Rows", last_analyzed "Last Analyzed" FROM

sys.dba_all_tables WHERE owner = 'HEMARTINEZ' AND nested <> 'YES' AND (iot_type is null or iot_type

= 'IOT') ORDER BY 2

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

Page 11: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'ALUMNO' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO' and index_type = 'IOT - TOP'

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'ALUMNO' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'ALUMNO' AND c.char_length > 0 ORDER BY column_id

SELECT username FROM sys.dba_users ORDER BY username

SELECT tablespace_name FROM sys.dba_tablespaces ORDER BY tablespace_name

SELECT value FROM v$parameter WHERE name = 'nls_length_semantics'

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

Page 12: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'ALUMNO' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'ALUMNO' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'ALUMNO' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'MATERIAS'

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'MATERIAS'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'MATERIAS' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'MATERIAS' and index_type = 'IOT - TOP'

Page 13: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'MATERIAS' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'MATERIAS'

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'MATERIAS' AND c.char_length > 0 ORDER BY column_id

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'MATERIAS' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

Page 14: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'MATERIAS' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'MATERIAS'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'MATERIAS' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'NOTAS' and index_type = 'IOT - TOP'

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'NOTAS' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'NOTAS'

Page 15: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'NOTAS' AND c.char_length > 0 ORDER BY column_id

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'NOTAS' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

SELECT table_name FROM sys.dba_constraints WHERE owner = 'HEMARTINEZ' AND constraint_name =

'PK_ALUMNOS'

SELECT table_name FROM sys.dba_constraints WHERE owner = 'HEMARTINEZ' AND constraint_name =

'PK_MATERIAS'

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'NOTAS' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'NOTAS'

Page 16: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'NOTAS' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT count FROM sys.dba_unused_col_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT * FROM sys.dba_partial_drop_tabs WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT tablespace_name, cache, iot_type, cluster_name, partitioned FROM sys.dba_tables WHERE owner =

'HEMARTINEZ' AND table_name = 'ALUMNO' UNION SELECT tablespace_name, null, 'IOT', null, null FROM

sys.dba_indexes WHERE owner = 'HEMARTINEZ' AND table_name = 'ALUMNO' and index_type = 'IOT - TOP'

SELECT c.column_name, c.data_type, c.data_length, nvl(c.data_precision, -1), nvl(c.data_scale, -1),

c.nullable, c.data_default, m.comments, c.column_id, c.data_type_owner, c.data_type_mod FROM

sys.dba_tab_columns c, sys.dba_col_comments m WHERE c.owner = 'HEMARTINEZ' AND c.table_name =

'ALUMNO' AND c.owner = m.owner AND c.table_name = m.table_name AND c.column_name = m.column_name

ORDER BY column_id

SELECT is_scoped, scope_table_owner, scope_table_name, column_name FROM sys.dba_refs WHERE owner =

'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT c.column_id, c.char_used, c.char_length FROM sys.dba_tab_columns c WHERE c.owner =

'HEMARTINEZ' AND c.table_name = 'ALUMNO' AND c.char_length > 0 ORDER BY column_id

select oc.name, decode(c.type#, 1, 'C', 2, 'P', 3, 'U', 4, 'R', 5, 'V', 6,

'O', 7,'C', '?'), c.condition, ru.name, rc.name, decode(c.type#, 4,

Page 17: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL), decode(c.type#, 5,

'ENABLED', decode(c.enabled, NULL, 'DISABLED', 'ENABLED')), decode(bitand(c.defer, 1), 1,

'DEFERRABLE', 'NOT DEFERRABLE'), decode(bitand(c.defer, 2), 2, 'DEFERRED', 'IMMEDIATE'),

decode(bitand(c.defer, 4), 4, 'VALIDATED', 'NOT VALIDATED'), decode(bitand(c.defer, 32),

32, 'RELY', 'NORELY') from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru, sys.obj$ o,

sys.cdef$ c where oc.owner# = ou.user# and ou.name = 'HEMARTINEZ' and oc.con# = c.con# and c.obj# =

o.obj# and o.name = 'ALUMNO' and c.type# != 8 and c.type# != 7 and c.rcon# = rc.con#(+) and

rc.owner# = ru.user#(+) order by oc.name

SELECT constraint_name, count(*) FROM sys.dba_cons_columns WHERE position is not NULL AND owner =

'HEMARTINEZ' AND table_name = 'ALUMNO' group by constraint_name

SELECT column_name, constraint_name, position FROM sys.dba_cons_columns WHERE position is not null

AND owner = 'HEMARTINEZ' AND table_name = 'ALUMNO'

SELECT c.constraint_name, r.column_name, r.position FROM sys.dba_constraints c, sys.dba_cons_columns

r WHERE c.owner = 'HEMARTINEZ' AND c.table_name = 'ALUMNO' and c.constraint_type = 'R' and

r.constraint_name = c.r_constraint_name and r.owner = c.r_owner

SELECT column_name, data_type, data_default FROM sys.dba_tab_columns WHERE owner = 'HEMARTINEZ' AND

table_name = 'ALUMNO' ORDER BY column_id

SELECT num_rows from sys.dba_all_tables where owner = 'HEMARTINEZ' and table_name = 'ALUMNO'

SELECT count(*) from "HEMARTINEZ"."ALUMNO" where rownum < 2002

Page 18: sisandes.files.wordpress.com  · Web viewDe esta forma para conectarse a la base de datos (con las distintas herramientas de Developer), te hará falta el usuario que has creado,

select "HEMARTINEZ"."ALUMNO"."COD_ALUMNO", "HEMARTINEZ"."ALUMNO"."NOM_ALUMNO",

"HEMARTINEZ"."ALUMNO"."DIR_ALUMNO", "HEMARTINEZ"."ALUMNO"."TEL_ALUMNO",

"HEMARTINEZ"."ALUMNO"."REP_ALUMNO" , rowid,0 from "HEMARTINEZ"."ALUMNO"

INSERT INTO "HEMARTINEZ"."ALUMNO" ("COD_ALUMNO" ,"NOM_ALUMNO" ,"DIR_ALUMNO" ,"TEL_ALUMNO" ,

"REP_ALUMNO" ) VALUES (2 ,'CARMEN' ,'LOS CEIVOS' ,'888' ,'JUAN' )

COMMIT

INSERT INTO "HEMARTINEZ"."ALUMNO" ("COD_ALUMNO" ,"NOM_ALUMNO" ,"DIR_ALUMNO" ,"TEL_ALUMNO" ,

"REP_ALUMNO" ) VALUES (3 ,'GANDY' ,'VERACRUZ' ,'999' ,'MARIA' )

COMMIT

select "HEMARTINEZ"."ALUMNO"."COD_ALUMNO", "HEMARTINEZ"."ALUMNO"."NOM_ALUMNO",

"HEMARTINEZ"."ALUMNO"."DIR_ALUMNO", "HEMARTINEZ"."ALUMNO"."TEL_ALUMNO",

"HEMARTINEZ"."ALUMNO"."REP_ALUMNO" , rowid,0 from "HEMARTINEZ"."ALUMNO"