PDF de programación - Practicas Tema10 - Copias de seguridad

Imágen de pdf Practicas Tema10 - Copias de seguridad

Practicas Tema10 - Copias de seguridadgráfica de visualizaciones

Actualizado el 21 de Marzo del 2018 (Publicado el 24 de Noviembre del 2017)
1.270 visualizaciones desde el 24 de Noviembre del 2017
233,7 KB
51 paginas
Creado hace 17a (03/12/2006)
Administración Básica de Oracle10g. Prácticas copias de seguridad.

PRACTICAS TEMA 10.

COPIAS DE SEGURIDAD.

1. Revisar la estructura de la base de datos. Comprobar si cumple con las

indicaciones OFA y ver el contenido de cada uno de los sistemas de ficheros.

Desde sistema operativo, mediante las sentencias "cd" y "ls -al"

2. Conectarse como usuario scott y crear un duplicado de la tabla “scott.emp”
dándole el nombre “emp_duplicada”. Consultar en la tabla “emp_duplicada”
los empleados con un salario inferior a 2500 euros e incrementar el sueldo un
50%; volver a seleccionar aquellos con un salario inferior a 2500 euros ¿ha
variado?. Recuperar la tabla a su estado inicial.

SQL*Plus: Release 10.2.0.2.0 - Production on Sun Oct 29 19:09:04 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.

Enter user-name: scott
Enter password:

Conectado a:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning and Data Mining options

SQL> select * from emp;

EMPNO ENAME
COMM DEPTNO
----------------------------------------------------------------------------------------------------

HIREDATE SAL

JOB

MGR

CLERK

SMITH
7902
7369
JONES MANAGER 7839
7566
BLAKE MANAGER 7839
7698
CLARK MANAGER 7839
7782
SCOTT ANALYST 7566
7788
KING PRESIDENT
7839
ADAMS CLERK
7788
7876
7902
FORD ANALYST 7566
7934 MILLER CLERK 7782

17/12/80 800
20
02/04/81 2975 20
01/05/81 2850 30
09/06/81 2450 10
19/04/87 6500 20
17/11/81 5000 10
23/05/87 1290 20
03/12/81 6500 20
23/01/82 1300 10

9 filas seleccionadas.

© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla

1

Administración Básica de Oracle10g. Prácticas copias de seguridad.

SQL> create table emp_duplicada as select * from emp;

Tabla creada.

SQL> select empno,ename, sal from emp_duplicada where sal<2500;

EMPNO ENAME SAL
--------------------------------------
7369 SMITH 800
7782 CLARK 2450
7876 ADAMS 1290
7934 MILLER 1300

SQL> alter table emp_duplicada enable row movement;

Tabla modificada.

SQL> update emp_duplicada set sal=sal*1.5 where sal<2500;

4 filas actualizadas.

SQL> select empno,ename, sal from emp_duplicada where sal<2500;

EMPNO ENAME SAL
--------------------------------------
7369 SMITH 1200
7876 ADAMS 1935
7934 MILLER 1950

SQL> flashback table emp_duplicada to timestamp (systimestamp - interval '5'

minute);

Flashback terminado.

SQL> select empno,ename, sal from emp_duplicada where sal<2500;

EMPNO ENAME SAL
--------------------------------------
7369 SMITH 800
7782 CLARK 2450
7876 ADAMS 1290
7934 MILLER 1300

3. Conectarse como usuario “scott” y eliminar la tabla”emp_duplicada”.
Comprobar el contenido de “recycle bin” haciendo uso de la vista

© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla

2

Administración Básica de Oracle10g. Prácticas copias de seguridad.

“user_recyclebin” y del sinónimo apropiado. Recuperar la tabla haciendo uso
de la utilidad “flashback” y comprobar de nuevo tras la recuperación el
contenido de “recycle bin”.

SQL> drop table emp_duplicada;

Tabla borrada.

SQL> select table_name, tablespace_name from user_tables where table_name like
'EMP%';

TABLE_NAME TABLESPACE_NAME
-------------------------------------------------------------
EMP

USERS

SQL> select * from recyclebin;

OBJECT_NAME ORIGINAL_NAME OPERATION
---------------------------------------------------------------------------------------
TYPE TS_NAME CREATETIME
---------------------------------------------------------------------------------------
DROPTIME DROPSCN PARTITION_NAME CAN CAN
---------------------------------------------------------------------------------------
RELATED BASE_OBJECT PURGE_OBJECT SPACE
---------------------------------------------------------------------------------------
BIN$IQtL04aCVkXgQDabvUJKEw==$0 EMP_DUPLICADA DROP
TABLE USERS 2006-10-29:19:11:51
2006-10-30:18:06:52 5344174 YES YES
20046 20046 20046 8

