用rman备份归档日志 OS: redhat linux 4 u2 ORACLE : oracle10g r2 查看数据库归档方式 [oracle@catalog ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 5 16:55:15 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 33 Current log sequence 35 SQL> exit 修改数据库为归档,即archive log mode 首先关闭数据库,然后启动到mount状态,然后修改归档方式 [oracle@catalog ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 5 17:00:48 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 239075328 bytes Fixed Size 1218724 bytes Variable Size 184551260 bytes Database Buffers 50331648 bytes Redo Buffers 2973696 bytes Database mounted. SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 33 Next log sequence to archive 35 Current log sequence 35 SQL> SQL> 再创建一个表,模拟现网 [oracle@catalog ~]$ sqlplus system/sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 5 17:03:46 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> create table sxit.cc as select * from dba_objects; Table created. SQL> insert into sxit.cc select * from dba_objects; 11526 rows created. SQL> / 11526 rows created. SQL> / 11526 rows created. SQL> / 11526 rows created. SQL> / 11525 rows created. SQL> / 11525 rows created. SQL> / 11525 rows created. SQL> SQL> / 11525 rows created. SQL> / 11525 rows created. SQL> / 11525 rows created. SQL> commit; SQL> select count(*) from sxit.cc; COUNT(*) ---------- 184405 SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> select count(*) from sxit.cc; COUNT(*) ---------- 195930 SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> alter system switch logfile; System altered. SQL> select count(*) from sxit.cc; COUNT(*) ---------- 218980 SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> alter system switch logfile; 在不停的插入新的数据的同时,切换日志组,使产生归档日志 SQL> alter system switch logfile; System altered. SQL> System altered. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> select count(*) from sxit.cc; COUNT(*) ---------- 265080 SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> insert into sxit.cc select * from dba_objects; 11525 rows created. SQL> commit; Commit complete. SQL> alter system switch logfile; 多插入几次数据,并多次切换日志组 通过该视图可以看到日志切换情况 select * from v$log 然后查看产生的归档日志 [oracle@catalog 2011_07_05]$ ls -rctl total 29628 -rw-r----- 1 oracle dba 22858752 Jul 5 17:14 o1_mf_1_35_715oh6h2_.arc -rw-r----- 1 oracle dba 1024 Jul 5 17:14 o1_mf_1_36_715ohw2g_.arc -rw-r----- 1 oracle dba 2465792 Jul 5 17:15 o1_mf_1_37_715ojvl6_.arc -rw-r----- 1 oracle dba 2467840 Jul 5 17:15 o1_mf_1_38_715ol2mk_.arc -rw-r----- 1 oracle dba 2475008 Jul 5 17:17 o1_mf_1_39_715ooy64_.arc [oracle@catalog 2011_07_05]$ date Tue Jul 5 17:20:42 CST 2011 [oracle@catalog 2011_07_05]$ pwd /home/oracle/flash_recovery_area/ORA10HHA/archivelog/2011_07_05 oracle 10g库中默认采用闪回区作为归档日志保存路径 用rman工具登录,并执行归档日志备份 [oracle@catalog ~]$ export PATH=$ORACLE_HOME/binATH:. [oracle@catalog ~]$ rman target / nocatalog Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jul 5 17:21:56 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: ORA10HHA (DBID=3339398398) using target database control file instead of recovery catalog RMAN> LIST BACKUP OF ARCHIVELOG ALL; RMAN> BACKUP ARCHIVELOG ALL; Starting backup at 05-JUL-11 current log archived allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=139 devtype=DISK channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=35 recid=1 stamp=755716456 input archive log thread=1 sequence=36 recid=2 stamp=755716476 input archive log thread=1 sequence=37 recid=3 stamp=755716507 input archive log thread=1 sequence=38 recid=4 stamp=755716546 input archive log thread=1 sequence=39 recid=5 stamp=755716670 input archive log thread=1 sequence=40 recid=6 stamp=755716973 channel ORA_DISK_1: starting piece 1 at 05-JUL-11 channel ORA_DISK_1: finished piece 1 at 05-JUL-11 piece handle=/home/oracle/flash_recovery_area/ORA10HHA/backupset/2011_07_05/o1_mf_annnn_TAG20110705T172253_715ozhj1_.bkp tag=TAG20110705T172253 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04 Finished backup at 05-JUL-11 用rman执行完归档日志备份以后,就可以查看到 归档日志备份集 [oracle@catalog 2011_07_05]$ ls -rctl total 29884 -rw-r----- 1 oracle dba 30559744 Jul 5 17:22 o1_mf_annnn_TAG20110705T172253_715ozhj1_.bkp [oracle@catalog 2011_07_05]$ pwd /home/oracle/flash_recovery_area/ORA10HHA/backupset/2011_07_05 [oracle@catalog 2011_07_05]$ |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24862808/viewspace-717494/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24862808/viewspace-717494/