Oracle ejemplo de comandos para practica 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. AllRights 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 JOB MGR HIREDATE SAL COMM DEPTNO ---------------------------------------------------------------------------------------------------7369 SMITH CLERK 7902 17/12/80 800 20 7566 JONESMANAGER 7839 02/04/81 2975 20 7698 BLAKE MANAGER 7839 01/05/81 2850 30 7782 CLARK MANAGER 7839 09/06/81 2450 10 7788 SCOTT ANALYST 7566 19/04/87 6500 20 7839 KING PRESIDENT 17/11/81 5000 10 7876 ADAMS CLERK 7788 23/05/87 1290 20 7902 FORD ANALYST 7566 03/12/81 6500 20 7934 MILLER CLERK 7782 23/01/82 1300 10 9 filas seleccionadas.
© Francisco Fernández Martínez y Juan Luis Serradilla Amarilla1
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 alter table emp_duplicada enable row movement; Tabla modificada. SQL> update emp_duplicada set sal=sal*1.5 where sal select empno,ename, sal from emp_duplicada where sal flashback tableemp_duplicada to timestamp (systimestamp - interval '5' minute); Flashback terminado. SQL> select empno,ename, sal from emp_duplicada where sal 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 USERS2006-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%';...
Regístrate para leer el documento completo.