rman恢復所有數據,控制,參數文件,上 ,未寫完待續


(1)備份users表空間
RMAN> backup tablespace users  format  '/oracle.bacup/tablespace/uses_%s_%p_%t';

Starting backup at 02-APR-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/oracle/app/oradata/shpog1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-APR-17
channel ORA_DISK_1: finished piece 1 at 02-APR-17
piece handle=/oracle.bacup/tablespace/uses_19_1_940290968 tag=TAG20170402T235608 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 02-APR-17
Starting Control File and SPFILE Autobackup at 02-APR-17
piece handle=/oracle.bacup/control/cf_c-799280029-20170402-04 comment=NONE
Finished Control File and SPFILE Autobackup at 02-APR-17
(2)備份hai表空間

RMAN> backup tablespace  hai  format '/oracle.bacup/tablespace/hai_%s_%p_%t';


Starting backup at 02-APR-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00008 name=/oracle/app/oradata/shpog1/hai01.dbf
channel ORA_DISK_1: starting piece 1 at 02-APR-17
channel ORA_DISK_1: finished piece 1 at 02-APR-17
piece handle=/oracle.bacup/tablespace/hai_21_1_940291087 tag=TAG20170402T235807 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-APR-17


Starting Control File and SPFILE Autobackup at 02-APR-17
piece handle=/oracle.bacup/control/cf_c-799280029-20170402-05 comment=NONE
Finished Control File and SPFILE Autobackup at 02-APR-17
(4)全備
RMAN> backup database   format '/oracle.bacup/hai_full__%s_%p_%t';



Starting backup at 03-APR-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oracle/oracle_tablespace/zhou01.dbf
input datafile file number=00007 name=/oracle/app/oradata/shpog1/rman_tbs.dbf
input datafile file number=00001 name=/oracle/app/oradata/shpog1/system01.dbf
input datafile file number=00002 name=/oracle/app/oradata/shpog1/sysaux01.dbf
input datafile file number=00003 name=/oracle/app/oradata/shpog1/undotbs01.dbf
input datafile file number=00004 name=/oracle/app/oradata/shpog1/users01.dbf
input datafile file number=00005 name=/oracle/app/oradata/shpog1/example01.dbf
input datafile file number=00008 name=/oracle/app/oradata/shpog1/hai01.dbf
channel ORA_DISK_1: starting piece 1 at 03-APR-17
channel ORA_DISK_1: finished piece 1 at 03-APR-17
piece handle=/oracle.bacup/hai_full__23_1_940291222 tag=TAG20170403T000022 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:10:35
Finished backup at 03-APR-17


Starting Control File and SPFILE Autobackup at 03-APR-17
piece handle=/oracle.bacup/control/cf_c-799280029-20170403-00 comment=NONE
Finished Control File and SPFILE Autobackup at 03-APR-17


(5)備份所有數據文件    。。。。。。這裏錯了
RMAN> backup datafile 1;



Starting backup at 03-APR-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/app/oradata/shpog1/system01.dbf
channel ORA_DISK_1: starting piece 1 at 03-APR-17
channel ORA_DISK_1: finished piece 1 at 03-APR-17
piece handle=/oracle.bacup/SHPOG1_25_20170403.bak tag=TAG20170403T002333 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 03-APR-17



(1)刪除所有數據,控制,參數文件。(redo)日誌不能刪



[orale@oracle1 shpog1]$ ll
total 9919560
-rw-r----- 1 oracle oinstall    9748480 Apr  3 00:41 control01.ctl
-rw-r----- 1 oracle oinstall    9748480 Apr  3 00:41 control02.ctl
-rw-r----- 1 oracle oinstall  104865792 Apr  3 00:24 example01.dbf
-rw-r----- 1 oracle oinstall  104865792 Apr  3 00:24 hai01.dbf
-rw-r----- 1 oracle oinstall   52429312 Apr  2 23:18 redo01.log
-rw-r----- 1 oracle oinstall   52429312 Apr  2 23:18 redo02.log
-rw-r----- 1 oracle oinstall   52429312 Apr  2 23:18 redo03.log
-rw-r----- 1 oracle oinstall   52429312 Apr  3 00:39 redo04.log
-rw-r----- 1 oracle oinstall   52429312 Apr  2 23:18 redo05.log
-rw-r----- 1 oracle oinstall 5368717312 Apr  3 00:24 rman_tbs.dbf
-rw-r----- 1 oracle oinstall 1073750016 Apr  3 00:24 sysaux01.dbf
-rw-r----- 1 oracle oinstall 1073750016 Apr  3 00:23 system01.dbf
-rw-r----- 1 oracle oinstall   40902656 Apr  2 15:35 temp01.dbf
-rw-r----- 1 oracle oinstall 1073750016 Apr  3 00:24 undotbs01.dbf
-rw-r----- 1 oracle oinstall 1073750016 Apr  3 00:24 users01.dbf
[oracle@oracle1 shpog1]$ rm *.ctl
[oracle@oracle1 shpog1]$ rm -rf  *.dbf 
[oracle@oracle1 shpog1]$ ll
total 256020
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo03.log
-rw-r----- 1 oracle oinstall 52429312 Apr  3 00:42 redo04.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo05.log
[oracle@oracle1 shpog1]$ cd  ..


