Thursday, February 9, 2012

ora-rowscn


SQL> conn jay/jay
Connected.
SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID                              
------------------------------ ------- ----------                              
BIN$3BX6jD6dROOZDVFmnN79WA==$0 TABLE                                          
BIN$4dFJ4b3JRXebRIdKaJGUjA==$0 TABLE                                          
BIN$VAbDTC8USJOm0JszxYWXyg==$0 TABLE                                          
BIN$VzyQpdjoSvqiEJnnmak/tw==$0 TABLE                                          
BIN$WRS8/kFmT2O/ImZBQ+GfzA==$0 TABLE                                          
BIN$X8DwXG5IRUGgtzulRDOEww==$0 TABLE                                          
BIN$poNw54UFQWmtgBx06W00OQ==$0 TABLE                                          
DBMS_SPACE                     SYNONYM                                        
EMP                            TABLE                                          
HEAP_ADDRESSES                 TABLE                                          
IOT_ADDRESSES                  TABLE                                          

TNAME                          TABTYPE  CLUSTERID                              
------------------------------ ------- ----------                              
ROW_MOVEMENT_PART_TEST         TABLE                                          
SHOW_SPACE                     SYNONYM                                        
T                              TABLE                                          
TEST23                         TABLE                                          
TEST29                         TABLE                                          
TEST_ORA_SCN                   TABLE                                          

17 rows selected.

SQL> purge dba_recyclebin;
purge dba_recyclebin
*
ERROR at line 1:
ORA-01031: insufficient privileges


SQL> craete dept as select * from scott.dept;
SP2-0734: unknown command beginning "craete dep..." - rest of line ignored.
SQL> create dept as select * from scott.dept;
create dept as select * from scott.dept
       *
ERROR at line 1:
ORA-00901: invalid CREATE command


SQL> create table dept as select * from scott.dept;

Table created.

SQL> select deptno, dname,dbms_rowid.rowid_block_number(rowid) blockno,ora_rowscn from test_ora_scn;

    DEPTNO DNAME             BLOCKNO ORA_ROWSCN                                
---------- -------------- ---------- ----------                                
        10 HRRR                 2219    7340557                                
        20 RESEARCH             2219    7340557                                
        30 SALES                2219    7340557                                
        40 OPERATIONS           2219    7340557                                
        50 HRRR                 2222    7340632                                

SQL> select CURRENT_SCN from v$database;

CURRENT_SCN                                                                    
-----------                                                                    
    7343595                                                                    

SQL> update dept set DNAME='HR' where DEPTNO='50';

0 rows updated.

SQL> select deptno, dname,dbms_rowid.rowid_block_number(rowid) blockno,ora_rowscn from dept;

    DEPTNO DNAME             BLOCKNO ORA_ROWSCN                                
---------- -------------- ---------- ----------                                
        10 ACCOUNTING           2227    7343520                                
        20 RESEARCH             2227    7343520                                
        30 SALES                2227    7343520                                
        40 OPERATIONS           2227    7343520                                

SQL> insert into dept values ('50', 'HR','ZZZZ');

1 row created.

SQL> commit;

Commit complete.

SQL> select deptno, dname,dbms_rowid.rowid_block_number(rowid) blockno,ora_rowscn from dept;

    DEPTNO DNAME             BLOCKNO ORA_ROWSCN                                
---------- -------------- ---------- ----------                                
        10 ACCOUNTING           2227    7343520                                
        20 RESEARCH             2227    7343520                                
        30 SALES                2227    7343520                                
        40 OPERATIONS           2227    7343520                                
        50 HR                   2230    7343728                                

SQL> update dept set DNAME='NOACCOUNTING' where DEPTNO='10';

1 row updated.

SQL> commit;

Commit complete.

SQL> select deptno, dname,dbms_rowid.rowid_block_number(rowid) blockno,ora_rowscn from dept;

    DEPTNO DNAME             BLOCKNO ORA_ROWSCN                                
---------- -------------- ---------- ----------                                
        10 NOACCOUNTING         2227    7343768                                
        20 RESEARCH             2227    7343768                                
        30 SALES                2227    7343768                                
        40 OPERATIONS           2227    7343768                                
        50 HR                   2230    7343728                                

SQL> update dept set DNAME='NOHR' where DEPTNO='50';

1 row updated.

SQL> commit;

Commit complete.

SQL> select deptno, dname,dbms_rowid.rowid_block_number(rowid) blockno,ora_rowscn from dept;

    DEPTNO DNAME             BLOCKNO ORA_ROWSCN                                
---------- -------------- ---------- ----------                                
        10 NOACCOUNTING         2227    7343768                                
        20 RESEARCH             2227    7343768                                
        30 SALES                2227    7343768                                
        40 OPERATIONS           2227    7343768                                
        50 NOHR                 2230    7343786                                

SQL> spool off

No comments:

Post a Comment