原理:
和冷备一致性关闭数据库后拷贝数据库文件备份相反,是在数据库处于开启状态下做的备份。
备份方式:在sqlplus中手工发起备份;利用rman工具备份
手工备份:alter tablespace XXX begin backup;
操作系统层面拷贝数据文件到某个路径;
alter tablespace XXX end backup;
rman工具备份: backup tablespace XXX;
- 开启归档
点击(此处)折叠或打开
- SQL> archive log list;
- Database log mode No Archive Mode
- Automatic archival Disabled
- Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
- Oldest online log sequence 4
- Current log sequence 6
- SQL> shutdown immediate;
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> startup mount;
- ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
- ORACLE instance started.
-
- Total System Global Area 217157632 bytes
- Fixed Size 2251816 bytes
- Variable Size 159384536 bytes
- Database Buffers 50331648 bytes
- Redo Buffers 5189632 bytes
- Database mounted.
- SQL> alter database archivelog;
-
- Database altered.
-
- SQL> alter database open;
-
- Database altered.
- SQL> archive log list;
-
创建表空间
点击(此处)折叠或打开
- SQL> create tablespace test01 datafile '/u01/app/oracle/oradata/PROD1/test01.dbf' size 10M autoextend on maxsize 2G;
-
- Tablespace created.
- SQL> create tablespace test01 datafile '/u01/app/oracle/oradata/PROD1/test01.dbf' size 10M autoextend on maxsize 2G;
-
模拟业务
点击(此处)折叠或打开
- SQL> create table test tablespace test01 as select * from dba_objects;
-
- Table created.
- SQL> create table test tablespace test01 as select * from dba_objects;
-
热备表空间
点击(此处)折叠或打开
- alter tablespace test01 begin backup;
-
- Tablespace altered.
-
- SQL> !cp /u01/app/oracle/oradata/PROD1/test01.dbf /u01/app/oracle/oradata/PROD1/test01.dbf.bak
-
- SQL> alter tablespace test01 end backup;
-
- Tablespace altered.
- alter tablespace test01 begin backup;
-
模拟故障
点击(此处)折叠或打开
- !rm /u01/app/oracle/oradata/PROD1/test01.dbf
-
- SQL> shutdown immediate;
- ORA-03113: end-of-file on communication channel
- Process ID: 19295
- Session ID: 16 Serial number: 3
-
-
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup
- ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
- ORACLE instance started.
-
- Total System Global Area 217157632 bytes
- Fixed Size 2251816 bytes
- Variable Size 159384536 bytes
- Database Buffers 50331648 bytes
- Redo Buffers 5189632 bytes
- Database mounted.
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '/u01/app/oracle/oradata/PROD1/test01.dbf'
- !rm /u01/app/oracle/oradata/PROD1/test01.dbf
-
恢复(mount状态下)
点击(此处)折叠或打开
- SQL> !cp /u01/app/oracle/oradata/PROD1/test01.dbf.bak /u01/app/oracle/oradata/PROD1/test01.dbf
-
- SQL> recover datafile 6;
- Media recovery complete.
- SQL> alter database open;
- SQL> !cp /u01/app/oracle/oradata/PROD1/test01.dbf.bak /u01/app/oracle/oradata/PROD1/test01.dbf
- 验证
点击(此处)折叠或打开
- SQL> select count(*) from test;
-
- COUNT(*)
- ----------
- 86954
- SQL> select count(*) from test;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31405405/viewspace-2136670/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31405405/viewspace-2136670/