Bo's Oracle Station

查看: 1291|回复: 0

课程第35/36次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-8-3 10:05:08 | 显示全部楼层 |阅读模式
2019-08-03

  1. select s.sid, s."TERMINAL"
  2. from v_$session s
  3. where s."CLIENT_INFO"  like '%botang%';

  4. select * from v$session where terminal='pts/0';


  5. select s.sid,  p."SPID"
  6. from v_$session s, v$process p
  7. where s.paddr=p.addr  and s."TERMINAL"='pts/0';



  8. select s.sid, s."OPNAME", s."TARGET", s."SOFAR", s."TOTALWORK" from v$session_longops  s
  9.   where s.sid  in (  64, 67 )  and  s. < s."TOTALWORK";
复制代码

输入文件数<=filesperset(rman命令)<=maxopenfiles(通道命令): QQ图片20190804085349.png
  1. RMAN>  run {
  2. 2>  allocate channel c1 device type sbt maxopenfiles 4;
  3. 3> allocate channel c2 device type sbt maxopenfiles 4;
  4. 4> backup tag '1T-WHOLE-INCR0'  filesperset 4 incremental level 0  (datafile 1,4,5,6 channel c1) (datafile 2,3,7,8 channel c2)
  5. 5> plus archivelog delete all input;
  6. 6> }

  7. using target database control file instead of recovery catalog
  8. allocated channel: c1
  9. channel c1: SID=62 device type=SBT_TAPE
  10. channel c1: Oracle Secure Backup

  11. allocated channel: c2
  12. channel c2: SID=74 device type=SBT_TAPE
  13. channel c2: Oracle Secure Backup


  14. Starting backup at 2019-08-04:06:56:14
  15. current log archived
  16. channel c1: starting archived log backup set
  17. channel c1: specifying archived log(s) in backup set
  18. input archived log thread=1 sequence=23 RECID=35 STAMP=1015397775
  19. channel c1: starting piece 1 at 2019-08-04:06:56:16
  20. channel c1: finished piece 1 at 2019-08-04:06:56:41
  21. piece handle=39u8bfcg_1_1 tag=1T-WHOLE-INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  22. channel c1: backup set complete, elapsed time: 00:00:25
  23. channel c1: deleting archived log(s)
  24. archived log file name=+FRA/orcl/archivelog/2019_08_04/thread_1_seq_23.297.1015397775 RECID=35 STAMP=1015397775
  25. Finished backup at 2019-08-04:06:56:41

  26. Starting backup at 2019-08-04:06:56:41
  27. channel c1: starting incremental level 0 datafile backup set
  28. channel c1: specifying datafile(s) in backup set
  29. input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/TBS05319.DBF
  30. input datafile file number=00004 name=+DATA/orcl/datafile/users.259.1014330935
  31. input datafile file number=00005 name=+DATA/orcl/datafile/example.265.1013960987
  32. input datafile file number=00001 name=+DATA/orcl/datafile/system.256.1014504215
  33. channel c1: starting piece 1 at 2019-08-04:06:56:41
  34. channel c2: starting incremental level 0 datafile backup set
  35. channel c2: specifying datafile(s) in backup set
  36. input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/TBS05319X.DBF
  37. input datafile file number=00008 name=/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF
  38. input datafile file number=00003 name=+DATA/orcl/datafile/undotbs1.258.1013960883
  39. input datafile file number=00002 name=+DATA/orcl/datafile/sysaux.257.1013960883
  40. channel c2: starting piece 1 at 2019-08-04:06:56:41
  41. channel c1: finished piece 1 at 2019-08-04:06:57:16
  42. piece handle=3au8bfd9_1_1 tag=1T-WHOLE-INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  43. channel c1: backup set complete, elapsed time: 00:00:35
  44. channel c2: finished piece 1 at 2019-08-04:06:57:16
  45. piece handle=3bu8bfd9_1_1 tag=1T-WHOLE-INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  46. channel c2: backup set complete, elapsed time: 00:00:35
  47. Finished backup at 2019-08-04:06:57:16

  48. Starting backup at 2019-08-04:06:57:17
  49. current log archived
  50. channel c1: starting archived log backup set
  51. channel c1: specifying archived log(s) in backup set
  52. input archived log thread=1 sequence=24 RECID=36 STAMP=1015397837
  53. channel c1: starting piece 1 at 2019-08-04:06:57:17
  54. channel c1: finished piece 1 at 2019-08-04:06:57:42
  55. piece handle=3cu8bfed_1_1 tag=1T-WHOLE-INCR0 comment=API Version 2.0,MMS Version 10.4.0.4
  56. channel c1: backup set complete, elapsed time: 00:00:25
  57. channel c1: deleting archived log(s)
  58. archived log file name=+FRA/orcl/archivelog/2019_08_04/thread_1_seq_24.297.1015397837 RECID=36 STAMP=1015397837
  59. Finished backup at 2019-08-04:06:57:42

  60. Starting Control File and SPFILE Autobackup at 2019-08-04:06:57:42
  61. piece handle=c-1541741703-20190804-01 comment=API Version 2.0,MMS Version 10.4.0.4
  62. Finished Control File and SPFILE Autobackup at 2019-08-04:06:58:07
  63. released channel: c1
  64. released channel: c2

  65. RMAN>
