标签:oba dba home bho identify start rom buffer read
手工热备必须在归档模式下进行,只读表空间不能做热备,临时表空间不需要做热备。SYS@PROD> archive log list;——开启了归档
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SYS@PROD>
SYS@PROD> create table t8(id number) tablespace users;——创建表并插入数据提交
Table created.
SYS@PROD> insert into t8 values(88);
1 row created.
SYS@PROD> commit;
Commit complete.
SYS@PROD> select * from t8;
ID
----------
88
SYS@PROD> alter tablespace users begin backup;——开始热备users表空间
Tablespace altered.
[oracle@enmoedu1 ~]$ cp users01.dbf /home/oracle/——备份用户表空间数据文件
SYS@PROD> alter tablespace users end backup; ——结束备份users表空间
Tablespace altered.
关闭数据库,删除users数据文件,然后再启动数据库
SYS@PROD> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
删除users数据文件
[oracle@enmoedu1 PROD]$ rm -rf users01.dbf
SYS@PROD> startup
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 536874064 bytes
Database Buffers 289406976 bytes
Redo Buffers 6565888 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: ‘/u01/app/oracle/oradata/PROD/users01.dbf‘——报错,找不到数据文件
拷贝备份好的users数据文件到数据库原目录
mv /home/oracle/users01.dbf /u01/app/oracle/oradata/PROD ——拷贝数据文件
SYS@PROD> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SYS@PROD> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: ‘/u01/app/oracle/oradata/PROD/users01.dbf‘
--------查询users数据文件的id为4-----------
select file_name,file_id,tablespace_name from dba_data_files where tablespace_name=‘USERS‘;
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ------------------------------
/u01/app/oracle/oradata/PROD/users01.dbf 4 USERS
SYS@PROD> recover datafile 4;——恢复数据文件4号
Media recovery complete.
SYS@PROD> alter database open;——打开数据文件
Database altered.
SYS@PROD> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SYS@PROD> select * from t8;
ID
----------
88
标签:oba dba home bho identify start rom buffer read
原文地址:http://blog.51cto.com/12185273/2064838