[oracle@oracle1 app]$ cd  product/11.2/db/dbs/
[oracle@oracle1 dbs]$ rm -rf  spfileshpog1.ora
[oracle@oracle1 dbs]$ ll
total 2271760
-rw-r----- 1 oracle oinstall 1153318912 Mar 18 04:11 01rvdlk4_1_1
-rw-r----- 1 oracle oinstall 1153351680 Mar 18 04:14 02rvdlum_1_1
-rw-r----- 1 oracle oinstall    9830400 Mar 18 04:14 03rvdm22_1_1
drwxr-xr-x 2 oracle oinstall       4096 Apr  2 23:12 arch
-rw-rw---- 1 oracle oinstall       1544 Mar 18 03:01 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall       1544 Apr  2 23:18 hc_shpog1.dat
-rw-r--r-- 1 oracle oinstall       2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall         24 Mar 18 03:11 lkSHPOG1
-rw-r----- 1 oracle oinstall       1536 Mar 18 03:19 orapwshpog1
-rw-r----- 1 oracle oinstall    9748480 Apr  3 00:34 snapcf_shpog1.f


(2)關閉數據庫報錯找不到system文件和控制文件
[oracle@oracle1 dbs]$ sqlplus  / as sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 3 00:43:51 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

SQL> shutdown immediate;

ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/oracle/app/oradata/shpog1/system01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oracle/app/oradata/shpog1/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> shut abort;
ORACLE instance shut down.

(3)啓動報錯找不到參數文件
SQL> startup;

ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/app/product/11.2/db/dbs/initshpog1.ora'
SQL> 
SQL> 
SQL> exit 
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
[oracle@oracle1 dbs]$ rman target  /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 3 00:46:18 2017

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

connected to target database (not started)
(4)自動恢復不讓恢復
RMAN> restore  spfile  from  autobackup;


Starting restore at 03-APR-17
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/03/2017 00:49:49
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory

RMAN> exit
(5)日誌報錯
[oracle@oracle1 trace]$ ll
total 2912
-rw-r----- 1 oracle oinstall 110273 Apr  3 00:44 alert_shpog1.log
[oracle@oracle1 trace]$ tail -400f  alert_shpog1.log
Errors in file /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_dbw0_14677.trc:
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/app/oradata/shpog1/hai01.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_ora_14715.trc:
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/app/oradata/shpog1/hai01.dbf'
ORA-1157 signalled during: ALTER DATABASE OPEN...
Sun Apr 02 23:17:16 2017
Full restore complete of datafile 8 /oracle/app/oradata/shpog1/hai01.dbf.  Elapsed time: 0:00:01 
  checkpoint is 1215068
Sun Apr 02 23:18:03 2017
alter  database  open
Errors in file /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_ora_14737.trc:
ORA-01113: file 8 needs media recovery
ORA-01110: data file 8: '/oracle/app/oradata/shpog1/hai01.dbf'
ORA-1113 signalled during: alter  database  open...
Errors in file /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_m000_15224.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oracle/app/oradata/shpog1/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Mon Apr 03 00:44:13 2017
Errors in file /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_j000_15230.trc:
ORA-12012: error on auto execute of job 57372
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/oracle/app/oradata/shpog1/undotbs01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
[oracle@oracle1 shpog1]$ ll
total 256020
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo03.log
-rw-r----- 1 oracle oinstall 52429312 Apr  3 00:44 redo04.log
-rw-r----- 1 oracle oinstall 52429312 Apr  2 23:18 redo05.log


(6)編輯一個init.ora的文件先讓數據庫起來
[oracle@oracle1 shpog1]$ vi  init.ora
db_name=shpog1
"init.ora" [New] 1L, 15C written   
                                                                 
 
[oracle@oracle1 shpog1]$ sqlplus / as  sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 3 01:19:51 2017


Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup  nomount  pfile='/oracle/app/oradata/shpog1/init.ora';
ORACLE instance started.



Total System Global Area  217157632 bytes
Fixed Size                  2211928 bytes
Variable Size             159387560 bytes
Database Buffers           50331648 bytes
Redo Buffers                5226496 bytes
(7)擋個文件下來,查看文件的頭部分,有dbid
SQL> oradebug  setmypid
Statement processed.
SQL> oradebug tracefile_name;
/oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_ora_15444.trc
SQL> 
SQL>  alter  system dump  logfile  '/oracle/app/oradata/shpog1/redo05.log';
System altered.
(8)dbid和dbname
SQL> exit 
Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
[oracle@oracle1 shpog1]$ more /oracle/app/diag/rdbms/shpog1/shpog1/trace/shpog1_ora_15444.trc
        Compatibility Vsn = 186646528=0xb200000
        Db ID=799280029=0x2fa40b9d, Db Name='SHPOG1'
        Activation ID=799229341=0x2fa3459d
        Control Seq=1934=0x78e, File size=102400=0x19000
        File Number=5, Blksiz=512, File Type=2 LOG

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章