复制代码

----------
  1. RMAN>  backup  duration 00:03 minimize load   tablespace users;

  2. Starting backup at 2019-08-04:07:38:51
  3. using channel ORA_SBT_TAPE_1
  4. channel ORA_SBT_TAPE_1: starting full datafile backup set
  5. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  6. input datafile file number=00004 name=+DATA/orcl/datafile/users.259.1014330935
  7. channel ORA_SBT_TAPE_1: starting piece 1 at 2019-08-04:07:38:51
  8. channel ORA_SBT_TAPE_1: finished piece 1 at 2019-08-04:07:41:56
  9. piece handle=3qu8bhsb_1_1 tag=TAG20190804T073851 comment=API Version 2.0,MMS Version 10.4.0.4
  10. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:03:05
  11. channel ORA_SBT_TAPE_1: throttle time: 0:02:42
  12. Finished backup at 2019-08-04:07:41:56

  13. Starting Control File and SPFILE Autobackup at 2019-08-04:07:41:56
  14. piece handle=c-1541741703-20190804-05 comment=API Version 2.0,MMS Version 10.4.0.4
  15. Finished Control File and SPFILE Autobackup at 2019-08-04:07:42:22

  16. RMAN> list backup of tablespace users;


  17. List of Backup Sets
  18. ===================


  19. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  20. ------- ---- -- ---------- ----------- ------------ -------------------
  21. 98      Incr 0  725.00M    SBT_TAPE    00:00:34     2019-08-04:06:57:15
  22.         BP Key: 98   Status: AVAILABLE  Compressed: NO  Tag: 1T-WHOLE-INCR0
  23.         Handle: 3au8bfd9_1_1   Media: RMAN-DEFAULT-000011
  24.   List of Datafiles in backup set 98
  25.   File LV Type Ckp SCN    Ckp Time            Name
  26.   ---- -- ---- ---------- ------------------- ----
  27.   4    0  Incr 1603503    2019-08-04:06:56:41 +DATA/orcl/datafile/users.259.1014330935

  28. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  29. ------- ---- -- ---------- ----------- ------------ -------------------
  30. 104     Full    15.50M     SBT_TAPE    00:00:20     2019-08-04:07:26:03
  31.         BP Key: 104   Status: AVAILABLE  Compressed: NO  Tag: TAG20190804T072406
  32.         Handle: 3hu8bh3n_1_1   Media: station76-000029
  33.   List of Datafiles in backup set 104
  34.   File LV Type Ckp SCN    Ckp Time            Name
  35.   ---- -- ---- ---------- ------------------- ----
  36.   4       Full 1606004    2019-08-04:07:25:43 +DATA/orcl/datafile/users.259.1014330935

  37. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  38. ------- ---- -- ---------- ----------- ------------ -------------------
  39. 109     Full    15.50M     SBT_TAPE    00:00:15     2019-08-04:07:30:42
  40.         BP Key: 109   Status: AVAILABLE  Compressed: NO  Tag: TAG20190804T072850
  41.         Handle: 3mu8bhcj_1_1   Media: station76-000030
  42.   List of Datafiles in backup set 109
  43.   File LV Type Ckp SCN    Ckp Time            Name
  44.   ---- -- ---- ---------- ------------------- ----
  45.   4       Full 1606778    2019-08-04:07:30:27 +DATA/orcl/datafile/users.259.1014330935

  46. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  47. ------- ---- -- ---------- ----------- ------------ -------------------
  48. 111     Full    7.75M      SBT_TAPE    00:00:14     2019-08-04:07:36:51
  49.         BP Key: 111   Status: AVAILABLE  Compressed: NO  Tag: TAG20190804T073636
  50.         Handle: 3ou8bho5_1_1   Media: station76-000030
  51.   List of Datafiles in backup set 111
  52.   File LV Type Ckp SCN    Ckp Time            Name
  53.   ---- -- ---- ---------- ------------------- ----
  54.   4       Full 1627588    2019-08-04:07:36:37 +DATA/orcl/datafile/users.259.1014330935

  55. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  56. ------- ---- -- ---------- ----------- ------------ -------------------
  57. 113     Full    7.75M      SBT_TAPE    00:03:04     2019-08-04:07:41:55
  58.         BP Key: 113   Status: AVAILABLE  Compressed: NO  Tag: TAG20190804T073851
  59.         Handle: 3qu8bhsb_1_1   Media: station76-000030
  60.   List of Datafiles in backup set 113
  61.   File LV Type Ckp SCN    Ckp Time            Name
  62.   ---- -- ---- ---------- ------------------- ----
  63.   4       Full 1627742    2019-08-04:07:38:51 +DATA/orcl/datafile/users.259.1014330935

  64. RMAN>
