zoukankan      html  css  js  c++  java
  • oracle用户管理的完全恢复2:在NOARCHIVELOG 模式下执行恢复(无联机日志的备份)

    1.查看环境

     1 -bash-3.00$ sqlplus /nolog
     2 
     3 SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jan 21 19:22:40 2013
     4 
     5 Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
     6 
     7 SQL> conn /as sysdba
     8 Connected.
     9 SQL> archive log list;
    10 Database log mode              No Archive Mode
    11 Automatic archival             Disabled
    12 Archive destination            USE_DB_RECOVERY_FILE_DEST
    13 Oldest online log sequence     1
    14 Current log sequence           2
    15 SQL> 

    2.非归档模式下备份(没有备份联机日志)

    2.1关机

    1 SQL> shutdown immediate
    2 Database closed.
    3 Database dismounted.
    4 ORACLE instance shut down.
    5 SQL> 

    2.2 备份数据文件,控制文件

    1 /u01/oradata/sunbak
    2 bash-3.00$ cp *.ctl  /u01/backup/sunbak
    3 bash-3.00$ cp *.dbf  /u01/backup/sunbak
    4 bash-3.00$ 

    3.破坏当前数据库

     1 bash-3.00$ pwd   
     2 /u01/oradata/sunbak
     3 bash-3.00$ ls -l
     4 total 2142000
     5 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control01.ctl
     6 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control02.ctl
     7 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:27 control03.ctl
     8 -rw-r-----   1 oracle   oinstall 104865792 Jan 21 19:33 example01.dbf
     9 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 19:27 redo01.log
    10 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 18:52 redo02.log
    11 -rw-r-----   1 oracle   oinstall 52429312 Jan 21 18:52 redo03.log
    12 -rw-r-----   1 oracle   oinstall 251666432 Jan 21 19:34 sysaux01.dbf
    13 -rw-r-----   1 oracle   oinstall 503324672 Jan 21 19:34 system01.dbf
    14 -rw-r-----   1 oracle   oinstall 20979712 Jan 21 19:35 temp01.dbf
    15 -rw-r-----   1 oracle   oinstall 31465472 Jan 21 19:35 undotbs01.dbf
    16 -rw-r-----   1 oracle   oinstall 5251072 Jan 21 19:35 users01.dbf
    17 bash-3.00$ rm -f *
    18 bash-3.00$ 

    4.还原(备份是并没有备份redo文件)

     1 bash-3.00$ pwd                        
     2 /u01/oradata/sunbak
     3 bash-3.00$ cp /u01/backup/sunbak/* .
     4 bash-3.00$ ls -l
     5 total 1834512
     6 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control01.ctl
     7 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control02.ctl
     8 -rw-r-----   1 oracle   oinstall 7061504 Jan 21 19:43 control03.ctl
     9 -rw-r-----   1 oracle   oinstall 104865792 Jan 21 19:43 example01.dbf
    10 -rw-r-----   1 oracle   oinstall 251666432 Jan 21 19:43 sysaux01.dbf
    11 -rw-r-----   1 oracle   oinstall 503324672 Jan 21 19:44 system01.dbf
    12 -rw-r-----   1 oracle   oinstall 20979712 Jan 21 19:44 temp01.dbf
    13 -rw-r-----   1 oracle   oinstall 31465472 Jan 21 19:44 undotbs01.dbf
    14 -rw-r-----   1 oracle   oinstall 5251072 Jan 21 19:44 users01.dbf
    15 bash-3.00$ 

    5.恢复

    5.1 打开到mount状态

     1 bash-3.00$ sqlplus /nolog
     2 
     3 SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jan 21 19:47:04 2013
     4 
     5 Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
     6 
     7 SQL> conn /as sysdba
     8 Connected to an idle instance.
     9 SQL> startup mount
    10 ORACLE instance started.
    11 
    12 Total System Global Area  289406976 bytes
    13 Fixed Size                  1279820 bytes
    14 Variable Size              92276916 bytes
    15 Database Buffers          192937984 bytes
    16 Redo Buffers                2912256 bytes
    17 Database mounted.
    18 SQL> 

    5.2 执行recover命令

     1 SQL> recover database until cancel using backup controlfile;
     2 ORA-00279: change 570446 generated at 01/21/2013 19:27:52 needed for thread 1
     3 ORA-00289: suggestion :
     4 /u01/flash_recovery_area/SUN/archivelog/2013_01_21/o1_mf_1_2_%u_.arc
     5 ORA-00280: change 570446 for thread 1 is in sequence #2
     6 
     7 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
     8 cancel
     9 Media recovery cancelled.
    10 SQL> 

    5.3 打开数据库并创建日志

    1 SQL> alter database open resetlogs;
    2 
    3 Database altered.
    4 
    5 SQL>

    6.验证日志文件已被创建

    1 SQL> !ls /u01/oradata/sunbak/*.log
    2 /u01/oradata/sunbak/redo01.log  /u01/oradata/sunbak/redo02.log  /u01/oradata/sunbak/redo03.log
    3 
    4 SQL>
  • 相关阅读:
    CSS3中三种清除浮动(float)影响的方式
    HTML中关于动态创建的标签无法绑定js事件的解决方法:.on()方法的 [.selector]
    Android 5.0以上heads up通知
    CoordinatorLayout
    ViewDragHelper
    Transition FrameWork
    Android启动过程
    不要滥用SharedPreference
    不要在Application中缓存数据
    SparseArray替代HashMap来提高性能
  • 原文地址:https://www.cnblogs.com/polestar/p/2872581.html
Copyright © 2011-2022 走看看