login as: root
root@10.0.0.1's password:
Last login: Sat Oct 1 10:43:10 2016 from 10.0.0.101
[root@lab1 ~]# su - oracle
[oracle@lab1 ~]$ . oraenv
ORACLE_SID = [oracle] ? lab1
The Oracle base remains unchanged with value /opt/oracle/app
[oracle@lab1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Oct 1 11:49:24 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect hr/hr
Connected.
SQL> select * from cat;
TABLE_NAME TABLE_TYPE
------------------------------ -----------
BASURA TABLE
COUNTRIES TABLE
DEPARTMENTS TABLE
DEPARTMENTS_SEQ SEQUENCE
EMPLEADOS TABLE
EMPLOYEES TABLE
EMPLOYEES_SEQ SEQUENCE
EMP_DETAILS_VIEW VIEW
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
TABLE_NAME TABLE_TYPE
------------------------------ -----------
LOCATIONS_SEQ SEQUENCE
REGIONS TABLE
T TABLE
14 rows selected.
SQL> select sysdate from dual;
SYSDATE
---------
01-OCT-16
SQL> select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2016-10-01 11:55:07
SQL> select count(*) from basura;
COUNT(*)
----------
19
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 20080 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000
AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20080
SA_REP Sales Representative 6000 12008
PU_MAN Purchasing Manager 8000 15000
PU_CLERK Purchasing Clerk 2500 5500
ST_MAN Stock Manager 5500 8500
ST_CLERK Stock Clerk 2008 5000
SH_CLERK Shipping Clerk 2500 5500
IT_PROG Programmer 4000 10000
MK_MAN Marketing Manager 9000 15000
MK_REP Marketing Representative 4000 9000
HR_REP Human Resources Representative 4000 9000
PR_REP Public Relations Representative 4500 10500
19 rows selected.
ERROR ORA-667 --- Number of the Beast more one
SQL> update basura
2 set min_salary=0;
19 rows updated.
SQL> commit;
Commit complete.
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 0 40000
AD_VP Administration Vice President 0 30000
AD_ASST Administration Assistant 0 6000
FI_MGR Finance Manager 0 16000
FI_ACCOUNT Accountant 0 9000
AC_MGR Accounting Manager 0 16000
AC_ACCOUNT Public Accountant 0 9000
SA_MAN Sales Manager 0 20080
SA_REP Sales Representative 0 12008
PU_MAN Purchasing Manager 0 15000
PU_CLERK Purchasing Clerk 0 5500
ST_MAN Stock Manager 0 8500
ST_CLERK Stock Clerk 0 5000
SH_CLERK Shipping Clerk 0 5500
IT_PROG Programmer 0 10000
MK_MAN Marketing Manager 0 15000
MK_REP Marketing Representative 0 9000
HR_REP Human Resources Representative 0 9000
PR_REP Public Relations Representative 0 10500
19 rows selected.
SQL> FLASHBACK TABLE basura TO TIMESTAMP
2 TO_TIMESTAMP('2016-10-01 11:55:07','YYYY-MM-DD HH24:MI:SS');
FLASHBACK TABLE basura TO TIMESTAMP
*
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled
SQL> alter table basura enable row movement;
Table altered.
Solution to problem
SQL> FLASHBACK TABLE basura TO TIMESTAMP
2 TO_TIMESTAMP('2016-10-01 11:55:07','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 20080 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000
AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20080
SA_REP Sales Representative 6000 12008
PU_MAN Purchasing Manager 8000 15000
PU_CLERK Purchasing Clerk 2500 5500
ST_MAN Stock Manager 5500 8500
ST_CLERK Stock Clerk 2008 5000
SH_CLERK Shipping Clerk 2500 5500
IT_PROG Programmer 4000 10000
MK_MAN Marketing Manager 9000 15000
MK_REP Marketing Representative 4000 9000
HR_REP Human Resources Representative 4000 9000
PR_REP Public Relations Representative 4500 10500
19 rows selected.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@lab1 ~]$
root@10.0.0.1's password:
Last login: Sat Oct 1 10:43:10 2016 from 10.0.0.101
[root@lab1 ~]# su - oracle
[oracle@lab1 ~]$ . oraenv
ORACLE_SID = [oracle] ? lab1
The Oracle base remains unchanged with value /opt/oracle/app
[oracle@lab1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Oct 1 11:49:24 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect hr/hr
Connected.
SQL> select * from cat;
TABLE_NAME TABLE_TYPE
------------------------------ -----------
BASURA TABLE
COUNTRIES TABLE
DEPARTMENTS TABLE
DEPARTMENTS_SEQ SEQUENCE
EMPLEADOS TABLE
EMPLOYEES TABLE
EMPLOYEES_SEQ SEQUENCE
EMP_DETAILS_VIEW VIEW
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
TABLE_NAME TABLE_TYPE
------------------------------ -----------
LOCATIONS_SEQ SEQUENCE
REGIONS TABLE
T TABLE
14 rows selected.
SQL> select sysdate from dual;
SYSDATE
---------
01-OCT-16
SQL> select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2016-10-01 11:55:07
SQL> select count(*) from basura;
COUNT(*)
----------
19
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 20080 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000
AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20080
SA_REP Sales Representative 6000 12008
PU_MAN Purchasing Manager 8000 15000
PU_CLERK Purchasing Clerk 2500 5500
ST_MAN Stock Manager 5500 8500
ST_CLERK Stock Clerk 2008 5000
SH_CLERK Shipping Clerk 2500 5500
IT_PROG Programmer 4000 10000
MK_MAN Marketing Manager 9000 15000
MK_REP Marketing Representative 4000 9000
HR_REP Human Resources Representative 4000 9000
PR_REP Public Relations Representative 4500 10500
19 rows selected.
ERROR ORA-667 --- Number of the Beast more one
SQL> update basura
2 set min_salary=0;
19 rows updated.
SQL> commit;
Commit complete.
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 0 40000
AD_VP Administration Vice President 0 30000
AD_ASST Administration Assistant 0 6000
FI_MGR Finance Manager 0 16000
FI_ACCOUNT Accountant 0 9000
AC_MGR Accounting Manager 0 16000
AC_ACCOUNT Public Accountant 0 9000
SA_MAN Sales Manager 0 20080
SA_REP Sales Representative 0 12008
PU_MAN Purchasing Manager 0 15000
PU_CLERK Purchasing Clerk 0 5500
ST_MAN Stock Manager 0 8500
ST_CLERK Stock Clerk 0 5000
SH_CLERK Shipping Clerk 0 5500
IT_PROG Programmer 0 10000
MK_MAN Marketing Manager 0 15000
MK_REP Marketing Representative 0 9000
HR_REP Human Resources Representative 0 9000
PR_REP Public Relations Representative 0 10500
19 rows selected.
SQL> FLASHBACK TABLE basura TO TIMESTAMP
2 TO_TIMESTAMP('2016-10-01 11:55:07','YYYY-MM-DD HH24:MI:SS');
FLASHBACK TABLE basura TO TIMESTAMP
*
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled
SQL> alter table basura enable row movement;
Table altered.
Solution to problem
SQL> FLASHBACK TABLE basura TO TIMESTAMP
2 TO_TIMESTAMP('2016-10-01 11:55:07','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select * from basura;
JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY
---------- ----------------------------------- ---------- ----------
AD_PRES President 20080 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000
AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20080
SA_REP Sales Representative 6000 12008
PU_MAN Purchasing Manager 8000 15000
PU_CLERK Purchasing Clerk 2500 5500
ST_MAN Stock Manager 5500 8500
ST_CLERK Stock Clerk 2008 5000
SH_CLERK Shipping Clerk 2500 5500
IT_PROG Programmer 4000 10000
MK_MAN Marketing Manager 9000 15000
MK_REP Marketing Representative 4000 9000
HR_REP Human Resources Representative 4000 9000
PR_REP Public Relations Representative 4500 10500
19 rows selected.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@lab1 ~]$
No hay comentarios:
Publicar un comentario
Te agradezco tus comentarios. Te esperamos de vuelta.