复制代码
------------------------------
  1. SQL> select  department_id , rowid , substr(rowid , 10,6) , dbms_rowid.rowid_block_number(rowid)  from  departments;

  2. DEPARTMENT_ID ROWID              SUBSTR(ROWID,10,6)
  3. ------------- ------------------ ------------------------
  4. DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
  5. ------------------------------------
  6.            10 AAAVTAAAFAAAACvAAA AAAACv
  7.                                  175

  8.            20 AAAVTAAAFAAAACvAAB AAAACv
  9.                                  175
复制代码
---------物理坏块破坏的脚本:
  1. #!/bin/sh
  2. v_dbname=orcl
  3. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/srvctl stop database -d $v_dbname -o abort"
  4. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  5. conn / as sysdba
  6. startup mount exclusive
  7. EOF

  8. rm -f /home/oracle/example01.dbf 2>/dev/null

  9. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  10. backup as copy datafile 5 format '/home/oracle/example01.dbf';
  11. EOF

  12. dd if=/dev/zero of=/home/oracle/example01.dbf bs=8192 count=1 seek=175 conv=notrunc

  13. su - oracle -c "export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid ; export ORACLE_SID=+ASM ; /u01/app/oracle/product/11.2.0/grid/bin/asmcmd" <<EOF
  14. rm -f +data/$v_dbname/DATAFILE/example*
  15. EOF

  16. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  17. run {
  18. set maxcorrupt for datafile 5 to 1;
  19. backup as copy  datafilecopy '/home/oracle/example01.dbf' format '+data';
  20. }
  21. EOF

  22. sleep 3

  23. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target /" <<EOF
  24. delete noprompt datafilecopy '/home/oracle/example01.dbf';
  25. switch datafile 5 to copy;
  26. EOF


  27. su - oracle -c "/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus /nolog" <<EOF
  28. conn / as sysdba
  29. alter database open;
  30. EOF
