设为首页 收藏本站
查看: 805|回复: 0

[经验分享] linux命令的oracle运用(一)

[复制链接]

尚未签到

发表于 2018-9-14 06:07:27 | 显示全部楼层 |阅读模式
  1 dd
  模拟物理坏块
  SQL> select * from v$database_block_corruption;
  no rows selected
  SQL> select * from v$backup_corruption;
  no rows selected
  SQL> select * from v$copy_corruption;
  no rows selected

  SQL> create tablespace physical_corrupt datafile>  Tablespace created.
  SQL> conn hr/hr
  Connected.
  SQL> create table tt (i int) tablespace physical_corrupt;
  Table created.
  SQL> insert into tt values(1);
  1 row created.
  SQL> insert into tt values(2);
  1 row created.
  SQL> commit;
  Commit complete.
  SQL> select tt.*,dbms_rowid.rowid_block_number(rowid) from tt;
  I DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
  ---------- ------------------------------------
  1          15
  2          15
  SQL> select tablespace_name,file_name from dba_data_files where tablespace_name='PHYSICAL_CORRUPT';
  TABLESPACE_NAME
  ------------------------------
  FILE_NAME
  --------------------------------------------------------------------------------
  PHYSICAL_CORRUPT
  /u01/app/oracle/oradata/ORCL/datafile/o1_mf_physical_88gkb4l9_.dbf
  [oracle@Think ~]$ dd of=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_physical_88gkb4l9_.dbf bs=8192 conv=notrunc seek=15  !
  0+1 records in
  0+1 records out
  17 bytes (17 B) copied, 9.9193e-05 s, 171 kB/s
  用rman向oracle注册,报告填充v$database_block_corruption
  RMAN> backup validate tablespace physical_corrupt;
  Starting backup at 24-OCT-12
  using target database control file instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=140 devtype=DISK
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  input datafile fno=00006 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_physical_88gkb4l9_.dbf
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
  Finished backup at 24-OCT-12
  SQL> select * from v$database_block_corruption;
  FILE#   BLOCK#   BLOCKS CORRUPTION_CHANGE# CORRUPTIO
  ---------- ---------- ---------- ------------------ ---------
  6   15     1     0 CORRUPT
  SQL> select * from tt;
  select * from tt
  *
  ERROR at line 1:
  ORA-01578: ORACLE data block corrupted (file # 6, block # 15)
  ORA-01110: data file 6:
  '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_physical_88gkb4l9_.dbf'
  2 diff
  逐行比较两个文本文件,列出差异行
  通常的输出格式:
  n1 a n2
  n1 c n2
  n1 d n2
  字母(a、d和c)之前的行号(n1)是针对file1的,其后面的行号(n2)是针对file2的。
  字母a、d和c分别表示附加、删除和修改操作。
  以””打头的行属于第二个文件。
  例如:
  [oracle@Think udump]$ diff orcl_ora_18900.trc orcl_ora_19032.trc
  1c1
  < /u01/app/oracle/admin/orcl/udump/orcl_ora_18900.trc
  ---
  > /u01/app/oracle/admin/orcl/udump/orcl_ora_19032.trc
  11,13c11,13
  < Redo thread mounted by this instance: 0
  < Oracle process number: 0
  < Unix process pid: 18900, image: oracle@Think
  ---
  > Redo thread mounted by this instance: 1
  > Oracle process number: 17
  > Unix process pid: 19032, image: oracle@Think (TNS V1-V3)
  15,17c15,19
  < KCCDEBUG_LEVEL = 0
  < Dynamic strand is set to TRUE
  < Running with 2 shared and 18 private strand(s). Zero-copy redo is FALSE
  ---
  > *** 2012-10-23 20:37:12.033
  > *** SERVICE NAME:(SYS$USERS) 2012-10-23 20:37:12.033

  > *** SESSION>  > kwqalqt2: Warning !! queue table IX.ORDERS_QUEUETABLE exits, entry in system.aq$_queue_tables missing
  > kwqalqt2: Warning !! queue table IX.STREAMS_QUEUE_TABLE exits, entry in system.aq$_queue_tables missing
  3 watch
  监测一个命令的运行结果,并且动态刷新
  -n:指定时间间隔,缺省是2秒
  -d:高亮显示变化的区域
  ctrl+c退出
  例如:
  [oracle@Think udump]$ watch -n 1 -d du -sh /u01/app/oracle/admin
  4 tail
  tail -f filename
  文件最尾部的内容显示在屏幕上,并且不断刷新,是你看到最新的内容。
  oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-581204-1-1.html 上篇帖子: oracle技术之行迁移和行链接 下篇帖子: Oracle冷备份
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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