基于数据文件的rman建DG
前段时间,itpub上有朋友问“小弟仔细想了想发现一个问题:dataguard的空间不足以容下一份rman备份和数据文件.这样就只能停机做了吗??”。在主机空间不够的情况下,我们可以用rman一个数据文件一个数据文件的做dataguard。今天把基于数据文件的rman建datagurard操作了一下。主要步骤如下:
- 打开2边的listener,备份主库的system和undo表空间到备库做克隆。
- 在备库做其他数据文件的offline drop。
- ftp传arch到备库,并且recover standby database。做完后备库已经能够启动到recover managed。
- 用相同的方法,可分多次将数据文件备份、克隆。
- 待附加完所有的数据文件后,再recover standby database,打开备库到recover managed。
- 测试switchover。
以下是具体操作步骤(注:以下standby1主机是主库,standby2主机是备库):
1.打开2边的listener,备份主库的system和undo表空间到备库做克隆:
1.1 打开2边侦听。
1.2 我们建立一个for_test_standby表来测试是否正常迁移
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 15 22:06:52 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
test@ORADG(192.168.0.41)> create table for_test_standby (a varchar2(20));
Table created.
Elapsed: 00:00:00.25
test@ORADG(192.168.0.41)> drop table for_test_standby;
Table dropped.
Elapsed: 00:00:00.59
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)>
test@ORADG(192.168.0.41)> create table for_test_standby (a varchar2(20)) tablespace example;
Table created.
Elapsed: 00:00:00.04
test@ORADG(192.168.0.41)> insert into for_test_standby values('a');
1 row created.
Elapsed: 00:00:00.01
test@ORADG(192.168.0.41)> commit;
Commit complete.
Elapsed: 00:00:00.01
test@ORADG(192.168.0.41)> conn / as sysdba
Connected.
test@ORADG(192.168.0.41)> alter system checkpoint;
System altered.
Elapsed: 00:00:00.34
test@ORADG(192.168.0.41)> alter system switch logfile;
System altered.
Elapsed: 00:00:00.05
test@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.04
test@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.04
test@ORADG(192.168.0.41)> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
[oracle@standby1 rman]$
1.3 备份主库的system和undo表空间:
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
RMAN> run {
2> backup incremental level 0 tablespace system format '/oracle/rman/system_%u%p%s.rmn' include current controlfile for standby;
3> backup incremental level 0 tablespace UNDOTBS1 format '/oracle/rman/undotbs1_%u%p%s.rmn';
4> }
Starting backup at 15-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=17 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
including standby controlfile in backupset
input datafile fno=00001 name=/oracle/oradata/oradg/system01.dbf
channel ORA_DISK_1: starting piece 1 at 15-JAN-08
channel ORA_DISK_1: finished piece 1 at 15-JAN-08
piece handle=/oracle/rman/system_1aj68h8k142.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 15-JAN-08
Starting backup at 15-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00002 name=/oracle/oradata/oradg/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 15-JAN-08
channel ORA_DISK_1: finished piece 1 at 15-JAN-08
piece handle=/oracle/rman/undotbs1_1bj68h9d143.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 15-JAN-08
RMAN>
1.4 将备份集ftp到standby库,注意用bin模式传输:
total 516080
-rw-r----- 1 oracle dba 322510848 Jan 15 22:11 system_1aj68h8k142.rmn
-rw-r----- 1 oracle dba 205422592 Jan 15 22:12 undotbs1_1bj68h9d143.rmn
[oracle@standby1 rman]$ ftp standby2
Connected to standby2.
220 (vsFTPd 2.0.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (standby2:oracle): oracle
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /oracle/rman
250 Directory successfully changed.
ftp> bin
200 Switching to Binary mode.
ftp> put system_1aj68h8k142.rmn
local: system_1aj68h8k142.rmn remote: system_1aj68h8k142.rmn
227 Entering Passive Mode (192,168,0,42,89,242)
150 Ok to send data.
226 File receive OK.
322510848 bytes sent in 57 seconds (5.6e+03 Kbytes/s)
ftp>
ftp>
ftp>
ftp> put undotbs1_1bj68h9d143.rmn
local: undotbs1_1bj68h9d143.rmn remote: undotbs1_1bj68h9d143.rmn
227 Entering Passive Mode (192,168,0,42,245,142)
150 Ok to send data.
226 File receive OK.
205422592 bytes sent in 26 seconds (7.8e+03 Kbytes/s)
ftp>
ftp> ls -l
227 Entering Passive Mode (192,168,0,42,104,134)
150 Here comes the directory listing.
-rw-r--r-- 1 200 500 322510848 Jan 15 14:14 system_1aj68h8k142.rmn
-rw-r--r-- 1 200 500 205422592 Jan 15 14:14 undotbs1_1bj68h9d143.rmn
226 Directory send OK.
ftp> !ls -l
total 516080
-rw-r----- 1 oracle dba 322510848 Jan 15 22:11 system_1aj68h8k142.rmn
-rw-r----- 1 oracle dba 205422592 Jan 15 22:12 undotbs1_1bj68h9d143.rmn
ftp>
ftp>
ftp>
ftp> bye
221 Goodbye.
[oracle@standby1 rman]$
1.5 启动standby库到nomount
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 15 22:18:08 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 370218244 bytes
Fixed Size 451844 bytes
Variable Size 167772160 bytes
Database Buffers 201326592 bytes
Redo Buffers 667648 bytes
SQL>
SQL>
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
-------------------------------- ------------------------
oradg STARTED
SQL> !hostname
standby2
SQL>
1.6 克隆备库
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
connected to auxiliary database: oradg (not mounted)
RMAN> run{
2> restore clone standby controlfile to clone_cf;
3> replicate clone controlfile from clone_cf;
4> sql clone 'alter database mount standby database';
5> restore check readonly clone datafile 1,2;
6> }
Starting restore at 15-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=14 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
output filename=/oracle/oradata/oradg/control01.ctl
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/system_1aj68h8k142.rmn tag=TAG20080115T221131 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 15-JAN-08
replicating controlfile
input filename=/oracle/oradata/oradg/control01.ctl
output filename=/oracle/oradata/oradg/control02.ctl
output filename=/oracle/oradata/oradg/control03.ctl
sql statement: alter database mount standby database
Starting restore at 15-JAN-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/oradg/system01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/system_1aj68h8k142.rmn tag=TAG20080115T221131 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /oracle/oradata/oradg/undotbs01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/undotbs1_1bj68h9d143.rmn tag=TAG20080115T221157 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 15-JAN-08
RMAN> exit
Recovery Manager complete.
[oracle@standby1 rman]$
2.在备库做其他数据文件的offline drop:
2.1 可在primary上生成需要在standby做offline drop的语句:
2 where file_id not in (1,2);
'ALTERDATABASEDATAFILE'||''''||FILE_NAME||''''||'OFFLINEDROP;'
----------------------------------------------------------------------------------------------------
alter database datafile'/oracle/oradata/oradg/cwmlite01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/drsys01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/example01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/indx01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/odm01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/tools01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/users01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/xdb01.dbf' offline drop;
alter database datafile'/oracle/oradata/oradg/ts_mssm_01.dbf' offline drop;
9 rows selected.
Elapsed: 00:00:00.32
sys@ORADG(192.168.0.41)>
2.2 在standby上做offline drop(此时数据库已经mount):
STATUS
------------------------
MOUNTED
SQL> alter database datafile'/oracle/oradata/oradg/cwmlite01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/drsys01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/example01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/indx01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/odm01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/tools01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/users01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/xdb01.dbf' offline drop;
Database altered.
SQL> alter database datafile'/oracle/oradata/oradg/ts_mssm_01.dbf' offline drop;
Database altered.
SQL>
3.ftp传arch到备库,并且recover standby database。做完后备库已经能够启动到recover managed:
3.1 传arch到备库
[oracle@standby1 arch]$ ll
total 1620
-rw-r----- 1 oracle dba 357376 Jan 15 22:08 oradg_0001_0000000178.arc
-rw-r----- 1 oracle dba 1024 Jan 15 22:08 oradg_0001_0000000179.arc
-rw-r----- 1 oracle dba 1024 Jan 15 22:08 oradg_0001_0000000180.arc
-rw-r----- 1 oracle dba 1265664 Jan 15 22:41 oradg_0001_0000000181.arc
[oracle@standby1 arch]$ ftp standby2
Connected to standby2.
220 (vsFTPd 2.0.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (standby2:oracle): oracle
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /oracle/arch
250 Directory successfully changed.
ftp> bin
200 Switching to Binary mode.
ftp> promp
Interactive mode off.
ftp> mput *.arc
local: oradg_0001_0000000178.arc remote: oradg_0001_0000000178.arc
227 Entering Passive Mode (192,168,0,42,171,18)
150 Ok to send data.
226 File receive OK.
357376 bytes sent in 0.047 seconds (7.4e+03 Kbytes/s)
local: oradg_0001_0000000179.arc remote: oradg_0001_0000000179.arc
227 Entering Passive Mode (192,168,0,42,106,115)
150 Ok to send data.
226 File receive OK.
1024 bytes sent in 0.003 seconds (3.4e+02 Kbytes/s)
local: oradg_0001_0000000180.arc remote: oradg_0001_0000000180.arc
227 Entering Passive Mode (192,168,0,42,23,35)
150 Ok to send data.
226 File receive OK.
1024 bytes sent in 0.008 seconds (1.2e+02 Kbytes/s)
local: oradg_0001_0000000181.arc remote: oradg_0001_0000000181.arc
227 Entering Passive Mode (192,168,0,42,60,248)
150 Ok to send data.
226 File receive OK.
1265664 bytes sent in 0.069 seconds (1.8e+04 Kbytes/s)
ftp>
ftp> bye
221 Goodbye.
[oracle@standby1 arch]$
3.2 在standby库做recover standby。并且启动到recover managed:
total 1620
-rw-r--r-- 1 oracle dba 357376 Jan 15 22:58 oradg_0001_0000000178.arc
-rw-r--r-- 1 oracle dba 1024 Jan 15 22:58 oradg_0001_0000000179.arc
-rw-r--r-- 1 oracle dba 1024 Jan 15 22:58 oradg_0001_0000000180.arc
-rw-r--r-- 1 oracle dba 1265664 Jan 15 22:58 oradg_0001_0000000181.arc
[oracle@standby2 arch]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 15 22:58:45 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> recover standby database;
ORA-00279: change 613312 generated at 01/15/2008 22:08:15 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000181.arc
ORA-00280: change 613312 for thread 1 is in sequence #181
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/arch/oradg_0001_0000000181.arc
ORA-00279: change 636206 generated at 01/15/2008 22:41:24 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000182.arc
ORA-00280: change 636206 for thread 1 is in sequence #182
ORA-00278: log file '/oracle/arch/oradg_0001_0000000181.arc' no longer needed
for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/oracle/arch/oradg_0001_0000000182.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/oracle/arch/oradg_0001_0000000182.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL>
此时数据库已经能传递归档并且应用了,并且我们在测试表中insert一个数据,我们来看看:
total 1620
-rw-r----- 1 oracle dba 357376 Jan 15 22:08 oradg_0001_0000000178.arc
-rw-r----- 1 oracle dba 1024 Jan 15 22:08 oradg_0001_0000000179.arc
-rw-r----- 1 oracle dba 1024 Jan 15 22:08 oradg_0001_0000000180.arc
-rw-r----- 1 oracle dba 1265664 Jan 15 22:41 oradg_0001_0000000181.arc
[oracle@standby1 arch]$
[oracle@standby1 arch]$
[oracle@standby1 arch]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 15 23:04:46 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
sys@ORADG(192.168.0.41)> alter system checkpoint;
System altered.
Elapsed: 00:00:00.31
sys@ORADG(192.168.0.41)> select SEQUENCE#,APPLIED from v$archived_log where SEQUENCE#>=178;
SEQUENCE# APPLIE
---------- ------
178 NO
179 NO
180 NO
181 NO
Elapsed: 00:00:00.02
sys@ORADG(192.168.0.41)> alter system switch logfile;
System altered.
Elapsed: 00:00:00.06
……(执行若干次)
sys@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.05
sys@ORADG(192.168.0.41)> select SEQUENCE#,APPLIED from v$archived_log where SEQUENCE#>=178;
SEQUENCE# APPLIE
---------- ------
178 NO
179 NO
180 NO
181 NO
182 NO
……
198 NO
199 NO
199 YES
40 rows selected.
Elapsed: 00:00:00.02
sys@ORADG(192.168.0.41)>
sys@ORADG(192.168.0.41)> conn test/test
Connected.
sys@ORADG(192.168.0.41)> insert into for_test_standby values ('b');
1 row created.
Elapsed: 00:00:00.07
sys@ORADG(192.168.0.41)> commit;
Commit complete.
Elapsed: 00:00:00.00
sys@ORADG(192.168.0.41)> conn / as sysdba
Connected.
sys@ORADG(192.168.0.41)> alter system checkpoint;
System altered.
Elapsed: 00:00:00.06
sys@ORADG(192.168.0.41)> alter system switch logfile;
System altered.
Elapsed: 00:00:00.05
sys@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.26
……
sys@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.03
sys@ORADG(192.168.0.41)> select SEQUENCE#,APPLIED from v$archived_log where SEQUENCE#>=191;
SEQUENCE# APPLIE
---------- ------
191 NO
191 YES
192 NO
192 NO
……
211 NO
211 YES
212 NO
212 NO
SEQUENCE# APPLIE
---------- ------
213 NO
213 NO
214 NO
214 NO
215 NO
215 NO
50 rows selected.
Elapsed: 00:00:00.02
sys@ORADG(192.168.0.41)>
4.用相同的方法,可分多次将数据文件备份、克隆。
4.1 将standby至于nomount
4.2 在本例中,我们假设空间不够,需要分2次,将其他的数据文件做克隆到standby库。
4.2.1 备份primary:
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
connected to auxiliary database: oradg (not mounted)
RMAN> run{
2> backup incremental level 0 tablespace CWMLITE format '/oracle/rman/CWMLITE_%u%p%s.rmn' include current controlfile for standby;
3> backup incremental level 0 tablespace DRSYS format '/oracle/rman/DRSYS_%u%p%s.rmn';
4> backup incremental level 0 tablespace EXAMPLE format '/oracle/rman/EXAMPLE_%u%p%s.rmn';
5> }
Starting backup at 15-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=16 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=/oracle/oradata/oradg/cwmlite01.dbf
including standby controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 15-JAN-08
channel ORA_DISK_1: finished piece 1 at 15-JAN-08
piece handle=/oracle/rman/CWMLITE_1cj68mon144.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:13
Finished backup at 15-JAN-08
Starting backup at 15-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/oracle/oradata/oradg/drsys01.dbf
channel ORA_DISK_1: starting piece 1 at 15-JAN-08
channel ORA_DISK_1: finished piece 1 at 15-JAN-08
piece handle=/oracle/rman/DRSYS_1dj68mr0145.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-JAN-08
Starting backup at 15-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/oracle/oradata/oradg/example01.dbf
channel ORA_DISK_1: starting piece 1 at 15-JAN-08
channel ORA_DISK_1: finished piece 1 at 15-JAN-08
piece handle=/oracle/rman/EXAMPLE_1ej68mr1146.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 15-JAN-08
RMAN> exit
Recovery Manager complete.
[oracle@standby1 rman]$
4.2.2 ftp传到standby库
Connected to standby2.
220 (vsFTPd 2.0.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (standby2:oracle): oracle
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /oracle/rman
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,0,42,212,224)
150 Here comes the directory listing.
-rw-r--r-- 1 200 500 322510848 Jan 15 14:14 system_1aj68h8k142.rmn
-rw-r--r-- 1 200 500 205422592 Jan 15 14:14 undotbs1_1bj68h9d143.rmn
226 Directory send OK.
ftp>
ftp> bin
200 Switching to Binary mode.
ftp> put CWMLITE_1cj68mon144.rmn
local: CWMLITE_1cj68mon144.rmn remote: CWMLITE_1cj68mon144.rmn
227 Entering Passive Mode (192,168,0,42,46,30)
150 Ok to send data.
226 File receive OK.
10764288 bytes sent in 1.6 seconds (6.5e+03 Kbytes/s)
ftp>
ftp> put DRSYS_1dj68mr0145.rmn
local: DRSYS_1dj68mr0145.rmn remote: DRSYS_1dj68mr0145.rmn
227 Entering Passive Mode (192,168,0,42,211,255)
150 Ok to send data.
226 File receive OK.
5431296 bytes sent in 1.1 seconds (4.6e+03 Kbytes/s)
ftp>
ftp> put EXAMPLE_1ej68mr1146.rmn
local: EXAMPLE_1ej68mr1146.rmn remote: EXAMPLE_1ej68mr1146.rmn
227 Entering Passive Mode (192,168,0,42,226,195)
150 Ok to send data.
226 File receive OK.
245366784 bytes sent in 58 seconds (4.1e+03 Kbytes/s)
ftp>
ftp>
ftp> bye
221 Goodbye.
[oracle@standby1 rman]$
4.2.3 克隆到standby库
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
connected to auxiliary database: oradg (not mounted)
RMAN> run{
2> restore clone standby controlfile to clone_cf;
3> replicate clone controlfile from clone_cf;
4> sql clone 'alter database mount standby database';
5> restore check readonly clone datafile 3,4,5;
6> }
Starting restore at 15-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=15 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
output filename=/oracle/oradata/oradg/control01.ctl
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/CWMLITE_1cj68mon144.rmn tag=TAG20080115T234527 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 15-JAN-08
replicating controlfile
input filename=/oracle/oradata/oradg/control01.ctl
output filename=/oracle/oradata/oradg/control02.ctl
output filename=/oracle/oradata/oradg/control03.ctl
sql statement: alter database mount standby database
Starting restore at 15-JAN-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /oracle/oradata/oradg/cwmlite01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/CWMLITE_1cj68mon144.rmn tag=TAG20080115T234527 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /oracle/oradata/oradg/drsys01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/DRSYS_1dj68mr0145.rmn tag=TAG20080115T234640 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /oracle/oradata/oradg/example01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/EXAMPLE_1ej68mr1146.rmn tag=TAG20080115T234641 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 15-JAN-08
RMAN>
4.2.4 将standby库再次置于nomount(因此每次做clone的时候都会mount)。
4.2.5 备份剩余的数据文件:
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
RMAN> run{
2> backup incremental level 0 tablespace INDX format '/oracle/rman/INDX_%u%p%s.rmn' include current controlfile for standby;
3> backup incremental level 0 tablespace MSSM format '/oracle/rman/MSSM_%u%p%s.rmn';
4> backup incremental level 0 tablespace ODM format '/oracle/rman/ODM_%u%p%s.rmn';
5> backup incremental level 0 tablespace TOOLS format '/oracle/rman/TOOLS_%u%p%s.rmn';
6> backup incremental level 0 tablespace USERS format '/oracle/rman/USERS_%u%p%s.rmn';
7> backup incremental level 0 tablespace XDB format '/oracle/rman/XDB_%u%p%s.rmn';
8> }
Starting backup at 16-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=12 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oracle/oradata/oradg/indx01.dbf
including standby controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/INDX_1fj68nrm147.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 16-JAN-08
Starting backup at 16-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00011 name=/oracle/oradata/oradg/ts_mssm_01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/MSSM_1gj68nrq148.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 16-JAN-08
Starting backup at 16-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00007 name=/oracle/oradata/oradg/odm01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/ODM_1hj68ns1149.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-JAN-08
Starting backup at 16-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00008 name=/oracle/oradata/oradg/tools01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/TOOLS_1ij68ns2150.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-JAN-08
Starting backup at 16-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00009 name=/oracle/oradata/oradg/users01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/USERS_1jj68ns3151.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-JAN-08
Starting backup at 16-JAN-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00010 name=/oracle/oradata/oradg/xdb01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-08
channel ORA_DISK_1: finished piece 1 at 16-JAN-08
piece handle=/oracle/rman/XDB_1kj68ns4152.rmn comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 16-JAN-08
RMAN>
4.2.6 同理ftp传到standby
total 801272
-rw-r----- 1 oracle dba 322510848 Jan 15 22:11 system_1aj68h8k142.rmn
-rw-r----- 1 oracle dba 205422592 Jan 15 22:12 undotbs1_1bj68h9d143.rmn
-rw-r----- 1 oracle dba 10764288 Jan 15 23:46 CWMLITE_1cj68mon144.rmn
-rw-r----- 1 oracle dba 5431296 Jan 15 23:46 DRSYS_1dj68mr0145.rmn
-rw-r----- 1 oracle dba 245366784 Jan 15 23:47 EXAMPLE_1ej68mr1146.rmn
-rw-r----- 1 oracle dba 2416640 Jan 16 00:04 INDX_1fj68nrm147.rmn
-rw-r----- 1 oracle dba 204800 Jan 16 00:04 MSSM_1gj68nrq148.rmn
-rw-r----- 1 oracle dba 5898240 Jan 16 00:04 ODM_1hj68ns1149.rmn
-rw-r----- 1 oracle dba 98304 Jan 16 00:04 TOOLS_1ij68ns2150.rmn
-rw-r----- 1 oracle dba 106496 Jan 16 00:04 USERS_1jj68ns3151.rmn
-rw-r----- 1 oracle dba 21381120 Jan 16 00:04 XDB_1kj68ns4152.rmn
[oracle@standby1 rman]$ ftp standby2
Connected to standby2.
220 (vsFTPd 2.0.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (standby2:oracle): oracle
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /oracle/rman
250 Directory successfully changed.
ftp> bin
200 Switching to Binary mode.
ftp> put INDX_1fj68nrm147.rmn
local: INDX_1fj68nrm147.rmn remote: INDX_1fj68nrm147.rmn
227 Entering Passive Mode (192,168,0,42,225,214)
150 Ok to send data.
226 File receive OK.
2416640 bytes sent in 0.12 seconds (1.9e+04 Kbytes/s)
ftp> put MSSM_1gj68nrq148.rmn
local: MSSM_1gj68nrq148.rmn remote: MSSM_1gj68nrq148.rmn
227 Entering Passive Mode (192,168,0,42,34,253)
150 Ok to send data.
226 File receive OK.
204800 bytes sent in 0.015 seconds (1.4e+04 Kbytes/s)
ftp> put ODM_1hj68ns1149.rmn
local: ODM_1hj68ns1149.rmn remote: ODM_1hj68ns1149.rmn
227 Entering Passive Mode (192,168,0,42,222,154)
150 Ok to send data.
226 File receive OK.
5898240 bytes sent in 0.2 seconds (2.8e+04 Kbytes/s)
ftp> put TOOLS_1ij68ns2150.rmn
local: TOOLS_1ij68ns2150.rmn remote: TOOLS_1ij68ns2150.rmn
227 Entering Passive Mode (192,168,0,42,68,103)
150 Ok to send data.
226 File receive OK.
98304 bytes sent in 0.011 seconds (8.7e+03 Kbytes/s)
ftp> put USERS_1jj68ns3151.rmn
local: USERS_1jj68ns3151.rmn remote: USERS_1jj68ns3151.rmn
227 Entering Passive Mode (192,168,0,42,167,199)
150 Ok to send data.
226 File receive OK.
106496 bytes sent in 0.011 seconds (9.7e+03 Kbytes/s)
ftp> put XDB_1kj68ns4152.rmn
local: XDB_1kj68ns4152.rmn remote: XDB_1kj68ns4152.rmn
227 Entering Passive Mode (192,168,0,42,212,231)
150 Ok to send data.
226 File receive OK.
21381120 bytes sent in 0.77 seconds (2.7e+04 Kbytes/s)
ftp>
ftp> bye
221 Goodbye.
[oracle@standby1 rman]$
4.2.7 同理clone到standby
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: ORADG (DBID=2633017928)
connected to auxiliary database: oradg (not mounted)
RMAN> run{
2> restore clone standby controlfile to clone_cf;
3> replicate clone controlfile from clone_cf;
4> sql clone 'alter database mount standby database';
5> restore check readonly clone datafile 6,7,8,9,10,11;
6> }
Starting restore at 16-JAN-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=13 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
output filename=/oracle/oradata/oradg/control01.ctl
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/INDX_1fj68nrm147.rmn tag=TAG20080116T000406 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 16-JAN-08
replicating controlfile
input filename=/oracle/oradata/oradg/control01.ctl
output filename=/oracle/oradata/oradg/control02.ctl
output filename=/oracle/oradata/oradg/control03.ctl
sql statement: alter database mount standby database
Starting restore at 16-JAN-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to /oracle/oradata/oradg/indx01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/INDX_1fj68nrm147.rmn tag=TAG20080116T000406 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00011 to /oracle/oradata/oradg/ts_mssm_01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/MSSM_1gj68nrq148.rmn tag=TAG20080116T000410 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00007 to /oracle/oradata/oradg/odm01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/ODM_1hj68ns1149.rmn tag=TAG20080116T000417 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00008 to /oracle/oradata/oradg/tools01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/TOOLS_1ij68ns2150.rmn tag=TAG20080116T000418 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00009 to /oracle/oradata/oradg/users01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/USERS_1jj68ns3151.rmn tag=TAG20080116T000419 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00010 to /oracle/oradata/oradg/xdb01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rman/XDB_1kj68ns4152.rmn tag=TAG20080116T000420 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 16-JAN-08
RMAN>
5.待附加完所有的数据文件后,再recover standby database,打开备库到recover managed:
5.1 在recover之前,我们再在主库insert一个测试数据,我们看到,由于备份已经到mount状态,但是还没到recover managed,即没有mrp进程,因此arch虽然能传过去,但是没有applied:
2 where SEQUENCE#>=(select max(SEQUENCE#) from v$archived_log where APPLIED='YES');
SEQUENCE# APPLIE
---------- ------
215 NO
215 YES
test@ORADG(192.168.0.41)> insert into for_test_standby values ('c');
1 row created.
Elapsed: 00:00:00.10
test@ORADG(192.168.0.41)> commit;
Commit complete.
Elapsed: 00:00:00.01
test@ORADG(192.168.0.41)> conn / as sysdba
Connected.
test@ORADG(192.168.0.41)> alter system checkpoint;
System altered.
Elapsed: 00:00:00.22
test@ORADG(192.168.0.41)> alter system switch logfile;
System altered.
Elapsed: 00:00:00.07
test@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.13
test@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.04
……
test@ORADG(192.168.0.41)> /
System altered.
Elapsed: 00:00:00.04
test@ORADG(192.168.0.41)> select SEQUENCE#,APPLIED from v$archived_log
2 where SEQUENCE#>=(select max(SEQUENCE#) from v$archived_log where APPLIED='YES')
3 /
SEQUENCE# APPLIE
---------- ------
215 NO
215 YES
216 NO
216 NO
217 NO
217 NO
……
237 NO
237 NO
46 rows selected.
Elapsed: 00:00:00.04
test@ORADG(192.168.0.41)>
现在我们的测试表里面有3行记录:
a:在system和undo被克隆到备库之前insert的,该arch已经applied;
b:在system和undo克隆到备库之后insert的,该arch已经applied;
c:在其他表空间被克隆到备库之后,该arch已经传输到备库,但是还没applied。
5.2 recover standby database:
oradg_0001_0000000178.arc oradg_0001_0000000193.arc oradg_0001_0000000208.arc oradg_0001_0000000223.arc
oradg_0001_0000000179.arc oradg_0001_0000000194.arc oradg_0001_0000000209.arc oradg_0001_0000000224.arc
oradg_0001_0000000180.arc oradg_0001_0000000195.arc oradg_0001_0000000210.arc oradg_0001_0000000225.arc
oradg_0001_0000000181.arc oradg_0001_0000000196.arc oradg_0001_0000000211.arc oradg_0001_0000000226.arc
oradg_0001_0000000182.arc oradg_0001_0000000197.arc oradg_0001_0000000212.arc oradg_0001_0000000227.arc
oradg_0001_0000000183.arc oradg_0001_0000000198.arc oradg_0001_0000000213.arc oradg_0001_0000000228.arc
oradg_0001_0000000184.arc oradg_0001_0000000199.arc oradg_0001_0000000214.arc oradg_0001_0000000229.arc
oradg_0001_0000000185.arc oradg_0001_0000000200.arc oradg_0001_0000000215.arc oradg_0001_0000000230.arc
oradg_0001_0000000186.arc oradg_0001_0000000201.arc oradg_0001_0000000216.arc oradg_0001_0000000231.arc
oradg_0001_0000000187.arc oradg_0001_0000000202.arc oradg_0001_0000000217.arc oradg_0001_0000000232.arc
oradg_0001_0000000188.arc oradg_0001_0000000203.arc oradg_0001_0000000218.arc oradg_0001_0000000233.arc
oradg_0001_0000000189.arc oradg_0001_0000000204.arc oradg_0001_0000000219.arc oradg_0001_0000000234.arc
oradg_0001_0000000190.arc oradg_0001_0000000205.arc oradg_0001_0000000220.arc oradg_0001_0000000235.arc
oradg_0001_0000000191.arc oradg_0001_0000000206.arc oradg_0001_0000000221.arc oradg_0001_0000000236.arc
oradg_0001_0000000192.arc oradg_0001_0000000207.arc oradg_0001_0000000222.arc oradg_0001_0000000237.arc
SQL*Plus: Release 9.2.0.4.0 - Production on Wed Jan 16 00:27:14 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> select status from v$instance;
STATUS
------------------------
MOUNTED
SQL> recover standby database;
ORA-00279: change 639661 generated at 01/15/2008 23:12:18 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000216.arc
ORA-00280: change 639661 for thread 1 is in sequence #216
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/arch/oradg_0001_0000000216.arc
ORA-00279: change 646246 generated at 01/16/2008 00:16:10 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000217.arc
ORA-00280: change 646246 for thread 1 is in sequence #217
ORA-00278: log file '/oracle/arch/oradg_0001_0000000216.arc' no longer needed
for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/arch/oradg_0001_0000000217.arc
ORA-00279: change 646248 generated at 01/16/2008 00:16:11 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000218.arc
ORA-00280: change 646248 for thread 1 is in sequence #218
ORA-00278: log file '/oracle/arch/oradg_0001_0000000217.arc' no longer needed
for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 646251 generated at 01/16/2008 00:16:16 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000219.arc
ORA-00280: change 646251 for thread 1 is in sequence #219
ORA-00278: log file '/oracle/arch/oradg_0001_0000000218.arc' no longer needed
for this recovery
ORA-00279: change 646253 generated at 01/16/2008 00:16:17 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000220.arc
ORA-00280: change 646253 for thread 1 is in sequence #220
ORA-00278: log file '/oracle/arch/oradg_0001_0000000219.arc' no longer needed
for this recovery
ORA-00279: change 646255 generated at 01/16/2008 00:16:17 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000221.arc
ORA-00280: change 646255 for thread 1 is in sequence #221
ORA-00278: log file '/oracle/arch/oradg_0001_0000000220.arc' no longer needed
for this recovery
ORA-00279: change 646344 generated at 01/16/2008 00:16:44 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000222.arc
ORA-00280: change 646344 for thread 1 is in sequence #222
ORA-00278: log file '/oracle/arch/oradg_0001_0000000221.arc' no longer needed
for this recovery
ORA-00279: change 646346 generated at 01/16/2008 00:16:45 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000223.arc
ORA-00280: change 646346 for thread 1 is in sequence #223
ORA-00278: log file '/oracle/arch/oradg_0001_0000000222.arc' no longer needed
for this recovery
ORA-00279: change 646349 generated at 01/16/2008 00:16:46 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000224.arc
ORA-00280: change 646349 for thread 1 is in sequence #224
ORA-00278: log file '/oracle/arch/oradg_0001_0000000223.arc' no longer needed
for this recovery
ORA-00279: change 646351 generated at 01/16/2008 00:16:47 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000225.arc
ORA-00280: change 646351 for thread 1 is in sequence #225
ORA-00278: log file '/oracle/arch/oradg_0001_0000000224.arc' no longer needed
for this recovery
ORA-00279: change 646353 generated at 01/16/2008 00:16:50 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000226.arc
ORA-00280: change 646353 for thread 1 is in sequence #226
ORA-00278: log file '/oracle/arch/oradg_0001_0000000225.arc' no longer needed
for this recovery
ORA-00279: change 646355 generated at 01/16/2008 00:16:50 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000227.arc
ORA-00280: change 646355 for thread 1 is in sequence #227
ORA-00278: log file '/oracle/arch/oradg_0001_0000000226.arc' no longer needed
for this recovery
ORA-00279: change 646357 generated at 01/16/2008 00:16:51 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000228.arc
ORA-00280: change 646357 for thread 1 is in sequence #228
ORA-00278: log file '/oracle/arch/oradg_0001_0000000227.arc' no longer needed
for this recovery
ORA-00279: change 646475 generated at 01/16/2008 00:17:03 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000229.arc
ORA-00280: change 646475 for thread 1 is in sequence #229
ORA-00278: log file '/oracle/arch/oradg_0001_0000000228.arc' no longer needed
for this recovery
ORA-00279: change 646477 generated at 01/16/2008 00:17:04 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000230.arc
ORA-00280: change 646477 for thread 1 is in sequence #230
ORA-00278: log file '/oracle/arch/oradg_0001_0000000229.arc' no longer needed
for this recovery
ORA-00279: change 646480 generated at 01/16/2008 00:17:05 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000231.arc
ORA-00280: change 646480 for thread 1 is in sequence #231
ORA-00278: log file '/oracle/arch/oradg_0001_0000000230.arc' no longer needed
for this recovery
ORA-00279: change 646482 generated at 01/16/2008 00:17:05 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000232.arc
ORA-00280: change 646482 for thread 1 is in sequence #232
ORA-00278: log file '/oracle/arch/oradg_0001_0000000231.arc' no longer needed
for this recovery
ORA-00279: change 646484 generated at 01/16/2008 00:17:05 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000233.arc
ORA-00280: change 646484 for thread 1 is in sequence #233
ORA-00278: log file '/oracle/arch/oradg_0001_0000000232.arc' no longer needed
for this recovery
ORA-00279: change 646486 generated at 01/16/2008 00:17:06 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000234.arc
ORA-00280: change 646486 for thread 1 is in sequence #234
ORA-00278: log file '/oracle/arch/oradg_0001_0000000233.arc' no longer needed
for this recovery
ORA-00279: change 646488 generated at 01/16/2008 00:17:07 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000235.arc
ORA-00280: change 646488 for thread 1 is in sequence #235
ORA-00278: log file '/oracle/arch/oradg_0001_0000000234.arc' no longer needed
for this recovery
ORA-00279: change 646490 generated at 01/16/2008 00:17:08 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000236.arc
ORA-00280: change 646490 for thread 1 is in sequence #236
ORA-00278: log file '/oracle/arch/oradg_0001_0000000235.arc' no longer needed
for this recovery
ORA-00279: change 646492 generated at 01/16/2008 00:17:08 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000237.arc
ORA-00280: change 646492 for thread 1 is in sequence #237
ORA-00278: log file '/oracle/arch/oradg_0001_0000000236.arc' no longer needed
for this recovery
ORA-00279: change 646494 generated at 01/16/2008 00:17:09 needed for thread 1
ORA-00289: suggestion : /oracle/arch/oradg_0001_0000000238.arc
ORA-00280: change 646494 for thread 1 is in sequence #238
ORA-00278: log file '/oracle/arch/oradg_0001_0000000237.arc' no longer needed
for this recovery
ORA-00308: cannot open archived log '/oracle/arch/oradg_0001_0000000238.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL>
SQL>
5.3 打开备库到recover managed:
Database altered.
SQL>
至此,所有的步骤已经完成!我们已经完成基于数据文件的rman建dg。
6.测试switchover。
6.1 我们先来看看之前的测试表中的数据是否没有丢失(先检查下主库的arch是否applied):
sys@ORADG(192.168.0.41)> select SEQUENCE#,APPLIED from v$archived_log
2 where SEQUENCE#>=(select max(SEQUENCE#) from v$archived_log where APPLIED='YES');
SEQUENCE# APPLIE
---------- ------
237 NO
237 YES
备库上:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> conn test/test
Connected.
SQL> select * from for_test_standby;
A
----------------------------------------
a
b
c
SQL>
发现数据都正常!没有丢失。
6.2 switchover测试
(略)
· 【文章发布信息】发表于: 2008-01-16 @ 00:45:17 · ||分类: Study note



CopyRight ©