文档课题:验证表的伪列rowid在主备库的一致性.标签:LAST,NAME,伪列,EMPLOYEE,主备,rowid,----------,ID From: https://blog.51cto.com/u_12991611/6017833
数据库:oracle 11.2.0.4
环境:主库 orcl150,备库 orcl151
应用场景:主库检测出存在坏块,若表存在索引.此时可以在主库确认出坏块对应的行rowid,进而通过rowid在备库确认到坏块对应的数据.
1、主库数据
--查主库中employees表的rowid.
HR@orcl150> set line 200
HR@orcl150> select rowid,employee_id,first_name,last_name,salary from employees
ROWID EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY
------------------ ----------- -------------------- ------------------------- ----------
AAAVZIAAEAAAADzAAA 100 Steven King 24000
AAAVZIAAEAAAADzAAB 101 Neena Kochhar 17000
AAAVZIAAEAAAADzAAC 102 Lex De Haan 17000
AAAVZIAAEAAAADzAAD 103 Alexander Hunold 9000
AAAVZIAAEAAAADzAAE 104 Bruce Ernst 6000
AAAVZIAAEAAAADzAAF 107 Diana Lorentz 4200
AAAVZIAAEAAAADzAAG 124 Kevin Mourgos 5800
AAAVZIAAEAAAADzAAH 141 Trenna Rajs 3500
AAAVZIAAEAAAADzAAI 142 Curtis Davies 3100
AAAVZIAAEAAAADzAAJ 143 Randall Matos 2600
AAAVZIAAEAAAADzAAK 144 Peter Vargas 2500
ROWID EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY
------------------ ----------- -------------------- ------------------------- ----------
AAAVZIAAEAAAADzAAL 149 Eleni Zlotkey 10500
AAAVZIAAEAAAADzAAM 174 Ellen Abel 11000
AAAVZIAAEAAAADzAAN 176 Jonathon Taylor 8600
AAAVZIAAEAAAADzAAO 178 Kimberely Grant 7000
AAAVZIAAEAAAADzAAP 200 Jennifer Whalen 4400
AAAVZIAAEAAAADzAAQ 201 Michael Hartstein 13000
AAAVZIAAEAAAADzAAR 202 Pat Fay 6000
AAAVZIAAEAAAADzAAS 205 Shelley Higgins 12008
AAAVZIAAEAAAADzAAT 206 William Gietz 8300
20 rows selected.
2、备库数据
--查备库中employees表的rowid.
HR@orcl151> set line 200
HR@orcl151> select rowid,employee_id,first_name,last_name,salary from employees
ROWID EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY
------------------ ----------- -------------------- ------------------------- ----------
AAAVZIAAEAAAADzAAA 100 Steven King 24000
AAAVZIAAEAAAADzAAB 101 Neena Kochhar 17000
AAAVZIAAEAAAADzAAC 102 Lex De Haan 17000
AAAVZIAAEAAAADzAAD 103 Alexander Hunold 9000
AAAVZIAAEAAAADzAAE 104 Bruce Ernst 6000
AAAVZIAAEAAAADzAAF 107 Diana Lorentz 4200
AAAVZIAAEAAAADzAAG 124 Kevin Mourgos 5800
AAAVZIAAEAAAADzAAH 141 Trenna Rajs 3500
AAAVZIAAEAAAADzAAI 142 Curtis Davies 3100
AAAVZIAAEAAAADzAAJ 143 Randall Matos 2600
AAAVZIAAEAAAADzAAK 144 Peter Vargas 2500
ROWID EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY
------------------ ----------- -------------------- ------------------------- ----------
AAAVZIAAEAAAADzAAL 149 Eleni Zlotkey 10500
AAAVZIAAEAAAADzAAM 174 Ellen Abel 11000
AAAVZIAAEAAAADzAAN 176 Jonathon Taylor 8600
AAAVZIAAEAAAADzAAO 178 Kimberely Grant 7000
AAAVZIAAEAAAADzAAP 200 Jennifer Whalen 4400
AAAVZIAAEAAAADzAAQ 201 Michael Hartstein 13000
AAAVZIAAEAAAADzAAR 202 Pat Fay 6000
AAAVZIAAEAAAADzAAS 205 Shelley Higgins 12008
AAAVZIAAEAAAADzAAT 206 William Gietz 8300
20 rows selected.
HR@orcl151> select EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,PHONE_NUMBER,HIRE_DATE,JOB_ID,SALARY,DEPARTMENT_ID from employees where rowid='AAAVZIAAEAAAADzAAA'
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY DEPARTMENT_ID
----------- ---------- ---------- ---------- -------------------- --------- ---------- ---------- -------------
100 Steven King SKING 515.123.4569 17-JUN-11 AD_PRES 24000 90
3、结论
如上所示,表在主备库的rowid相同.