使用rman恢复备份集到不同的主机上

系统 1823 0

当然恢复很可能是恢复到同一台主机。

一般情况应该是相同的主机目录,但是如果不同在ORACLE10g以前需要通过dbms_backup_restore这个包来实现目录转换,10g以后简化了处理。Rman可以很容易实现不同主机恢复。

测试如下:

1、首先对源数据库做备份

RMAN> backup database plus archivelog;

Starting backup at 29-AUG-14

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=145 devtype=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: sid=159 devtype=DISK

skipping archive log file /opt/oracle/flash_recovery_area1/ORCLA/archivelog/2014_08_28/o1_mf_1_12_9zwkvlg7_.arc; already backed up 1 time(s)

skipping archive log file /opt/oracle/flash_recovery_area1/ORCLA/archivelog/2014_08_28/o1_mf_1_2_9zwkvldo_.arc; already backed up 1 time(s)

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=1 recid=119 stamp=856761071

input archive log thread=1 sequence=2 recid=120 stamp=856761108

input archive log thread=1 sequence=3 recid=121 stamp=856761695

input archive log thread=1 sequence=4 recid=122 stamp=856821623

input archive log thread=1 sequence=5 recid=123 stamp=856843256

channel ORA_DISK_1: starting piece 1 at 29-AUG-14

channel ORA_DISK_2: starting archive log backupset

channel ORA_DISK_2: specifying archive log(s) in backup set

input archive log thread=1 sequence=6 recid=124 stamp=856843491

input archive log thread=1 sequence=7 recid=125 stamp=856844141

input archive log thread=1 sequence=8 recid=126 stamp=856889040

channel ORA_DISK_2: starting piece 1 at 29-AUG-14

channel ORA_DISK_2: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_annnn_TAG20140829T164401_b00hbm6j_.bkp tag=TAG20140829T164401 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:04

channel ORA_DISK_1: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_annnn_TAG20140829T164401_b00hbm62_.bkp tag=TAG20140829T164401 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05

channel ORA_DISK_2: starting archive log backupset

channel ORA_DISK_2: specifying archive log(s) in backup set

input archive log thread=1 sequence=3 recid=105 stamp=856758409

input archive log thread=1 sequence=4 recid=106 stamp=856758474

input archive log thread=1 sequence=5 recid=107 stamp=856758481

input archive log thread=1 sequence=6 recid=108 stamp=856758534

channel ORA_DISK_2: starting piece 1 at 29-AUG-14

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=1 recid=109 stamp=856759449

input archive log thread=1 sequence=2 recid=110 stamp=856759476

channel ORA_DISK_1: starting piece 1 at 29-AUG-14

channel ORA_DISK_1: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_annnn_TAG20140829T164401_b00hbqg8_.bkp tag=TAG20140829T164401 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_2: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_annnn_TAG20140829T164401_b00hbqfs_.bkp tag=TAG20140829T164401 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02

Finished backup at 29-AUG-14

Starting backup at 29-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

skipping datafile 6; already backed up 6 time(s)

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=/opt/oracle/oradata/orcla/system01.dbf

input datafile fno=00004 name=/opt/oracle/oradata/orcla/users01.dbf

input datafile fno=00003 name=/opt/oracle/oradata/orcla/sysaux01.dbf

channel ORA_DISK_1: starting piece 1 at 29-AUG-14

channel ORA_DISK_2: starting full datafile backupset

channel ORA_DISK_2: specifying datafile(s) in backupset

input datafile fno=00005 name=/opt/oracle/oradata/orcla/xzsp.dbf

input datafile fno=00002 name=/opt/oracle/oradata/orcla/undotbs01.dbf

channel ORA_DISK_2: starting piece 1 at 29-AUG-14

channel ORA_DISK_2: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp tag=TAG20140829T164408 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:46

channel ORA_DISK_1: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp tag=TAG20140829T164408 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:53

Finished backup at 29-AUG-14

Starting backup at 29-AUG-14

current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

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=9 recid=127 stamp=856889101

channel ORA_DISK_1: starting piece 1 at 29-AUG-14

channel ORA_DISK_1: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp tag=TAG20140829T164501 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 29-AUG-14

Starting Control File and SPFILE Autobackup at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/autobackup/2014_08_29/o1_mf_s_856889103_b00hdj4k_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 29-AUG-14

备份控制文件

RMAN> backup current controlfile;

Starting backup at 29-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current control file in backupset

channel ORA_DISK_1: starting piece 1 at 29-AUG-14

channel ORA_DISK_1: finished piece 1 at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/backupset/2014_08_29/o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp tag=TAG20140829T164642 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 29-AUG-14

Starting Control File and SPFILE Autobackup at 29-AUG-14

piece handle=/opt/oracle/flash_recovery_area1/ORCLA/autobackup/2014_08_29/o1_mf_s_856889203_b00hhmdv_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 29-AUG-14

3、将备份文件拷贝至/home/oracle/backup,并生成pfile

scp * oracle@172.16.1.18:/home/oracle/backup

oracle@172.16.1.18's password:

o1_mf_annnn_TAG20140829T164401_b00hbm62_.bkp 100% 58MB 14.5MB/s 00:04

o1_mf_annnn_TAG20140829T164401_b00hbm6j_.bkp 100% 31MB 15.6MB/s 00:02

o1_mf_annnn_TAG20140829T164401_b00hbqfs_.bkp 100% 3451KB 3.4MB/s 00:00

o1_mf_annnn_TAG20140829T164401_b00hbqg8_.bkp 100% 2578KB 2.5MB/s 00:00

o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp 100% 50KB 50.0KB/s 00:00

o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp 100% 7392KB 7.2MB/s 00:00

o1_mf_nnndf_TAG20140829T032828_9zz0px5v_.bkp 100% 683MB 15.9MB/s 00:43

o1_mf_nnndf_TAG20140829T032828_9zz0px68_.bkp 100% 417MB 16.0MB/s 00:26

o1_mf_nnndf_TAG20140829T050239_9zz67hd7_.bkp 100% 87MB 14.6MB/s 00:06

o1_mf_nnndf_TAG20140829T050239_9zz67hft_.bkp 100% 37MB 18.7MB/s 00:02

o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp 100% 683MB 15.5MB/s 00:44

o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp 100% 417MB 14.9MB/s 00:28

4、根据主机目录编辑pfile,修改如下

orcla.__db_cache_size=314572800

orcla.__java_pool_size=8388608

orcla.__large_pool_size=4194304

orcla.__shared_pool_size=260046848

orcla.__streams_pool_size=4194304

*.audit_file_dest='/opt/oracle/admin/orcla/adump'

*.background_dump_dest='/opt/oracle/admin/orcla/bdump'

*.compatible='10.2.0.1.0'

*.control_file_record_keep_time=10

*.control_files='/opt/oracle/oradata/orcl/control01.ctl','/opt/oracle/oradata/or

cl/control02.ctl','/opt/oracle/oradata/orcl/control03.ctl'#Restore Controlfile

*.core_dump_dest='/opt/oracle/admin/orcla/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcla'

*.db_recovery_file_dest_size=10737418240

*.db_recovery_file_dest='/opt/oracle/flash_recovery_area'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclaXDB)'

*.job_queue_processes=10

*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST'

*.log_archive_format='archive_%t_%s_%r.log'

*.open_cursors=300

*.pga_aggregate_target=199229440

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=599785472

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/orcla/udump'

这里为了测试方便修改了controlfile的目录,

5、在目标主机上新建相应的目录,主要是dump 文件夹,db_recovery_file_dest,controlfile等目录

6、建立orapwd文件

orapwd file=orapworcla password=oracle entries=5

7、启动实例

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup pfile=/home/oracle/initora.ora nomount

ORACLE instance started.

Total System Global Area 599785472 bytes

Fixed Size 2022600 bytes

Variable Size 276824888 bytes

Database Buffers 314572800 bytes

Redo Buffers 6365184 bytes

8、恢复控制文件

RMAN> restore controlfile to '/opt/oracle/oradata/orcl/control01.ctl' from '/home/oracle/backup/o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp';

这里恢复不能同时恢复所有的控制文件,只能恢复一个。

Starting restore at 29-AUG-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: restoring control file

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 08/29/2014 17:38:25

ORA-19870: error reading backup piece /home/oracle/backup/o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp

ORA-19913: unable to decrypt backup

ORA-28365: wallet is not open

源库是有加密的,所以也需要在目标库配置加密,具体参看 《rman备份加密》

这里发现恢复的时候还是提示是不能解密,异机上使用加密的备份,需要首先把源数据库的密钥wallet下,拷贝至目标数据库。然后在目标数据库上打开wallet。则恢复就会自动解密。

9、数据库为加载模式

Alter database mount

这里提示找不到control02.ctl。shutdown数据库,然后拷贝上面恢复的control01.ctl, 为control02.ctl, control03.ctl

10、加载备份集

RMAN> catalog start with '/home/oracle/backup';

Starting implicit crosscheck backup at 30-AUG-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: sid=155 devtype=DISK

Crosschecked 54 objects

Finished implicit crosscheck backup at 30-AUG-14

Starting implicit crosscheck copy at 30-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

Crosschecked 2 objects

Finished implicit crosscheck copy at 30-AUG-14

searching for all files in the recovery area

cataloging files...

no files cataloged

searching for all files that match the pattern /home/oracle/backup

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T032828_9zz0px5v_.bkp

File Name: /home/oracle/backup/o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbqg8_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T050239_9zz67hd7_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T050239_9zz67hft_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbm62_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbqfs_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbm6j_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T032828_9zz0px68_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T032828_9zz0px5v_.bkp

File Name: /home/oracle/backup/o1_mf_ncnnf_TAG20140829T164642_b00hhl8g_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbqg8_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T050239_9zz67hd7_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T050239_9zz67hft_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbm62_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbqfs_.bkp

File Name: /home/oracle/backup/o1_mf_annnn_TAG20140829T164401_b00hbm6j_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T032828_9zz0px68_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp

File Name: /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp

RMAN> report schema;

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA

Report of database schema

List of Permanent Datafiles

===========================

File Size(MB) Tablespace RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1 0 SYSTEM *** /opt/oracle/oradata/orcla/system01.dbf

2 0 UNDOTBS1 *** /opt/oracle/oradata/orcla/undotbs01.dbf

3 0 SYSAUX *** /opt/oracle/oradata/orcla/sysaux01.dbf

4 0 USERS *** /opt/oracle/oradata/orcla/users01.dbf

5 0 XZSP *** /opt/oracle/oradata/orcla/xzsp.dbf

6 0 B1 *** /home/oracle/b101.dbf

List of Temporary Files

=======================

File Size(MB) Tablespace Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1 0 TEMP 32767 /opt/oracle/oradata/orcla/temp01.dbf

2 0 TEST_TEMP 2048 /home/oracle/test_test01.dbf

11、编写恢复脚本执行恢复

run{

set newname for datafile 1 to '/opt/oracle/oradata/orcl/system01.dbf';

set newname for datafile 2 to '/opt/oracle/oradata/orcl/undotbs01.dbf';

set newname for datafile 3 to '/opt/oracle/oradata/orcl/sysaux01.dbf';

set newname for datafile 4 to '/opt/oracle/oradata/orcl/users01.dbf';

set newname for datafile 5 to '/opt/oracle/oradata/orcl/xzsp.dbf';

set newname for datafile 6 to '/opt/oracle/oradata/orcl/b101.dbf';

restore database;

switch datafile all;

}

