linux异机拷贝,rman恢复异机数据库
2,利用scp拷貝到異機
[oracle@db101 ab]$ ls
liu0stl8tun_1_1?liu0ttl8u58_1_1
[oracle@db101 ab]$ scp *
oracle@192.168.3.3:/home/oracle/ab/
oracle@192.168.3.3's password:
liu0stl8tun_1_1?100%
2144MB?12.1MB/s?02:57
liu0ttl8u58_1_1?100%
7264KB?7.1MB/s?00:
3,異機關庫并設置為主庫的數據庫id即dbid
rman>set dbid 85555655666(主庫的id號)
4,需要拷貝主庫的參數文件到異機庫
[oracle@db101 dbs]$ scp initecom.ora
oracle@192.168.3.3:/oracle/app/oracle/product/10.2.0/db_1/dbs/
oracle@192.168.3.3's password:
initecom.ora?100%?960?0.9KB/s?00:00
5,異機庫啟動到nomount狀態
rman>startup nomunt
6,利用主庫的備份文件恢復控制文件
RMAN> restore controlfile from
'/home/oracle/ab/liu0ttl8u58_1_1';
Starting restore at 20-DEC-18
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
channel ORA_DISK_1: restore complete, elapsed time:
00:00:04
output filename=/oracle/app/oradata/ecom/control01.ctl
output filename=/oracle/app/oradata/ecom/control02.ctl
output filename=/oracle/app/oradata/ecom/control03.ctl
Finished restore at 20-DEC-18
RMAN> restore
database;
Starting restore at 20-DEC-18
using channel ORA_DISK_1
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================
RMAN-03002: failure of restore command at 12/20/2018
21:10:47
ORA-01507: database not
mounted
說明restore命令需要在mount之后次可以執行
7,數據庫啟動到mount狀態
RMAN> startup mount
database is already started
database mounted
released channel: ORA_DISK_1
8,修復數據
RMAN> restore database;
Starting restore at 20-DEC-18
Starting implicit crosscheck backup at 20-DEC-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 22 objects
Finished implicit crosscheck backup at 20-DEC-18
Starting implicit crosscheck copy at 20-DEC-18
using channel ORA_DISK_1
Finished implicit crosscheck copy at 20-DEC-18
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from
backup set
restoring datafile 00001 to
/oracle/app/oradata/ecom/system01.dbf
restoring datafile 00002 to
/oracle/app/oradata/ecom/undotbs01.dbf
restoring datafile 00003 to
/oracle/app/oradata/ecom/sysaux01.dbf
restoring datafile 00004 to
/oracle/app/oradata/ecom/users01.dbf
restoring datafile 00005 to
/oracle/app/oradata/ecom/dd01.dbf
restoring datafile 00006 to
/oracle/app/oradata/ecom/liu.dbf
channel ORA_DISK_1: reading from backup piece
/home/oracle/ab/liu0stl8tun_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/ab/liu0stl8tun_1_1
tag=TAG20181220T173727
channel ORA_DISK_1: restore complete, elapsed time:
00:04:11
Finished restore at 20-DEC-18
9,恢復數據庫
RMAN> recover database;
Starting recover at 20-DEC-18
using channel ORA_DISK_1
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================
RMAN-03002: failure of recover command at 12/20/2018
21:18:00
ORA-19698:
/oracle/app/oradata/ecom/redo01.log is from different database:
id=3675719757, db_name=ECOM
說明數據庫的dbid不一樣,無法恢復,需要提前設置,倘若忘記設置,以下可以關庫在重新設置
RMAN> set dbid 3676077492
executing command: SET DBID
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================
RMAN-03002: failure of CSET command at 12/20/2018
21:19:53
RMAN-06188: cannot use command when connected to a mounted
target database
RMAN> shutdown immediate
database dismounted
Oracle instance shut down
RMAN> set dbid 3676077492
executing command: SET DBID
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area?285212672 bytes
Fixed Size?1218992
bytes
Variable Size?75499088 bytes
Database Buffers?205520896 bytes
Redo Buffers?2973696 bytes
RMAN> recover database;
Starting recover at 20-DEC-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
RMAN-00571:
===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
===============
RMAN-00571:
===========================================================
RMAN-03002: failure of recover command at 12/20/2018
21:21:31
ORA-19698: /oracle/app/oradata/ecom/redo01.log is from
different database: id=3675719757, db_name=ECOM
說明數據庫的日志不一致,需要拷貝主庫的當前日志過來(我這里是rman全備份后,沒有歸檔可以只拷貝當前日志,倘若你有過歸檔需要你把歸檔和當前日志組一起拷貝過來)
----還是出現這個錯誤,從錯誤里可以看到兩個錯誤點一是日志不同,而是數據庫dbid不同,需要把這兩處都修改一致才可以recover
10,copy主庫的日志(或歸檔+當前)到異機庫
scp *.log
oracle@192.168.3.3:/oracle/app/oradata/ecom/
11,恢復數據庫
RMAN> recover database;
Starting recover at 20-DEC-18
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 46 is already on disk as file
/oracle/app/oradata/ecom/redo03.log
archive log filename=/oracle/app/oradata/ecom/redo03.log
thread=1 sequence=46
media recovery complete, elapsed time: 00:00:03
Finished recover at 20-DEC-18
12,修改數據庫以resetlogs方式開啟數據庫
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for
database open
SQL> alter database open noresetlogs;
alter database open noresetlogs
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.----成功開啟數據庫
總結
以上是生活随笔為你收集整理的linux异机拷贝,rman恢复异机数据库的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux代码签名,浅谈Linux容器和
- 下一篇: linux处理机调度实验报告,处理机调度