當然恢復很可能是恢復到同一臺主機。
一般情況應該是相同的主機目錄,但是如果不同在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.
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