SQL> select * from user_recyclebin;

OBJECT_NAME ORIGINAL_NAME OPERATION
---------------------------------------------------------------------------------------
TYPE TS_NAME CREATETIME
---------------------------------------------------------------------------------------
DROPTIME DROPSCN PARTITION_NAME CAN CAN
---------------------------------------------------------------------------------------
RELATED BASE_OBJECT PURGE_OBJECT SPACE
---------------------------------------------------------------------------------------
BIN$IQtL04aCVkXgQDabvUJKEw==$0 EMP_DUPLICADA DROP
TABLE USERS 2006-10-29:19:11:51
2006-10-30:18:06:52 5344174 YES YES

© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla

3

Administración Básica de Oracle10g. Prácticas copias de seguridad.

20046 20046 20046 8

SQL> flashback table emp_duplicada to before drop;

Flashback terminado.

SQL> select table_name, tablespace_name from user_tables where table_name like
'EMP%';

TABLE_NAME TABLESPACE_NAME
-------------------------------------------------------------
EMP
USERS
EMP_DUPLICADA USERS

SQL> select * from recyclebin;

ninguna fila seleccionada

4. Conectarse como usuario “scott” y deshabilitar el “recycle bin”. Borrar la
tabla”emp_duplicada”. Comprobar el contenido de “recycle bin” e intentar
recuperar la tabla con “flashback”, ¿qué sucede?. ¿Cómo podría recuperarse la
tabla en este caso?.

SQL> select table_name, tablespace_name from user_tables where table_name like
'EMP%';

TABLE_NAME
----------------------------------------------------------
EMP
EMP_DUPLICADA

TABLESPACE_NAME

USERS
USERS

SQL> alter session set recyclebin=OFF;

Sesion modificada.

SQL> drop table emp_duplicada;

Tabla borrada.

SQL> select table_name, tablespace_name from user_tables where table_name like
'EMP%';

© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla

4

Administración Básica de Oracle10g. Prácticas copias de seguridad.

TABLE_NAME
----------------------------------------------------------
EMP

TABLESPACE_NAME

USERS

SQL> select * from recyclebin;

ninguna fila seleccionada

SQL> flashback table emp_duplicada to before drop;
flashback table emp_duplicada to before drop
*
ERROR en linea 1:
ORA-38305: el objeto no esta en la papelera de reciclaje

5. Conectado como usuario “scott”, habilitar el “recycle bin”. Crear una tabla
duplicada de “dept” llamada “dept_duplicada”. Eliminar la tabla y comprobar
el contenido de “recycle bin”. Borrar el “recycle bin” e intentar recuperar la
tabla con “flashback”, ¿qué sucede?.

SQL> alter session set recyclebin=ON;

Sesion modificada.

SQL> create table dept_duplicada as select * from dept;

Tabla creada.

SQL> select table_name, tablespace_name from user_tables where table_name like
'DEPT%';

TABLE_NAME
-----------------------------------------------------------
DEPT
DEPT_DUPLICADA

TABLESPACE_NAME

USERS
USERS

SQL> drop table dept_duplicada;

Tabla borrada.

SQL> select * from recyclebin;

OBJECT_NAME ORIGINAL_NAME OPERATION
---------------------------------------------------------------------------------------

© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla

5

Administración Básica de Oracle10g. Prácticas copias de seguridad.

TYPE TS_NAME CREATETIME
---------------------------------------------------------------------------------------
DROPTIME DROPSCN PARTITION_NAME CAN CAN
---------------------------------------------------------------------------------------
RELATED BASE_OBJECT PURGE_OBJECT SPACE
---------------------------------------------------------------------------------------
BIN$IQtL04aDVkXgQDabvUJKEw==$0 DEPT_DUPLICADA DROP
TABLE USERS 2006-10-30:18:30:49
2006-10-30:18:32:12 5345079 YES YES
20123 20123 20123 8

SQL> select * from "BIN$IQtL04aDVkXgQDabvUJKEw==$0";

DEPTNO DNAME LOC
---------------------------------------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

SQL> purge recyclebin;

Papelera de reciclaje depurada.

SQL> select * from recyclebin;

ninguna fila seleccionada

SQL> flashback table emp_duplicada to before drop;
flashback table emp_duplicada to before drop
*
ERROR en linea 1:
ORA-38305: el objeto no esta en la papelera de reciclaje

6. Crear y eliminar sucesivas versiones duplicadas de la tabla “dept” con el
nombre “dept_du
  • Links de descarga
http://lwp-l.com/pdf7681

Comentarios de: Practicas Tema10 - Copias de seguridad (0)


No hay comentarios
 

Comentar...

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad