备份
直接拷贝oracle目录下的admin、oradata(datafile, controlfile,redo)、flash_recovery_area三个文件夹,db_1目录下database(PWDfile、pfile)、dbs(spfile)、NETWORK/ADMIN(listener.ora、tnsnames.ora),到其他存储实现备份。
恢复
方法一:最简单的方法(需建库)
1.创建一个和原来一样的数据库。(安装路径和数据库名必须和原来一致)
2.停止数据库 shutdown immediate;
3. 复制安装目录下的admin、oradata、flash_recovery_area覆盖,复制database(PWDfile、pfile) 覆盖
4. 启动数据库 startup;
方法二:(不需建库,稍麻烦点)
(1):操作系统重装,如果做冷备恢复,要保证相同操作系统,相同的数据库版本。
(2):正常安装oracle软件,只需要安装软件,不用建实例。
(3):数据覆盖,包括
数据文件、select * from V$DATAFILE
参数文件、select * from V$PARAMETER where name like '%spfile%'
控制文件、select * from V$CONTROLFILE
日志文件、select * from V$LOGFILE
pwd文件,select * from V$PARAMETER where name like '%spfile%'
放在与原系统相同的目录。如果目录有所改变,则需要另外建立控制文件,修改pfile。
(4):建立服务:使用oradim 命令 cmd下 oradim -new -sid gbicc ,表示建立一个服务,sid为gbicc。如果是在linux下,不需要此步。
(5):建立监听: net configuration assintant 来建立(建议将源系统的network下的文件拷过来,根据实际情况修改)。
(6):打开数据库: cmd
set oracle_sid=gbicc;
sqlplus /nolog;
Conn / as sysdba;
startup;
至此,冷备份恢复成功。
原库不停机直接制会出现如下问题
--
[oracle@zhuxg ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed May 1 11:28:49 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 276197376 bytes
Fixed Size 1344400 bytes
Variable Size 171969648 bytes
Database Buffers 96468992 bytes
Redo Buffers 6414336 bytes
Database mounted.
ORA-00600: internal error code, arguments: [kcratr_scan_lastbwr], [], [], [],[], [], [], [], [], [], [], []
在alert日志中有如下报错信息:
Wed May 01 08:21:09 2013
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 2
:
Aborting crash recovery due to error 600
Errors in file /u01/app/oracle/diag/rdbms/asmdb/ASMDB/trace/ASMDB_ora_5210.trc:
ORA-00600: internal error code, arguments: [kcratr_scan_lastbwr], [], [], [], [], [], [], [], [], [], [], []
Errors in file /u01/app/oracle/diag/rdbms/asmdb/ASMDB/trace/ASMDB_ora_5210.trc:
ORA-00600: internal error code, arguments: [kcratr_scan_lastbwr], [], [], [], [], [], [], [], [], [], [], []
ORA-600 signalled during: ALTER DATABASE OPEN /* db agent *//* {0:0:2} */...
在ASMDB_ora_5210.trc文件中有如下的信息:
..................
17755E0 03C10222 096F780B 36380113 6029D938 ["....xo...868.)`]
17755F0 D843E0FF 7CAA8000 02C1B000 88DC0248 [..C....|....H...]
Reading datafile '+ZHUXGASM/asmdb/datafile/undotbs1.258.813246367' for corruption at rdba: 0x00c00858 (file 3, block 2136)
Reread (file 3, block 2136) found same corrupt data (logically corrupt)
******** WRITE VERIFICATION FAILED ********
由此我们知道是因为数据库宕机之后,出现了逻辑坏块(logically corrupt),因此需要进行介质恢复。
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 276197376 bytes
Fixed Size 1344400 bytes
Variable Size 171969648 bytes
Database Buffers 96468992 bytes
Redo Buffers 6414336 bytes
Database mounted.
SQL>recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
介质恢复之后,再打开数据库就好了。