oracle 冷备
1备份完整的数据库 :数据库启动文件,控制文件,数据文件,日志文件
2查看实例和数据库想关信息(如果两个库版本不相同,数据还原后需要升级处理)
select instance_name,version,status,archiver,database_status from v$instance;
INSTANCE_NAME VERSION STATUS ARCHIVE DATABASE_STATUS
---------------- ----------------- ------------ ------- -----------------
orcl 10.2.0.1.0 OPEN STOPPED ACTIVE
3查看数据文件
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
4查看临时文件
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/temp01.dbf
5查看日志文件
SQL> select member from v$logfile;
MEMBER
------------------------------------------------------------
/u01/app/oracle/oradata/orcl/redo2a.rdo
/u01/app/oracle/oradata/orcl/redo2b.rdo
6查看控制文件
SQL> select name from v$controlfile;
NAME
------------------------------------------------------------
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl
8关闭数据库 ,将以上查出内容拷贝到还原库中。
数据还原
1创建主库pfile
create spfile from pfile; 对应pfile 文件放置控制文件位置和名字。$ORACLE_HOME/dbs
2启动数据到mount状态下
Startup mount
3查看数据文件和日志文件
select member from v$logfile;
select name from v$datafile;
如果文件位置不正确
更改位置
alter database rename file '/oracle/oradata/orcl/sysaux01.dbf' to '/home/oradate/ORCL/datafile/sysaux01.dbf';
alter database rename file '/oracle/oradata/orcl/redo03.log' to '/home/oradate/ORCL/onlinelog/redo03.log';
启动数据库
alter database open;