RMAN> run{

2> set newname for datafile 1 to '/opt/oracle/oradata/orcl/system01.dbf';

3> set newname for datafile 2 to '/opt/oracle/oradata/orcl/undotbs01.dbf';

4> set newname for datafile 3 to '/opt/oracle/oradata/orcl/sysaux01.dbf';

5> set newname for datafile 4 to '/opt/oracle/oradata/orcl/users01.dbf';

6> set newname for datafile 5 to '/opt/oracle/oradata/orcl/xzsp.dbf';

7> set newname for datafile 6 to '/opt/oracle/oradata/orcl/b101.dbf';

8> restore database;

switch datafile all;

9> 10> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

datafile 6 not processed because file is read-only

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /opt/oracle/oradata/orcl/undotbs01.dbf

restoring datafile 00005 to /opt/oracle/oradata/orcl/xzsp.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp

channel ORA_DISK_2: starting datafile backupset restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /opt/oracle/oradata/orcl/system01.dbf

restoring datafile 00003 to /opt/oracle/oradata/orcl/sysaux01.dbf

restoring datafile 00004 to /opt/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_2: reading from backup piece /home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbsho_.bkp tag=TAG20140829T164408

channel ORA_DISK_1: restore complete, elapsed time: 00:00:45

channel ORA_DISK_2: restored backup piece 1

piece handle=/home/oracle/backup/o1_mf_nnndf_TAG20140829T164408_b00hbs0m_.bkp tag=TAG20140829T164408

channel ORA_DISK_2: restore complete, elapsed time: 00:00:45

Finished restore at 30-AUG-14

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of switch command at 08/30/2014 02:59:10

RMAN-20230: datafile copy not found in the recovery catalog

RMAN-06015: error while looking up datafile copy name: /opt/oracle/oradata/orcl/b101.dbf

因为datafile 6 是在offline,所以如下设置:

RMAN> run{

2> set newname for datafile 1 to '/opt/oracle/oradata/orcl/system01.dbf';

3> set newname for datafile 2 to '/opt/oracle/oradata/orcl/undotbs01.dbf';

set newname for datafile 3 to '/opt/oracle/oradata/orcl/sysaux01.dbf';

4> 5> set newname for datafile 4 to '/opt/oracle/oradata/orcl/users01.dbf';

6> set newname for datafile 5 to '/opt/oracle/oradata/orcl/xzsp.dbf';

7> restore database;

8> switch datafile all;

9> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

datafile 6 not processed because file is read-only

datafile 1 is already restored to file /opt/oracle/oradata/orcl/system01.dbf

datafile 2 is already restored to file /opt/oracle/oradata/orcl/undotbs01.dbf

datafile 3 is already restored to file /opt/oracle/oradata/orcl/sysaux01.dbf

datafile 4 is already restored to file /opt/oracle/oradata/orcl/users01.dbf

datafile 5 is already restored to file /opt/oracle/oradata/orcl/xzsp.dbf

restore not done; all files readonly, offline, or already restored

Finished restore at 30-AUG-14

datafile 1 switched to datafile copy

input datafile copy recid=83 stamp=856926716 filename=/opt/oracle/oradata/orcl/system01.dbf

datafile 2 switched to datafile copy

input datafile copy recid=84 stamp=856926716 filename=/opt/oracle/oradata/orcl/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy recid=85 stamp=856926716 filename=/opt/oracle/oradata/orcl/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy recid=86 stamp=856926716 filename=/opt/oracle/oradata/orcl/users01.dbf

datafile 5 switched to datafile copy

input datafile copy recid=87 stamp=856926716 filename=/opt/oracle/oradata/orcl/xzsp.dbf

12、应用归档日志

RMAN> recover database;

Starting recover at 30-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

datafile 6 not processed because file is read-only

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=9

channel ORA_DISK_1: reading from backup piece /home/oracle/backup/o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/home/oracle/backup/o1_mf_annnn_TAG20140829T164501_b00hdgoy_.bkp tag=TAG20140829T164501

channel ORA_DISK_1: restore complete, elapsed time: 00:00:02

archive log filename=/opt/oracle/flash_recovery_area/ORCLA/archivelog/2014_08_30/o1_mf_1_9_b01n5ggm_.arc thread=1 sequence=9

channel default: deleting archive log(s)

archive log filename=/opt/oracle/flash_recovery_area/ORCLA/archivelog/2014_08_30/o1_mf_1_9_b01n5ggm_.arc recid=128 stamp=856926766

unable to find archive log

archive log thread=1 sequence=10

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 08/30/2014 03:12:49

RMAN-06054: media recovery requesting unknown log: thread 1 seq 10 lowscn 2289640

13、打开数据库

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 08/30/2014 03:17:17

ORA-01157: cannot identify/lock data file 6 - see DBWR trace file

ORA-01110: data file 6: '/home/oracle/b101.dbf'

解决如下SQL> alter database datafile 6 offline drop;

Database altered.:

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00344: unable to re-create online log

'/opt/oracle/oradata/orcla/redo01.log'

ORA-27040: file create error, unable to create file

Linux-x86_64 Error: 2: No such file or directory

看来前面的启动参数有问题,重新调整

alter database rename file '/opt/oracle/oradata/orcla/redo01.log' to '/opt/oracle/oradata/orcl/redo01.log';

alter database rename file '/opt/oracle/oradata/orcla/redo02.log' to '/opt/oracle/oradata/orcl/redo02.log';

alter database rename file '/opt/oracle/oradata/orcla/redo03.log' to '/opt/oracle/oradata/orcl/redo03.log';

SQL> alter database open resetlogs;

Database altered.

14、现在需要处理临时表空间。

SQL> select name from v$tempfile;

NAME

--------------------------------------------------------------------------------

/opt/oracle/oradata/orcla/temp01.dbf

/home/oracle/test_test01.dbf

/opt/oracle/oradata/orcl/temp01.dbf

SQL> alter tablespace temp add tempfile '//opt/oracle/oradata/orcl/temp01.dbf' size 128m;

SQL> alter tablespace temp drop tempfile '/opt/oracle/oradata/orcla/temp01.dbf';

查看临时表空间 (dba_temp_files视图)(v_$tempfile视图)

select tablespace_name,file_name,bytes/1024/1024 file_size,autoextensible from dba_temp_files;

select status,enabled, name, bytes/1024删除临时表空间

删除临时表空间的一个数据文件:

SQL> alter database tempfile '/u01/app/oracle/oradata/orcl/temp02.dbf' drop;

删除临时表空间(彻底删除):

SQL> drop tablespace temp1 including contents and datafiles cascade constraints;/1024 file_size from v_$tempfile;--sys用户查看

SQL> drop tablespace test_temp including contents and datafiles;

Tablespace dropped.

使用rman恢复备份集到不同的主机上


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论