复制代码
逻辑坏块:
  1. [oracle@station76 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 3 17:21:49 2019

  3. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  4. SQL> conn / as sysdba
  5. Connected.
  6. SQL> create tablespace tbslogical datafile size 10M nologging;

  7. Tablespace created.

  8. SQL> conn hr/oracle_4U
  9. Connected.
  10. SQL> create table tlogical ( a number, b varchar2(30))  tablespace tbslogical  ;

  11. Table created.

  12. SQL> create index ilogical_a on tlogical ( a )  tablespace users;

  13. Index created.

  14. SQL> create index ilogical_b on tlogical (b)  tablespace users;

  15. Index created.

  16. SQL> insert into tlogical values (32691,'backwoodser')  ;

  17. 1 row created.

  18. SQL> commit;

  19. Commit complete.

  20. SQL> select dbms_rowid.rowid_block_number( rowid )  , a , b from tlogical ;

  21. DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)          A B
  22. ------------------------------------ ---------- ------------------------------
  23.                                  131      32691 backwoodser

  24. SQL> exit
  25. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  26. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  27. and Real Application Testing options
  28. [oracle@station76 ~]$ rman target /

  29. Recovery Manager: Release 11.2.0.4.0 - Production on Sat Aug 3 17:33:56 2019

  30. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  31. connected to target database: ORCL (DBID=1541741703)

  32. RMAN> backup tablespace tbslogical ;

  33. Starting backup at 2019-08-03:17:34:17
  34. using target database control file instead of recovery catalog
  35. configuration for SBT_TAPE channel 2 is ignored
  36. allocated channel: ORA_SBT_TAPE_1
  37. channel ORA_SBT_TAPE_1: SID=51 device type=SBT_TAPE
  38. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  39. channel ORA_SBT_TAPE_1: starting full datafile backup set
  40. channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
  41. input datafile file number=00009 name=+DATA/orcl/datafile/tbslogical.265.1015349393
  42. channel ORA_SBT_TAPE_1: starting piece 1 at 2019-08-03:17:34:25
  43. channel ORA_SBT_TAPE_1: finished piece 1 at 2019-08-03:17:34:50
  44. piece handle=45u8a0d1_1_1 tag=TAG20190803T173425 comment=API Version 2.0,MMS Version 10.4.0.4
  45. channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:25
  46. Finished backup at 2019-08-03:17:34:50

  47. Starting Control File and SPFILE Autobackup at 2019-08-03:17:34:50
  48. piece handle=c-1541741703-20190803-04 comment=API Version 2.0,MMS Version 10.4.0.4
  49. Finished Control File and SPFILE Autobackup at 2019-08-03:17:35:15

  50. RMAN> exit


  51. Recovery Manager complete.
  52. [oracle@station76 ~]$ sqlplus /nolog

  53. SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 3 17:35:30 2019

  54. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  55. SQL> conn hr/oracle_4U
  56. Connected.
  57. SQL> insert /*+ append */ into tlogical select * from tlogical ;

  58. 1 row created.

  59. SQL> commit;

  60. Commit complete.

  61. SQL> select  * from tlogical;

  62.          A B
  63. ---------- ------------------------------
  64.      32691 backwoodser
  65.      32691 backwoodser

  66. SQL> select dbms_rowid.rowid_block_number(rowid)  , a , b from tlogical ;

  67. DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)          A B
  68. ------------------------------------ ---------- ------------------------------
  69.                                  131      32691 backwoodser
  70.                                  136      32691 backwoodser

  71. SQL> conn / as sysdba
  72. Connected.
  73. SQL> select  file_name from dba_data_files where tablespace_name='TBSLOGICAL';

  74. FILE_NAME
  75. --------------------------------------------------------------------------------
  76. +DATA/orcl/datafile/tbslogical.265.1015349393

  77. SQL> alter database datafile '+DATA/orcl/datafile/tbslogical.265.1015349393' offline ;

  78. Database altered.

  79. SQL>  alter database datafile '+DATA/orcl/datafile/tbslogical.265.1015349393'  online;
  80. alter database datafile '+DATA/orcl/datafile/tbslogical.265.1015349393'  online
  81. *
  82. ERROR at line 1:
  83. ORA-01113: file 9 needs media recovery
  84. ORA-01110: data file 9: '+DATA/orcl/datafile/tbslogical.265.1015349393'


  85. SQL> exit
  86. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  87. With the Partitioning, Automatic Storage Management, OLAP, Data Mining
  88. and Real Application Testing options
  89. [oracle@station76 ~]$ rman target /

  90. Recovery Manager: Release 11.2.0.4.0 - Production on Sat Aug 3 17:38:28 2019

  91. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

  92. connected to target database: ORCL (DBID=1541741703)

  93. RMAN> restore datafile '+DATA/orcl/datafile/tbslogical.265';

  94. Starting restore at 2019-08-03:17:38:40
  95. using target database control file instead of recovery catalog
  96. configuration for SBT_TAPE channel 2 is ignored
  97. allocated channel: ORA_SBT_TAPE_1
  98. channel ORA_SBT_TAPE_1: SID=66 device type=SBT_TAPE
  99. channel ORA_SBT_TAPE_1: Oracle Secure Backup
  100. allocated channel: ORA_DISK_1
  101. channel ORA_DISK_1: SID=57 device type=DISK
  102. RMAN-00571: ===========================================================
  103. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  104. RMAN-00571: ===========================================================
  105. RMAN-03002: failure of restore command at 08/03/2019 17:38:46
  106. RMAN-20201: datafile not found in the recovery catalog
  107. RMAN-06010: error while looking up datafile: +DATA/orcl/datafile/tbslogical.265

  108. RMAN> report schema;

  109. Report of database schema for database with db_unique_name ORCL

  110. List of Permanent Datafiles
  111. ===========================
  112. File Size(MB) Tablespace           RB segs Datafile Name
  113. ---- -------- -------------------- ------- ------------------------
  114. 1    760      SYSTEM               ***     +DATA/orcl/datafile/system.256.1014504215
  115. 2    620      SYSAUX               ***     +DATA/orcl/datafile/sysaux.257.1013960883
  116. 3    105      UNDOTBS1             ***     +DATA/orcl/datafile/undotbs1.258.1013960883
  117. 4    10       USERS                ***     +DATA/orcl/datafile/users.259.1014330935
  118. 5    346      EXAMPLE              ***     +DATA/orcl/datafile/example.280.1015348375
  119. 6    10       TBS05319             ***     /u01/app/oracle/oradata/orcl/TBS05319.DBF
  120. 7    10       TBS05319X            ***     /u01/app/oracle/oradata/orcl/TBS05319X.DBF
  121. 8    10       TBSSOLARIS           ***     /u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF
  122. 9    10       TBSLOGICAL           ***     +DATA/orcl/datafile/tbslogical.265.1015349393

  123. List of Temporary Files
  124. =======================
  125. File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
  126. ---- -------- -------------------- ----------- --------------------
  127. 1    100      TEMP                 32767       +DATA/orcl/tempfile/temp.267.1014724469

  128. RMAN> restore datafile '+DATA/orcl/datafile/tbslogical.265.1015349393';

  129. Starting restore at 2019-08-03:17:39:23
  130. using channel ORA_SBT_TAPE_1
  131. using channel ORA_DISK_1

  132. +DATA/orcl/datafile/tbslogical.265.10153493channel ORA_SBT_TAPE_1: starting datafile backup set restore                                   channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
  133. channel ORA_SBT_TAPE_1: restoring datafile 00009 to +DATA/orcl/datafile/tbslogical.265.1015349393
  134. channel ORA_SBT_TAPE_1: reading from backup piece 45u8a0d1_1_1                                                                channel ORA_SBT_TAPE_1: piece handle=45u8a0d1_1_1 tag=TAG20190803T173425
  135. channel ORA_SBT_TAPE_1: restored backup piece 1
  136. channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:25
  137. Finished restore at 2019-08-03:17:39:52

  138. RMAN> recover  datafile 9;

  139. RMAN-00571: ===========================================================
  140. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  141. RMAN-00571: ===========================================================
  142. RMAN-00558: error encountered while parsing input commands
  143. RMAN-01006: error signaled during parse
  144. RMAN-02001: unrecognized punctuation symbol "+"

  145. RMAN>  recover  datafile 9;

  146. Starting recover at 2019-08-03:17:40:16
  147. using channel ORA_SBT_TAPE_1
  148. using channel ORA_DISK_1

  149. starting media recovery
  150. media recovery complete, elapsed time: 00:00:01

  151. Finished recover at 2019-08-03:17:40:17

  152. RMAN> exit


  153. Recovery Manager complete.
  154. [oracle@station76 ~]$ sqlplus /nolog

  155. SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 3 17:40:31 2019

  156. Copyright (c) 1982, 2013, Oracle.  All rights reserved.

  157. SQL> conn / as sysdba
  158. Connected.
  159. SQL> alter database datafile 9 online;

  160. Database altered.

  161. SQL> conn hr/oracle_4U
  162. Connected.
  163. SQL> select * from tlogical ;
  164. ERROR:
  165. ORA-01578: ORACLE data block corrupted (file # 9, block # 136)
  166. ORA-01110: data file 9: '+DATA/orcl/datafile/tbslogical.265.1015349393'
  167. ORA-26040: Data block was loaded using the NOLOGGING option



  168. no rows selected

  169. SQL>
复制代码

Oracle内部存储数字的简单探索:
  1. SQL> conn hr/oracle_4U
  2. Connected.
  3. SQL> select dump(1) from dual ;

  4. DUMP(1)
  5. ------------------
  6. Typ=2 Len=2: 193,2

  7. SQL> select dump(10) from dual ;

  8. DUMP(10)
  9. -------------------
  10. Typ=2 Len=2: 193,11

  11. SQL> select dump(100) from dual ;

  12. DUMP(100)
  13. ------------------
  14. Typ=2 Len=2: 194,2

  15. SQL>  select dump(1000) from dual ;

  16. DUMP(1000)
  17. -------------------
  18. Typ=2 Len=2: 194,11

  19. SQL> select  dump(110) from dual ;

  20. DUMP(110)
  21. ---------------------
  22. Typ=2 Len=3: 194,2,11


  23. SQL> select  dump(-1) from dual;

  24. DUMP(-1)
  25. -----------------------
  26. Typ=2 Len=3: 62,100,102

  27. SQL> select  dump(-10) from dual;

  28. DUMP(-10)
  29. ----------------------
  30. Typ=2 Len=3: 62,91,102

  31. SQL>  select  dump(-100) from dual;

  32. DUMP(-100)
  33. -----------------------
  34. Typ=2 Len=3: 61,100,102

  35. SQL> select dump(-1000) from dual;

  36. DUMP(-1000)
  37. ----------------------
  38. Typ=2 Len=3: 61,91,102

  39. SQL> select dump(0) from dual;

  40. DUMP(0)
  41. ----------------
  42. Typ=2 Len=1: 128

  43. SQL> select  dump(123456.789) from dual ;

  44. DUMP(123456.789)
  45. -------------------------------
  46. Typ=2 Len=6: 195,13,35,57,79,91

  47. SQL>  select  dump(-123456.789) from dual;

  48. DUMP(-123456.789)
  49. ----------------------------------
  50. Typ=2 Len=7: 60,89,67,45,23,11,102

  51. SQL>  select  dump(-123456.78901) from dual ;

  52. DUMP(-123456.78901)
  53. -------------------------------------
  54. Typ=2 Len=8: 60,89,67,45,23,11,91,102

  55. SQL> select  dump(32691) from dual ;

  56. DUMP(32691)
  57. ------------------------
  58. Typ=2 Len=4: 195,4,27,92

  59. SQL>
复制代码
第一个括号的最后一个数字是“位置数”,比如Typ=2 Len=3: 194,2,11,其中2就是位置0,11就是位置1(小码机高位在前)
100^(193-193-0)(2-1)=1
100^(193-193-0)(11-1)=10
100^(194-193-0)(2-1)=100
100^(194-193-0)(11-1)=1000
100^(194-193-0)(2-1)+
   100^(194-193-1)(11-1)=110
100^(194-193-0)(12-1)=1100
100^(62-62-0)(101-100)=1
100^(62-62-0)(101-91)=10
100^(62-61-0)(101-100)=100
123456.789
100^(195-193-0)(13-1)+
100^(195-193-1)(35-1)+
100^(195-193-2)(57-1)+
100^(195-193-3)(79-1)+
100^(195-193-4)(91-1)=120000+3400+56+0.78+0.009=
123456.789
-123456.789
100^(62-60-0)(101-89)+
100^(62-60-1)(101-67)+
100^(62-60-2)(101-45)+
100^(62-60-3)(101-23)+
100^(62-60-4)(101-11)=120000+3400+56+0.78+0.009=
-123456.789
-123456.78901
100^(62-60-0)(101-89)+
100^(62-60-1)(101-67)+
100^(62-60-2)(101-45)+
100^(62-60-3)(101-23)+
100^(62-60-4)(101-11)+
100^(62-60-5)(101-91)
=120000+3400+56+0.78+0.009+ 0.00001=
-123456.78901




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-10 03:21 , Processed in 0.156648 second(s), 27 queries .

快速回复 返回顶部 返回列表