1. 备库配置初始化参数文件
在备库上修改/增加参数db_unique_name, instance_name, db_file_name_convert, standby_archive_dest等
db_file_name_convert='/home/oracle/app/oracle/oradata/test/','/home/oracle/app/oracle/oradata/test_s/'
log_file_name_convert='/home/oracle/app/oracle/oradata/test/','/home/oracle/app/oracle/oradata/test_s/'
9i及以后可以转换多个文件名, 如 db_file_name_convert='/primary/dir1','/standby/dir1','/primary/dir2','/standby/dir2',...
2. 备库创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=change_on_install entries=5
密码跟主库相同
没有密码文件则会报错
Tue Feb 17 03:18:39 2009
Errors in file /home/oracle/app/oracle/admin/test/bdump/test_arc0_13704.trc:
ORA-01031: insufficient privileges
PING[ARC0]: Heartbeat failed to connect to standby 'test_s'. Error is 1031.
3. 启备库nomount
sqlplus -s /nolog <<'EOF'
conn / as sysdba
startup nomount
exit
EOF
lsnrctl status
[oracle@DEV-pxy-1 ~]$ sqlplus -s /nolog <<'EOF'
> conn / as sysdba
> startup nomount
> exit
> EOF
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2085320 bytes
Variable Size 486542904 bytes
Database Buffers 1644167168 bytes
Redo Buffers 14688256 bytes
[oracle@DEV-pxy-1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 16-FEB-2009 07:41:24
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DEV-PXY-1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 15-JAN-2009 04:35:55
Uptime 32 days 3 hr. 5 min. 29 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/10.2/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/product/10.2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DEV-pxy-1.s3lab.mot.com)(PORT=1521)))
Services Summary...
Service "s10" has 2 instance(s).
Instance "s10", status UNKNOWN, has 1 handler(s) for this service...
Instance "s10", status READY, has 1 handler(s) for this service...
Service "s10_XPT" has 1 instance(s).
Instance "s10", status READY, has 1 handler(s) for this service...
Service "screen3" has 2 instance(s).
Instance "screen3", status UNKNOWN, has 1 handler(s) for this service...
Instance "screen3", status READY, has 1 handler(s) for this service...
Service "test_s" has 1 instance(s).
Instance "test_s", status BLOCKED, has 1 handler(s) for this service...
Service "test_s_XPT" has 1 instance(s).
Instance "test_s", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
[oracle@DEV-pxy-1 ~]$
备库是NOMOUNT状态, 所以是BLOCKED
4. 配置TNSNAME
主库配置TNSNAME
grep -q "ˆtest_s" $ORACLE_HOME/network/admin/tnsnames.ora || \
cat >>$ORACLE_HOME/network/admin/tnsnames.ora <<'EOF'
test_s =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-pxy-1)(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
)
EOF
cat $ORACLE_HOME/network/admin/tnsnames.ora
[oracle@DEV-RPT-2 ~]$ grep -q "ˆtest_s" $ORACLE_HOME/network/admin/tnsnames.ora || \
> cat >>$ORACLE_HOME/network/admin/tnsnames.ora <<'EOF'
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
)
> test_s =
> (DESCRIPTION =
> (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-pxy-1)(PORT = 1521)))
> (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
> )
>
> EOF
[oracle@DEV-RPT-2 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
em10 =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = MGT)(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = em10))
)
test =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test))
)
test_s =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-pxy-1)(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
)
[oracle@DEV-RPT-2 ~]$
备库最好也配上TNSNAMES
cat >$ORACLE_HOME/network/admin/tnsnames.ora <<'EOF'
test =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-RPT-2)(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test))
)
test_s =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-pxy-1)(PORT = 1521)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
)
EOF
[oracle@DEV-pxy-1 ~]$ cat >$ORACLE_HOME/network/admin/tnsnames.ora <<'EOF'
> test =
> (DESCRIPTION =
> (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-RPT-2)(PORT = 1521)))
> (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test))
> )
>
> test_s =
> (DESCRIPTION =
> (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-pxy-1)(PORT = 1521)))
> (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test_s))
> )
>
> EOF
[oracle@DEV-pxy-1 ~]$
5. 主库配置远程归档日志目录
主库:
set pages 50000 line 120
show parameter log_archive
alter system set log_archive_dest_2='SERVICE=test_s';
alter system set log_archive_dest_state_2='enable';
SQL> set pages 50000 line 120
SQL> show parameter log_archive
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config string
log_archive_dest string
log_archive_dest_1 string LOCATION=/home/oracle/app/orac
le/oradata/test/archive
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string ENABLE
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.arc
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
SQL> alter system set log_archive_dest_2='SERVICE=test_s';
System altered.
SQL> alter system set log_archive_dest_state_2='enable';
System altered.
SQL>
此时归档失败, 告警日志显示:
Mon Feb 16 10:13:02 2009
Error 12528 received logging on to the standby
Mon Feb 16 10:13:02 2009
Errors in file /home/oracle/app/oracle/admin/test/bdump/test_arc0_13704.trc:
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
PING[ARC0]: Heartbeat failed to connect to standby 'test_s'. Error is 12528.
跟踪文件:
*** 2009-02-16 10:13:02.558
*** SERVICE NAME:(SYS$BACKGROUND) 2009-02-16 10:13:02.557
*** SESSION ID:(1641.1) 2009-02-16 10:13:02.557
Redo shipping client performing standby login
OCIServerAttach failed -1
.. Detailed OCI error val is 12528 and errmsg is 'ORA-12528: TNS:listener: all appropriate instances are blocking new connections
'
*** 2009-02-16 10:13:02.669 62692 kcrr.c
Error 12528 received logging on to the standby
Error 12528 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'test_s'
Error 12528 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'test_s'
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
*** 2009-02-16 10:13:02.669 62692 kcrr.c
PING[ARC0]: Heartbeat failed to connect to standby 'test_s'. Error is 12528.
*** 2009-02-16 10:13:02.669 60970 kcrr.c
kcrrfail: dest:2 err:12528 force:0 blast:1
*** 2009-02-16 10:18:02.769
Redo shipping client performing standby login
OCIServerAttach failed -1
.. Detailed OCI error val is 12528 and errmsg is 'ORA-12528: TNS:listener: all appropriate instances are blocking new connections
'
不用理会
6. 备份主库
NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
mkdir -p /u01/software/oracle/backup/DEV-RPT-2/test/rman/
[oracle@DEV-RPT-2 ~]$ mkdir -p /u01/software/oracle/backup/DEV-RPT-2/test/rman/
删除一些归档日志和备份, 省的太乱了
rman target /
crosscheck archivelog all;
delete noprompt expired archivelog all;
list backupset summary;
delete noprompt backupset;
[oracle@DEV-RPT-2 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Tue Feb 17 02:56:03 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=1973292924)
RMAN> crosscheck archivelog all;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1632 devtype=DISK
validation failed for archived log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_774_676622925.arc recid=1430 stamp=678018682
validation failed for archived log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_775_676622925.arc recid=1431 stamp=678020482
validation failed for archived log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_776_676622925.arc recid=1432 stamp=678022281
validation failed for archived log
...
validation succeeded for archived log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_1337_676622925.arc recid=1993 stamp=679025996
validation succeeded for archived log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_1338_676622925.arc recid=1994 stamp=679027799
Crosschecked 565 objects
RMAN> delete noprompt expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1632 devtype=DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ------------------- ----
1430 1 774 X 2009-02-05 10:01:19 /home/oracle/app/oracle/oradata/test/archive/1_774_676622925.arc
1431 1 775 X 2009-02-05 10:31:22 /home/oracle/app/oracle/oradata/test/archive/1_775_676622925.arc
1432 1 776 X 2009-02-05 11:01:22 /home/oracle/app/oracle/oradata/test/archive/1_776_676622925.arc
1433 1 777 X 2009-02-05 11:31:21 /home/oracle/app/oracle/oradata/test/archive/1_777_676622925.arc
...
1891 1 1235 X 2009-02-15 00:53:21 /home/oracle/app/oracle/oradata/test/archive/1_1235_676622925.arc
1892 1 1236 X 2009-02-15 01:23:23 /home/oracle/app/oracle/oradata/test/archive/1_1236_676622925.arc
1893 1 1237 X 2009-02-15 01:53:23 /home/oracle/app/oracle/oradata/test/archive/1_1237_676622925.arc
deleted archive log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_774_676622925.arc recid=1430 stamp=678018682
deleted archive log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_775_676622925.arc recid=1431 stamp=678020482
deleted archive log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_776_676622925.arc recid=1432 stamp=678022281
deleted archive log
...
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_1235_676622925.arc recid=1891 stamp=678849804
deleted archive log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_1236_676622925.arc recid=1892 stamp=678851603
deleted archive log
archive log filename=/home/oracle/app/oracle/oradata/test/archive/1_1237_676622925.arc recid=1893 stamp=678853402
Deleted 464 EXPIRED objects
RMAN> list backupset summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
6 B 0 A DISK 2009-02-16 10:49:32 1 1 NO TAG20090216T104927
7 B 0 A DISK 2009-02-16 10:49:33 1 1 NO TAG20090216T104927
8 B 0 A DISK 2009-02-16 10:49:35 1 1 NO TAG20090216T104927
9 B 0 A DISK 2009-02-16 10:49:35 1 1 NO TAG20090216T104927
10 B 0 A DISK 2009-02-16 10:49:38 1 1 NO TAG20090216T104927
11 B A A DISK 2009-02-16 10:49:51 1 1 NO TAG20090216T104943
12 B A A DISK 2009-02-16 10:49:54 1 1 NO TAG20090216T104943
13 B A A DISK 2009-02-16 10:49:55 1 1 NO TAG20090216T104943
14 B A A DISK 2009-02-16 10:49:56 1 1 NO TAG20090216T104943
15 B A A DISK 2009-02-16 10:50:01 1 1 NO TAG20090216T104943
16 B A A DISK 2009-02-16 10:50:03 1 1 NO TAG20090216T104943
17 B A A DISK 2009-02-16 10:50:06 1 1 NO TAG20090216T104943
18 B A A DISK 2009-02-16 10:50:10 1 1 NO TAG20090216T104943
19 B A A DISK 2009-02-16 10:50:13 1 1 NO TAG20090216T104943
20 B A A DISK 2009-02-16 10:50:14 1 1 NO TAG20090216T104943
RMAN> delete noprompt backupset;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
6 6 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0ek7ggpo_1_1
7 7 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0gk7ggpo_1_1
8 8 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0hk7ggpt_1_1
9 9 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0dk7ggpn_1_1
10 10 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0fk7ggpo_1_1
11 11 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0ik7ggqa_1_1
12 12 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0kk7ggqa_1_1
13 13 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0jk7ggqa_1_1
14 14 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0lk7ggqa_1_1
15 15 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0mk7ggqi_1_1
16 16 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0nk7ggqm_1_1
17 17 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0ok7ggqm_1_1
18 18 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0pk7ggqm_1_1
19 19 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0rk7ggqv_1_1
20 20 1 1 AVAILABLE DISK /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0qk7ggqv_1_1
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0ek7ggpo_1_1 recid=6 stamp=678970169
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0gk7ggpo_1_1 recid=7 stamp=678970170
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0hk7ggpt_1_1 recid=8 stamp=678970174
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0dk7ggpn_1_1 recid=9 stamp=678970168
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090216_0fk7ggpo_1_1 recid=10 stamp=678970170
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0ik7ggqa_1_1 recid=11 stamp=678970187
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0kk7ggqa_1_1 recid=12 stamp=678970189
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0jk7ggqa_1_1 recid=13 stamp=678970188
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0lk7ggqa_1_1 recid=14 stamp=678970190
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0mk7ggqi_1_1 recid=15 stamp=678970198
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0nk7ggqm_1_1 recid=16 stamp=678970199
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0ok7ggqm_1_1 recid=17 stamp=678970203
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0pk7ggqm_1_1 recid=18 stamp=678970207
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0rk7ggqv_1_1 recid=19 stamp=678970209
deleted backup piece
backup piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090216_0qk7ggqv_1_1 recid=20 stamp=678970208
Deleted 15 objects
RMAN>
备份数据库
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup as backupset incremental level 0 format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_%d_%I_%T_%U' database;
sql 'alter system archive log current';
backup as backupset format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_%d_%I_%T_%U' archivelog all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> backup as backupset incremental level 0 format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_%d_%I_%T_%U' database;
7> sql 'alter system archive log current';
8> backup as backupset format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_%d_%I_%T_%U' archivelog all;
9> release channel c1;
10> release channel c2;
11> release channel c3;
12> release channel c4;
13> }
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=1632 devtype=DISK
allocated channel: c2
channel c2: sid=1644 devtype=DISK
allocated channel: c3
channel c3: sid=1623 devtype=DISK
allocated channel: c4
channel c4: sid=1629 devtype=DISK
Starting backup at 2009-02-17 03:02:54
channel c1: starting incremental level 0 datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/app/oracle/oradata/test/system01.dbf
channel c1: starting piece 1 at 2009-02-17 03:02:55
channel c2: starting incremental level 0 datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00002 name=/home/oracle/app/oracle/oradata/test/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/app/oracle/oradata/test/users01.dbf
channel c2: starting piece 1 at 2009-02-17 03:02:55
channel c3: starting incremental level 0 datafile backupset
channel c3: specifying datafile(s) in backupset
input datafile fno=00003 name=/home/oracle/app/oracle/oradata/test/sysaux01.dbf
input datafile fno=00005 name=/home/oracle/app/oracle/oradata/test/ts_test01.dbf
channel c3: starting piece 1 at 2009-02-17 03:02:55
channel c4: starting incremental level 0 datafile backupset
channel c4: specifying datafile(s) in backupset
including current control file in backupset
channel c4: starting piece 1 at 2009-02-17 03:02:58
channel c2: finished piece 1 at 2009-02-17 03:03:01
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0tk7i9qv_1_1 tag=TAG20090217T030254 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:06
channel c2: starting incremental level 0 datafile backupset
channel c2: specifying datafile(s) in backupset
channel c4: finished piece 1 at 2009-02-17 03:03:01
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0vk7i9r0_1_1 tag=TAG20090217T030254 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:05
channel c1: finished piece 1 at 2009-02-17 03:03:02
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0sk7i9qv_1_1 tag=TAG20090217T030254 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:07
including current SPFILE in backupset
channel c2: starting piece 1 at 2009-02-17 03:03:02
channel c2: finished piece 1 at 2009-02-17 03:03:03
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_10k7i9r5_1_1 tag=TAG20090217T030254 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c3: finished piece 1 at 2009-02-17 03:03:06
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0uk7i9qv_1_1 tag=TAG20090217T030254 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:11
Finished backup at 2009-02-17 03:03:06
sql statement: alter system archive log current
Starting backup at 2009-02-17 03:03:10
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1306 recid=1962 stamp=678970183
input archive log thread=1 sequence=1307 recid=1963 stamp=678971984
input archive log thread=1 sequence=1308 recid=1964 stamp=678973784
input archive log thread=1 sequence=1309 recid=1965 stamp=678975584
input archive log thread=1 sequence=1310 recid=1966 stamp=678977383
input archive log thread=1 sequence=1311 recid=1967 stamp=678979183
input archive log thread=1 sequence=1312 recid=1968 stamp=678980982
input archive log thread=1 sequence=1313 recid=1969 stamp=678982782
input archive log thread=1 sequence=1314 recid=1970 stamp=678984584
input archive log thread=1 sequence=1315 recid=1971 stamp=678986384
input archive log thread=1 sequence=1316 recid=1972 stamp=678988183
input archive log thread=1 sequence=1317 recid=1973 stamp=678989983
input archive log thread=1 sequence=1318 recid=1974 stamp=678991782
input archive log thread=1 sequence=1319 recid=1975 stamp=678993585
input archive log thread=1 sequence=1320 recid=1976 stamp=678995390
input archive log thread=1 sequence=1321 recid=1977 stamp=678997190
input archive log thread=1 sequence=1322 recid=1978 stamp=678998989
input archive log thread=1 sequence=1323 recid=1979 stamp=679000789
input archive log thread=1 sequence=1324 recid=1980 stamp=679002588
input archive log thread=1 sequence=1325 recid=1981 stamp=679004391
input archive log thread=1 sequence=1326 recid=1982 stamp=679006196
input archive log thread=1 sequence=1327 recid=1983 stamp=679007996
input archive log thread=1 sequence=1328 recid=1984 stamp=679009795
input archive log thread=1 sequence=1329 recid=1985 stamp=679011599
channel c1: starting piece 1 at 2009-02-17 03:03:13
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=1 sequence=1264 recid=1920 stamp=678902015
input archive log thread=1 sequence=1265 recid=1921 stamp=678903815
input archive log thread=1 sequence=1266 recid=1922 stamp=678905614
input archive log thread=1 sequence=1267 recid=1923 stamp=678907414
input archive log thread=1 sequence=1268 recid=1924 stamp=678909216
input archive log thread=1 sequence=1269 recid=1925 stamp=678911022
input archive log thread=1 sequence=1270 recid=1926 stamp=678912821
input archive log thread=1 sequence=1271 recid=1927 stamp=678914621
input archive log thread=1 sequence=1272 recid=1928 stamp=678916420
input archive log thread=1 sequence=1273 recid=1929 stamp=678918219
input archive log thread=1 sequence=1274 recid=1930 stamp=678920021
input archive log thread=1 sequence=1275 recid=1931 stamp=678921821
input archive log thread=1 sequence=1276 recid=1932 stamp=678923620
input archive log thread=1 sequence=1277 recid=1933 stamp=678925434
input archive log thread=1 sequence=1278 recid=1934 stamp=678927234
input archive log thread=1 sequence=1279 recid=1935 stamp=678929024
channel c2: starting piece 1 at 2009-02-17 03:03:13
channel c3: starting archive log backupset
channel c3: specifying archive log(s) in backup set
input archive log thread=1 sequence=1330 recid=1986 stamp=679013397
input archive log thread=1 sequence=1331 recid=1987 stamp=679015197
input archive log thread=1 sequence=1332 recid=1988 stamp=679016996
input archive log thread=1 sequence=1333 recid=1989 stamp=679018799
input archive log thread=1 sequence=1334 recid=1990 stamp=679020598
input archive log thread=1 sequence=1335 recid=1991 stamp=679022397
input archive log thread=1 sequence=1336 recid=1992 stamp=679024197
input archive log thread=1 sequence=1337 recid=1993 stamp=679025996
input archive log thread=1 sequence=1338 recid=1994 stamp=679027799
input archive log thread=1 sequence=1339 recid=1995 stamp=679028590
input archive log thread=1 sequence=1340 recid=1996 stamp=679028590
channel c3: starting piece 1 at 2009-02-17 03:03:13
channel c4: starting archive log backupset
channel c4: specifying archive log(s) in backup set
input archive log thread=1 sequence=1238 recid=1894 stamp=678855202
input archive log thread=1 sequence=1239 recid=1895 stamp=678857001
input archive log thread=1 sequence=1240 recid=1896 stamp=678858804
input archive log thread=1 sequence=1241 recid=1897 stamp=678860603
input archive log thread=1 sequence=1242 recid=1898 stamp=678862402
input archive log thread=1 sequence=1243 recid=1899 stamp=678864202
input archive log thread=1 sequence=1244 recid=1900 stamp=678866001
input archive log thread=1 sequence=1245 recid=1901 stamp=678867804
input archive log thread=1 sequence=1246 recid=1902 stamp=678869603
input archive log thread=1 sequence=1247 recid=1903 stamp=678871402
input archive log thread=1 sequence=1248 recid=1904 stamp=678873202
input archive log thread=1 sequence=1249 recid=1905 stamp=678875002
input archive log thread=1 sequence=1250 recid=1906 stamp=678876801
input archive log thread=1 sequence=1251 recid=1907 stamp=678878603
input archive log thread=1 sequence=1252 recid=1908 stamp=678880403
input archive log thread=1 sequence=1253 recid=1909 stamp=678882202
input archive log thread=1 sequence=1254 recid=1910 stamp=678884002
input archive log thread=1 sequence=1255 recid=1911 stamp=678885802
input archive log thread=1 sequence=1256 recid=1912 stamp=678887601
input archive log thread=1 sequence=1257 recid=1913 stamp=678889404
input archive log thread=1 sequence=1258 recid=1914 stamp=678891209
input archive log thread=1 sequence=1259 recid=1915 stamp=678893009
input archive log thread=1 sequence=1260 recid=1916 stamp=678894808
input archive log thread=1 sequence=1261 recid=1917 stamp=678896608
input archive log thread=1 sequence=1262 recid=1918 stamp=678898410
input archive log thread=1 sequence=1263 recid=1919 stamp=678900215
channel c4: starting piece 1 at 2009-02-17 03:03:14
channel c2: finished piece 1 at 2009-02-17 03:03:17
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_12k7i9rg_1_1 tag=TAG20090217T030310 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:05
channel c3: finished piece 1 at 2009-02-17 03:03:17
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_13k7i9rg_1_1 tag=TAG20090217T030310 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:05
channel c4: finished piece 1 at 2009-02-17 03:03:17
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_14k7i9rg_1_1 tag=TAG20090217T030310 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:05
channel c1: finished piece 1 at 2009-02-17 03:03:18
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_11k7i9rg_1_1 tag=TAG20090217T030310 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:06
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=1 sequence=1280 recid=1936 stamp=678930822
input archive log thread=1 sequence=1281 recid=1937 stamp=678932625
input archive log thread=1 sequence=1282 recid=1938 stamp=678934430
input archive log thread=1 sequence=1283 recid=1939 stamp=678936230
input archive log thread=1 sequence=1284 recid=1940 stamp=678938029
input archive log thread=1 sequence=1285 recid=1941 stamp=678939828
input archive log thread=1 sequence=1286 recid=1942 stamp=678941628
input archive log thread=1 sequence=1287 recid=1943 stamp=678943431
input archive log thread=1 sequence=1288 recid=1944 stamp=678945236
input archive log thread=1 sequence=1289 recid=1945 stamp=678947036
input archive log thread=1 sequence=1290 recid=1946 stamp=678948835
input archive log thread=1 sequence=1291 recid=1947 stamp=678950635
input archive log thread=1 sequence=1292 recid=1948 stamp=678952434
input archive log thread=1 sequence=1293 recid=1949 stamp=678954234
input archive log thread=1 sequence=1294 recid=1950 stamp=678956036
input archive log thread=1 sequence=1295 recid=1951 stamp=678957836
input archive log thread=1 sequence=1296 recid=1952 stamp=678959635
input archive log thread=1 sequence=1297 recid=1953 stamp=678961435
input archive log thread=1 sequence=1298 recid=1954 stamp=678963234
input archive log thread=1 sequence=1299 recid=1955 stamp=678965034
input archive log thread=1 sequence=1300 recid=1956 stamp=678966837
input archive log thread=1 sequence=1301 recid=1957 stamp=678968014
input archive log thread=1 sequence=1302 recid=1958 stamp=678968649
input archive log thread=1 sequence=1303 recid=1959 stamp=678969197
input archive log thread=1 sequence=1304 recid=1960 stamp=678969198
input archive log thread=1 sequence=1305 recid=1961 stamp=678970182
channel c2: starting piece 1 at 2009-02-17 03:03:18
channel c2: finished piece 1 at 2009-02-17 03:03:21
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_15k7i9rm_1_1 tag=TAG20090217T030310 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
Finished backup at 2009-02-17 03:03:21
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN>
ls -lrt /u01/software/oracle/backup/DEV-RPT-2/test/rman/
[oracle@DEV-RPT-2 ~]$ ls -lrt /u01/software/oracle/backup/DEV-RPT-2/test/rman/
total 413324
-rw-r--r-- 1 oracle oinstall 1559 Feb 16 07:16 spbakcup.ora
-rw-r----- 1 oracle oinstall 25886720 Feb 17 03:03 data_TEST_1973292924_20090217_0tk7i9qv_1_1
-rw-r----- 1 oracle oinstall 9764864 Feb 17 03:03 data_TEST_1973292924_20090217_0vk7i9r0_1_1
-rw-r----- 1 oracle oinstall 151830528 Feb 17 03:03 data_TEST_1973292924_20090217_0sk7i9qv_1_1
-rw-r----- 1 oracle oinstall 98304 Feb 17 03:03 data_TEST_1973292924_20090217_10k7i9r5_1_1
-rw-r----- 1 oracle oinstall 143163392 Feb 17 03:03 data_TEST_1973292924_20090217_0uk7i9qv_1_1
-rw-r----- 1 oracle oinstall 11546112 Feb 17 03:03 arch_TEST_1973292924_20090217_13k7i9rg_1_1
-rw-r----- 1 oracle oinstall 23557120 Feb 17 03:03 arch_TEST_1973292924_20090217_12k7i9rg_1_1
-rw-r----- 1 oracle oinstall 30858240 Feb 17 03:03 arch_TEST_1973292924_20090217_11k7i9rg_1_1
-rw-r----- 1 oracle oinstall 8069120 Feb 17 03:03 arch_TEST_1973292924_20090217_14k7i9rg_1_1
-rw-r----- 1 oracle oinstall 7874560 Feb 17 03:03 arch_TEST_1973292924_20090217_15k7i9rm_1_1
-rw-r----- 1 oracle oinstall 9715712 Feb 17 03:10 cf4standby
[oracle@DEV-RPT-2 ~]$
7. 主库备份备用控制文件
用 backup 命令
backup current controlfile for standby format='/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby_%U';
或 copy
copy current controlfile for standby to '/u01/software/oracle/backup/dev-rpt-2/test/rman/cf4standby_cp';
或在备份数据库时
backup database ... include current controlfile for standby;
或 alter database create
sql "alter database create standby controlfile as ''/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby''";
catalog controlfilecopy '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
因为后面用的是手工方式, 这里只要alter database create就可以了
sql "alter database create standby controlfile as ''/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby''";
RMAN> sql "alter database create standby controlfile as ''/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby''";
sql statement: alter database create standby controlfile as ''/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby''
RMAN>
告警日志:
Tue Feb 17 03:10:18 2009
alter database create standby controlfile as '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby'
Tue Feb 17 03:10:18 2009
Clearing standby activation ID 1974762515 (0x75b47c13)
The primary database controlfile was created using the
'MAXLOGFILES 32' clause.
There is space for up to 29 standby redo logfiles
Use the following SQL commands on the standby database to create
standby redo logfiles that match the primary database:
ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 104857600;
ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 104857600;
ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 104857600;
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 104857600;
Completed: alter database create standby controlfile as '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby'
8. 备库复制或恢复备用控制文件
NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
rman target /
set dbid=1973292924;
restore standby controlfile from '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
[oracle@DEV-pxy-1 ~]$ NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
[oracle@DEV-pxy-1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Tue Feb 17 03:15:08 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: test (not mounted)
RMAN> set dbid=1973292924;
executing command: SET DBID
RMAN> restore standby controlfile from '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
Starting restore at 2009-02-17 03:16:56
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1641 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=/home/oracle/app/oracle/oradata/test_s/control01.ctl
output filename=/home/oracle/app/oracle/oradata/test_s/control02.ctl
output filename=/home/oracle/app/oracle/oradata/test_s/control03.ctl
Finished restore at 2009-02-17 03:16:58
RMAN>
9. 挂载控制文件
sql 'alter database mount standby database';
RMAN> sql 'alter database mount standby database';
sql statement: alter database mount standby database
released channel: ORA_DISK_1
RMAN>
10g运行alter database mount好像也可以
10. 恢复数据文件
list backupset;
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
21 Incr 0 24.68M DISK 00:00:04 2009-02-17 03:02:59
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030254
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0tk7i9qv_1_1
List of Datafiles in backup set 21
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
2 0 Incr 1789174 2009-02-17 03:02:55 /home/oracle/app/oracle/oradata/test_s/undotbs01.dbf
4 0 Incr 1789174 2009-02-17 03:02:55 /home/oracle/app/oracle/oradata/test_s/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
22 Incr 0 9.30M DISK 00:00:04 2009-02-17 03:03:00
BP Key: 22 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030254
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0vk7i9r0_1_1
Control File Included: Ckp SCN: 1789174 Ckp time: 2009-02-17 03:02:56
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
23 Incr 0 144.79M DISK 00:00:07 2009-02-17 03:03:02
BP Key: 23 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030254
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0sk7i9qv_1_1
List of Datafiles in backup set 23
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 0 Incr 1789173 2009-02-17 03:02:55 /home/oracle/app/oracle/oradata/test_s/system01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
24 Incr 0 80.00K DISK 00:00:02 2009-02-17 03:03:03
BP Key: 24 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030254
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_10k7i9r5_1_1
SPFILE Included: Modification time: 2009-02-16 22:01:48
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
25 Incr 0 136.52M DISK 00:00:10 2009-02-17 03:03:05
BP Key: 25 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030254
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0uk7i9qv_1_1
List of Datafiles in backup set 25
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
3 0 Incr 1789175 2009-02-17 03:02:56 /home/oracle/app/oracle/oradata/test_s/sysaux01.dbf
5 0 Incr 1789175 2009-02-17 03:02:56 /home/oracle/app/oracle/oradata/test_s/ts_test01.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
26 11.01M DISK 00:00:03 2009-02-17 03:03:15
BP Key: 26 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030310
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_13k7i9rg_1_1
List of Archived Logs in backup set 26
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 1330 1780512 2009-02-16 22:19:58 1781131 2009-02-16 22:49:57
1 1331 1781131 2009-02-16 22:49:57 1783830 2009-02-16 23:19:57
1 1332 1783830 2009-02-16 23:19:57 1784641 2009-02-16 23:49:56
1 1333 1784641 2009-02-16 23:49:56 1785441 2009-02-17 00:19:58
1 1334 1785441 2009-02-17 00:19:58 1786057 2009-02-17 00:49:58
1 1335 1786057 2009-02-17 00:49:58 1786801 2009-02-17 01:19:57
1 1336 1786801 2009-02-17 01:19:57 1787413 2009-02-17 01:49:57
1 1337 1787413 2009-02-17 01:49:57 1788162 2009-02-17 02:19:56
1 1338 1788162 2009-02-17 02:19:56 1788773 2009-02-17 02:49:58
1 1339 1788773 2009-02-17 02:49:58 1789189 2009-02-17 03:03:10
1 1340 1789189 2009-02-17 03:03:10 1789194 2009-02-17 03:03:10
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
27 22.47M DISK 00:00:03 2009-02-17 03:03:15
BP Key: 27 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030310
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_12k7i9rg_1_1
List of Archived Logs in backup set 27
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 1264 1730698 2009-02-15 15:23:35 1731311 2009-02-15 15:53:35
1 1265 1731311 2009-02-15 15:53:35 1732044 2009-02-15 16:23:34
1 1266 1732044 2009-02-15 16:23:34 1732662 2009-02-15 16:53:34
1 1267 1732662 2009-02-15 16:53:34 1733398 2009-02-15 17:23:33
1 1268 1733398 2009-02-15 17:23:33 1734017 2009-02-15 17:53:36
1 1269 1734017 2009-02-15 17:53:36 1734770 2009-02-15 18:23:42
1 1270 1734770 2009-02-15 18:23:42 1735383 2009-02-15 18:53:41
1 1271 1735383 2009-02-15 18:53:41 1736125 2009-02-15 19:23:41
1 1272 1736125 2009-02-15 19:23:41 1736741 2009-02-15 19:53:40
1 1273 1736741 2009-02-15 19:53:40 1737501 2009-02-15 20:23:39
1 1274 1737501 2009-02-15 20:23:39 1738114 2009-02-15 20:53:41
1 1275 1738114 2009-02-15 20:53:41 1738853 2009-02-15 21:23:41
1 1276 1738853 2009-02-15 21:23:41 1739471 2009-02-15 21:53:40
1 1277 1739471 2009-02-15 21:53:40 1740210 2009-02-15 22:23:54
1 1278 1740210 2009-02-15 22:23:54 1740822 2009-02-15 22:53:53
1 1279 1740822 2009-02-15 22:53:53 1744220 2009-02-15 23:23:43
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
28 7.69M DISK 00:00:04 2009-02-17 03:03:16
BP Key: 28 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030310
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_14k7i9rg_1_1
List of Archived Logs in backup set 28
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 1238 1712986 2009-02-15 02:23:22 1713601 2009-02-15 02:53:22
1 1239 1713601 2009-02-15 02:53:22 1714376 2009-02-15 03:23:21
1 1240 1714376 2009-02-15 03:23:21 1714992 2009-02-15 03:53:23
1 1241 1714992 2009-02-15 03:53:23 1715737 2009-02-15 04:23:23
1 1242 1715737 2009-02-15 04:23:23 1716349 2009-02-15 04:53:22
1 1243 1716349 2009-02-15 04:53:22 1717102 2009-02-15 05:23:22
1 1244 1717102 2009-02-15 05:23:22 1717719 2009-02-15 05:53:21
1 1245 1717719 2009-02-15 05:53:21 1718451 2009-02-15 06:23:23
1 1246 1718451 2009-02-15 06:23:23 1719065 2009-02-15 06:53:23
1 1247 1719065 2009-02-15 06:53:23 1719801 2009-02-15 07:23:22
1 1248 1719801 2009-02-15 07:23:22 1720417 2009-02-15 07:53:22
1 1249 1720417 2009-02-15 07:53:22 1721148 2009-02-15 08:23:21
1 1250 1721148 2009-02-15 08:23:21 1721763 2009-02-15 08:53:21
1 1251 1721763 2009-02-15 08:53:21 1722520 2009-02-15 09:23:23
1 1252 1722520 2009-02-15 09:23:23 1723135 2009-02-15 09:53:23
1 1253 1723135 2009-02-15 09:53:23 1723892 2009-02-15 10:23:22
1 1254 1723892 2009-02-15 10:23:22 1724505 2009-02-15 10:53:22
1 1255 1724505 2009-02-15 10:53:22 1725250 2009-02-15 11:23:22
1 1256 1725250 2009-02-15 11:23:22 1725859 2009-02-15 11:53:21
1 1257 1725859 2009-02-15 11:53:21 1726616 2009-02-15 12:23:24
1 1258 1726616 2009-02-15 12:23:24 1727224 2009-02-15 12:53:29
1 1259 1727224 2009-02-15 12:53:29 1727954 2009-02-15 13:23:28
1 1260 1727954 2009-02-15 13:23:28 1728569 2009-02-15 13:53:28
1 1261 1728569 2009-02-15 13:53:28 1729311 2009-02-15 14:23:27
1 1262 1729311 2009-02-15 14:23:27 1729929 2009-02-15 14:53:30
1 1263 1729929 2009-02-15 14:53:30 1730698 2009-02-15 15:23:35
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
29 29.43M DISK 00:00:05 2009-02-17 03:03:17
BP Key: 29 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030310
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_11k7i9rg_1_1
List of Archived Logs in backup set 29
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 1306 1760387 2009-02-16 10:49:42 1760392 2009-02-16 10:49:42
1 1307 1760392 2009-02-16 10:49:42 1761235 2009-02-16 11:19:44
1 1308 1761235 2009-02-16 11:19:44 1761848 2009-02-16 11:49:44
1 1309 1761848 2009-02-16 11:49:44 1762592 2009-02-16 12:19:43
1 1310 1762592 2009-02-16 12:19:43 1763210 2009-02-16 12:49:43
1 1311 1763210 2009-02-16 12:49:43 1763946 2009-02-16 13:19:43
1 1312 1763946 2009-02-16 13:19:43 1764559 2009-02-16 13:49:42
1 1313 1764559 2009-02-16 13:49:42 1765327 2009-02-16 14:19:42
1 1314 1765327 2009-02-16 14:19:42 1765941 2009-02-16 14:49:44
1 1315 1765941 2009-02-16 14:49:44 1766697 2009-02-16 15:19:44
1 1316 1766697 2009-02-16 15:19:44 1767312 2009-02-16 15:49:43
1 1317 1767312 2009-02-16 15:49:43 1768045 2009-02-16 16:19:43
1 1318 1768045 2009-02-16 16:19:43 1768658 2009-02-16 16:49:42
1 1319 1768658 2009-02-16 16:49:42 1769418 2009-02-16 17:19:44
1 1320 1769418 2009-02-16 17:19:44 1770034 2009-02-16 17:49:50
1 1321 1770034 2009-02-16 17:49:50 1770792 2009-02-16 18:19:49
1 1322 1770792 2009-02-16 18:19:49 1771408 2009-02-16 18:49:49
1 1323 1771408 2009-02-16 18:49:49 1772152 2009-02-16 19:19:48
1 1324 1772152 2009-02-16 19:19:48 1772766 2009-02-16 19:49:48
1 1325 1772766 2009-02-16 19:49:48 1773544 2009-02-16 20:19:50
1 1326 1773544 2009-02-16 20:19:50 1774158 2009-02-16 20:49:56
1 1327 1774158 2009-02-16 20:49:56 1774893 2009-02-16 21:19:56
1 1328 1774893 2009-02-16 21:19:56 1775511 2009-02-16 21:49:55
1 1329 1775511 2009-02-16 21:49:55 1780512 2009-02-16 22:19:58
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
30 7.51M DISK 00:00:00 2009-02-17 03:03:18
BP Key: 30 Status: AVAILABLE Compressed: NO Tag: TAG20090217T030310
Piece Name: /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_15k7i9rm_1_1
List of Archived Logs in backup set 30
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 1280 1744220 2009-02-15 23:23:43 1745038 2009-02-15 23:53:42
1 1281 1745038 2009-02-15 23:53:42 1745841 2009-02-16 00:23:44
1 1282 1745841 2009-02-16 00:23:44 1746458 2009-02-16 00:53:50
1 1283 1746458 2009-02-16 00:53:50 1747202 2009-02-16 01:23:49
1 1284 1747202 2009-02-16 01:23:49 1747817 2009-02-16 01:53:49
1 1285 1747817 2009-02-16 01:53:49 1748555 2009-02-16 02:23:48
1 1286 1748555 2009-02-16 02:23:48 1749167 2009-02-16 02:53:48
1 1287 1749167 2009-02-16 02:53:48 1749931 2009-02-16 03:23:50
1 1288 1749931 2009-02-16 03:23:50 1750550 2009-02-16 03:53:56
1 1289 1750550 2009-02-16 03:53:56 1751295 2009-02-16 04:23:55
1 1290 1751295 2009-02-16 04:23:55 1751908 2009-02-16 04:53:55
1 1291 1751908 2009-02-16 04:53:55 1752656 2009-02-16 05:23:54
1 1292 1752656 2009-02-16 05:23:54 1753305 2009-02-16 05:53:54
1 1293 1753305 2009-02-16 05:53:54 1754051 2009-02-16 06:23:54
1 1294 1754051 2009-02-16 06:23:54 1754676 2009-02-16 06:53:56
1 1295 1754676 2009-02-16 06:53:56 1755463 2009-02-16 07:23:56
1 1296 1755463 2009-02-16 07:23:56 1756080 2009-02-16 07:53:55
1 1297 1756080 2009-02-16 07:53:55 1756820 2009-02-16 08:23:55
1 1298 1756820 2009-02-16 08:23:55 1757515 2009-02-16 08:53:54
1 1299 1757515 2009-02-16 08:53:54 1758273 2009-02-16 09:23:54
1 1300 1758273 2009-02-16 09:23:54 1758888 2009-02-16 09:53:56
1 1301 1758888 2009-02-16 09:53:56 1759428 2009-02-16 10:13:33
1 1302 1759428 2009-02-16 10:13:33 1759666 2009-02-16 10:24:08
1 1303 1759666 2009-02-16 10:24:08 1759918 2009-02-16 10:33:17
1 1304 1759918 2009-02-16 10:33:17 1759923 2009-02-16 10:33:18
1 1305 1759923 2009-02-16 10:33:18 1760387 2009-02-16 10:49:42
RMAN>
restore database;
RMAN> restore database;
Starting restore at 2009-02-17 03:28:44
Starting implicit crosscheck backup at 2009-02-17 03:28:44
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1640 devtype=DISK
Crosschecked 10 objects
Finished implicit crosscheck backup at 2009-02-17 03:28:46
Starting implicit crosscheck copy at 2009-02-17 03:28:46
using channel ORA_DISK_1
Finished implicit crosscheck copy at 2009-02-17 03:28:46
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 00002 to /home/oracle/app/oracle/oradata/test_s/undotbs01.dbf
restoring datafile 00004 to /home/oracle/app/oracle/oradata/test_s/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0tk7i9qv_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0tk7i9qv_1_1 tag=TAG20090217T030254
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/app/oracle/oradata/test_s/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0sk7i9qv_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0sk7i9qv_1_1 tag=TAG20090217T030254
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /home/oracle/app/oracle/oradata/test_s/sysaux01.dbf
restoring datafile 00005 to /home/oracle/app/oracle/oradata/test_s/ts_test01.dbf
channel ORA_DISK_1: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0uk7i9qv_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090217_0uk7i9qv_1_1 tag=TAG20090217T030254
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 2009-02-17 03:29:08
RMAN>
告警日志:
Tue Feb 17 03:28:47 2009
Full restore complete of datafile 4 /home/oracle/app/oracle/oradata/test_s/users01.dbf. Elapsed time: 0:00:00
checkpoint is 1789174
Full restore complete of datafile 2 /home/oracle/app/oracle/oradata/test_s/undotbs01.dbf. Elapsed time: 0:00:03
checkpoint is 1789174
last deallocation scn is 1785174
Tue Feb 17 03:28:59 2009
Full restore complete of datafile 1 /home/oracle/app/oracle/oradata/test_s/system01.dbf. Elapsed time: 0:00:05
checkpoint is 1789173
last deallocation scn is 176822
Full restore complete of datafile 5 /home/oracle/app/oracle/oradata/test_s/ts_test01.dbf. Elapsed time: 0:00:00
checkpoint is 1789175
Full restore complete of datafile 3 /home/oracle/app/oracle/oradata/test_s/sysaux01.dbf. Elapsed time: 0:00:03
checkpoint is 1789175
last deallocation scn is 1782338
11. 修复数据库
recover database;
RMAN> recover database;
Starting recover at 2009-02-17 03:35:31
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 1341 is already on disk as file /home/oracle/app/oracle/oradata/test_s/archive/1_1341_676622925.arc
archive log thread 1 sequence 1342 is already on disk as file /home/oracle/app/oracle/oradata/test_s/archive/1_1342_676622925.arc
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=1339
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=1340
channel ORA_DISK_1: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_13k7i9rg_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_TEST_1973292924_20090217_13k7i9rg_1_1 tag=TAG20090217T030310
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=/home/oracle/app/oracle/oradata/test_s/archive/1_1339_676622925.arc thread=1 sequence=1339
archive log filename=/home/oracle/app/oracle/oradata/test_s/archive/1_1340_676622925.arc thread=1 sequence=1340
archive log filename=/home/oracle/app/oracle/oradata/test_s/archive/1_1341_676622925.arc thread=1 sequence=1341
archive log filename=/home/oracle/app/oracle/oradata/test_s/archive/1_1342_676622925.arc thread=1 sequence=1342
unable to find archive log
archive log thread=1 sequence=1343
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/17/2009 03:35:34
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1343 lowscn 1789808
RMAN>
告警日志:
Tue Feb 17 03:35:32 2009
alter database recover datafile list clear
Tue Feb 17 03:35:32 2009
Completed: alter database recover datafile list clear
Tue Feb 17 03:35:32 2009
alter database recover datafile list
1 , 2 , 3 , 4 , 5
Completed: alter database recover datafile list
1 , 2 , 3 , 4 , 5
Tue Feb 17 03:35:32 2009
alter database recover if needed
standby start
Media Recovery Start
Managed Standby Recovery not using Real Time Apply
parallel recovery started with 2 processes
ORA-279 signalled during: alter database recover if needed
standby start
...
Tue Feb 17 03:35:33 2009
Archivelog restore complete. Elapsed time: 0:00:00
Archivelog restore complete. Elapsed time: 0:00:00
Tue Feb 17 03:35:34 2009
alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1339_676622925.arc'
Tue Feb 17 03:35:34 2009
Media Recovery Log /home/oracle/app/oracle/oradata/test_s/archive/1_1339_676622925.arc
ORA-279 signalled during: alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1339_676622925.arc'...
Tue Feb 17 03:35:34 2009
alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1340_676622925.arc'
Tue Feb 17 03:35:34 2009
Media Recovery Log /home/oracle/app/oracle/oradata/test_s/archive/1_1340_676622925.arc
ORA-279 signalled during: alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1340_676622925.arc'...
Tue Feb 17 03:35:34 2009
alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1341_676622925.arc'
Tue Feb 17 03:35:34 2009
Media Recovery Log /home/oracle/app/oracle/oradata/test_s/archive/1_1341_676622925.arc
ORA-279 signalled during: alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1341_676622925.arc'...
Tue Feb 17 03:35:34 2009
alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1342_676622925.arc'
Tue Feb 17 03:35:34 2009
Media Recovery Log /home/oracle/app/oracle/oradata/test_s/archive/1_1342_676622925.arc
ORA-279 signalled during: alter database recover logfile '/home/oracle/app/oracle/oradata/test_s/archive/1_1342_676622925.arc'...
Tue Feb 17 03:35:34 2009
alter database recover cancel
Tue Feb 17 03:35:37 2009
Media Recovery Canceled
Completed: alter database recover cancel
12. 自动恢复
sqlplus /nolog
conn / as sysdba
alter database recover managed standby database disconnect from session;
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL>
告警日志:
Tue Feb 17 03:37:30 2009
alter database recover managed standby database disconnect from session
Tue Feb 17 03:37:30 2009
Attempt to start background Managed Standby Recovery process (test_s)
MRP0 started with pid=22, OS id=15363
Tue Feb 17 03:37:30 2009
MRP0: Background Managed Standby Recovery process started (test_s)
Managed Standby Recovery not using Real Time Apply
parallel recovery started with 2 processes
Tue Feb 17 03:37:35 2009
Waiting for all non-current ORLs to be archived...
Tue Feb 17 03:37:35 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Tue Feb 17 03:37:35 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 1 /home/oracle/app/oracle/oradata/test_s/redo01.rdo
Clearing online log 1 of thread 1 sequence number 1342
Tue Feb 17 03:37:35 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo01.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Tue Feb 17 03:37:36 2009
Completed: alter database recover managed standby database disconnect from session
Tue Feb 17 03:37:41 2009
Clearing online redo logfile 1 complete
Tue Feb 17 03:37:41 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Tue Feb 17 03:37:41 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 2 /home/oracle/app/oracle/oradata/test_s/redo02.rdo
Clearing online log 2 of thread 1 sequence number 1343
Tue Feb 17 03:37:41 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 2 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo02.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 2 complete
Tue Feb 17 03:37:46 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Tue Feb 17 03:37:46 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 3 /home/oracle/app/oracle/oradata/test_s/redo03.rdo
Clearing online log 3 of thread 1 sequence number 1341
Tue Feb 17 03:37:46 2009
Errors in file /home/oracle/app/oracle/admin/test_s/bdump/test_s_mrp0_15363.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03b.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/home/oracle/app/oracle/oradata/test_s/redo03.rdo'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 3 complete
Tue Feb 17 03:37:51 2009
Media Recovery Waiting for thread 1 sequence 1343
自动创建了在线重做日志文件
==================================================
用RMAN DUPLICATE创建备库
13. 备份主库
grep -q "ˆrcat" $ORACLE_HOME/network/admin/tnsnames.ora || \
cat >>$ORACLE_HOME/network/admin/tnsnames.ora <<'EOF'
rcat =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = DEV-DB-2)(PORT = 1531)))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = rcat))
)
EOF
rman catalog=rman/rman@rcat
create catalog tablespace "RMAN";
exit
rman target=/ catalog=rman/rman@rcat
register database;
crosscheck archivelog all;
delete noprompt expired archivelog all;
list backupset summary;
delete noprompt backupset;
exit
NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
rman target=/ catalog=rman/rman@rcat
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup as backupset incremental level 0 format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_%d_%I_%T_%U' database;
sql 'alter system archive log current';
#backup as backupset format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_%d_%I_%T_%U' archivelog all;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
exit
[oracle@DEV-RPT-2 ~]$ NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
[oracle@DEV-RPT-2 ~]$ rman target=/ catalog=rman/rman@rcat
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Feb 19 05:58:14 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=1973292924)
connected to recovery catalog database
RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> backup as backupset incremental level 0 format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_%d_%I_%T_%U' database;
7> sql 'alter system archive log current';
8> #backup as backupset format '/u01/software/oracle/backup/DEV-RPT-2/test/rman/arch_%d_%I_%T_%U' archivelog all;
release channel c1;
9> 10> release channel c2;
11> release channel c3;
12> release channel c4;
13> }
allocated channel: c1
channel c1: sid=1632 devtype=DISK
allocated channel: c2
channel c2: sid=1622 devtype=DISK
allocated channel: c3
channel c3: sid=1628 devtype=DISK
allocated channel: c4
channel c4: sid=1633 devtype=DISK
Starting backup at 2009-02-19 05:58:26
channel c1: starting incremental level 0 datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00002 name=/home/oracle/app/oracle/oradata/test/undotbs01.dbf
input datafile fno=00005 name=/home/oracle/app/oracle/oradata/test/ts_test01.dbf
channel c1: starting piece 1 at 2009-02-19 05:58:27
channel c2: starting incremental level 0 datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/app/oracle/oradata/test/system01.dbf
channel c2: starting piece 1 at 2009-02-19 05:58:27
channel c3: starting incremental level 0 datafile backupset
channel c3: specifying datafile(s) in backupset
input datafile fno=00003 name=/home/oracle/app/oracle/oradata/test/sysaux01.dbf
input datafile fno=00004 name=/home/oracle/app/oracle/oradata/test/users01.dbf
channel c3: starting piece 1 at 2009-02-19 05:58:28
channel c4: starting incremental level 0 datafile backupset
channel c4: specifying datafile(s) in backupset
including current control file in backupset
channel c4: starting piece 1 at 2009-02-19 05:58:30
channel c4: finished piece 1 at 2009-02-19 05:58:33
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1ek7nss4_1_1 tag=TAG20090219T055827 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:05
channel c4: starting incremental level 0 datafile backupset
channel c4: specifying datafile(s) in backupset
including current SPFILE in backupset
channel c4: starting piece 1 at 2009-02-19 05:58:35
channel c4: finished piece 1 at 2009-02-19 05:58:36
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1fk7nssa_1_1 tag=TAG20090219T055827 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:02
channel c1: finished piece 1 at 2009-02-19 05:58:39
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1bk7nss3_1_1 tag=TAG20090219T055827 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:12
channel c2: finished piece 1 at 2009-02-19 05:58:39
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1ck7nss3_1_1 tag=TAG20090219T055827 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:12
channel c3: finished piece 1 at 2009-02-19 05:58:40
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1dk7nss3_1_1 tag=TAG20090219T055827 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:13
Finished backup at 2009-02-19 05:58:40
sql statement: alter system archive log current
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN> exit
Recovery Manager complete.
[oracle@DEV-RPT-2 ~]$
14. 主库备份控制文件
sqlplus /nolog
conn / as sysdba
host rm -f /u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby
alter database create standby controlfile as '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
15. 修改主库归档日志参数
alter system set log_archive_dest_2='service=test_s optional reopen=60';
alter system set log_archive_dest_state_2='defer';
exit
14. 重新做备库
备库上
删除备库
sqlplus /nolog
conn / as sysdba
--alter database recover managed standby database cancel;
shutdown immediate
exit
(cd $ORACLE_BASE/oradata/test_s/ && rm -f *.dbf *.rdo *.ctl)
启动备库NOMOUNT
sqlplus /nolog
conn / as sysdba
startup nomount
exit
复制备库
rman的target连接主库, auxiliary连接备库
NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';export NLS_DATE_FORMAT
rman target=sys/change_on_install@test catalog=rman/rman@rcat auxiliary=/
run {
allocate auxiliary channel dup1 type disk;
allocate auxiliary channel dup2 type disk;
allocate auxiliary channel dup3 type disk;
allocate auxiliary channel dup4 type disk;
duplicate target database for standby
dorecover;
release channel dup1;
release channel dup2;
release channel dup3;
release channel dup4;
}
[oracle@DEV-pxy-1 ~]$ rman target=sys/change_on_install@test catalog=rman/rman@rcat auxiliary=/
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Feb 19 06:17:01 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=1973292924)
connected to recovery catalog database
connected to auxiliary database: TEST (not mounted)
RMAN> run {
2> allocate auxiliary channel dup1 type disk;
allocate auxiliary channel dup2 type disk;
3> 4> allocate auxiliary channel dup3 type disk;
5> allocate auxiliary channel dup4 type disk;
6> duplicate target database for standby
dorecover;
release channel dup1;
7> 8> release channel dup2;
9> release channel dup3;
10> 11> release channel dup4;
12> }
allocated channel: dup1
channel dup1: sid=1641 devtype=DISK
allocated channel: dup2
channel dup2: sid=1640 devtype=DISK
allocated channel: dup3
channel dup3: sid=1639 devtype=DISK
allocated channel: dup4
channel dup4: sid=1638 devtype=DISK
Starting Duplicate Db at 2009-02-19 06:17:20
contents of Memory Script:
{
set until scn 1885189;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
executing command: SET until clause
Starting restore at 2009-02-19 06:17:24
released channel: dup1
released channel: dup2
released channel: dup3
released channel: dup4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 02/19/2009 06:17:24
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
RMAN>
报错说找不到, 这是因为用alter database创建的控制文件备份, 没有登记在CATALOG
15. 登记控制文件备份
因为备库现在是NOMOUNT的, 所以RMAN必须连接主库, 进行登记
rman target=sys/change_on_install@test catalog=rman/rman@rcat
或直接在主库上运行
rman target=/ catalog=rman/rman@rcat
list copy of controlfile;
catalog controlfilecopy '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
list copy of controlfile;
exit
[oracle@DEV-pxy-1 ~]$ rman target=sys/change_on_install@test catalog=rman/rman@rcat
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Feb 19 06:31:37 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=1973292924)
connected to recovery catalog database
RMAN> list copy of controlfile;
RMAN> catalog controlfilecopy '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby';
cataloged control file copy
control file copy filename=/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby recid=5 stamp=679213903
RMAN> list copy of controlfile;
List of Control File Copies
Key S Completion Time Ckp SCN Ckp Time Name
------- - ------------------- ---------- ------------------- ----
2848 A 2009-02-19 06:31:43 1885235 2009-02-19 05:59:18 /u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby
RMAN> exit
Recovery Manager complete.
[oracle@DEV-pxy-1 ~]$
注销使用:
change controlfilecopy '/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby' uncatalog;
16. 恢复备库
rman target=sys/change_on_install@test catalog=rman/rman@rcat auxiliary=/
run {
allocate auxiliary channel dup1 type disk;
allocate auxiliary channel dup2 type disk;
allocate auxiliary channel dup3 type disk;
allocate auxiliary channel dup4 type disk;
duplicate target database for standby
dorecover;
release channel dup1;
release channel dup2;
release channel dup3;
release channel dup4;
}
[oracle@DEV-pxy-1 ~]$ rman target=sys/change_on_install@test catalog=rman/rman@rcat auxiliary=/
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Feb 19 06:33:23 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=1973292924)
connected to recovery catalog database
connected to auxiliary database: TEST (not mounted)
RMAN> run {
2> allocate auxiliary channel dup1 type disk;
3> allocate auxiliary channel dup2 type disk;
allocate auxiliary channel dup3 type disk;
4> 5> allocate auxiliary channel dup4 type disk;
6> duplicate target database for standby
7> dorecover;
8> release channel dup1;
9> release channel dup2;
10> release channel dup3;
11> release channel dup4;
12> }
allocated channel: dup1
channel dup1: sid=1640 devtype=DISK
allocated channel: dup2
channel dup2: sid=1639 devtype=DISK
allocated channel: dup3
channel dup3: sid=1638 devtype=DISK
allocated channel: dup4
channel dup4: sid=1642 devtype=DISK
Starting Duplicate Db at 2009-02-19 06:33:34
contents of Memory Script:
{
set until scn 1886308;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
executing command: SET until clause
Starting restore at 2009-02-19 06:33:37
channel dup1: restoring control file
channel dup1: copied control file copy
input filename=/u01/software/oracle/backup/DEV-RPT-2/test/rman/cf4standby
output filename=/home/oracle/app/oracle/oradata/test_s/control01.ctl
output filename=/home/oracle/app/oracle/oradata/test_s/control02.ctl
output filename=/home/oracle/app/oracle/oradata/test_s/control03.ctl
Finished restore at 2009-02-19 06:33:40
sql statement: alter database mount standby database
contents of Memory Script:
{
set until scn 1886308;
set newname for tempfile 1 to
"/home/oracle/app/oracle/oradata/test_s/temp01.dbf";
set newname for tempfile 2 to
"/home/oracle/app/oracle/oradata/test_s/ts_temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/home/oracle/app/oracle/oradata/test_s/system01.dbf";
set newname for datafile 2 to
"/home/oracle/app/oracle/oradata/test_s/undotbs01.dbf";
set newname for datafile 3 to
"/home/oracle/app/oracle/oradata/test_s/sysaux01.dbf";
set newname for datafile 4 to
"/home/oracle/app/oracle/oradata/test_s/users01.dbf";
set newname for datafile 5 to
"/home/oracle/app/oracle/oradata/test_s/ts_test01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed temporary file 1 to /home/oracle/app/oracle/oradata/test_s/temp01.dbf in control file
renamed temporary file 2 to /home/oracle/app/oracle/oradata/test_s/ts_temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 2009-02-19 06:33:47
channel dup1: starting datafile backupset restore
channel dup1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /home/oracle/app/oracle/oradata/test_s/undotbs01.dbf
restoring datafile 00005 to /home/oracle/app/oracle/oradata/test_s/ts_test01.dbf
channel dup1: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1bk7nss3_1_1
channel dup2: starting datafile backupset restore
channel dup2: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/app/oracle/oradata/test_s/system01.dbf
channel dup2: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1ck7nss3_1_1
channel dup3: starting datafile backupset restore
channel dup3: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /home/oracle/app/oracle/oradata/test_s/sysaux01.dbf
restoring datafile 00004 to /home/oracle/app/oracle/oradata/test_s/users01.dbf
channel dup3: reading from backup piece /u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1dk7nss3_1_1
channel dup1: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1bk7nss3_1_1 tag=TAG20090219T055827
channel dup1: restore complete, elapsed time: 00:00:15
channel dup3: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1dk7nss3_1_1 tag=TAG20090219T055827
channel dup3: restore complete, elapsed time: 00:00:15
channel dup2: restored backup piece 1
piece handle=/u01/software/oracle/backup/DEV-RPT-2/test/rman/data_TEST_1973292924_20090219_1ck7nss3_1_1 tag=TAG20090219T055827
channel dup2: restore complete, elapsed time: 00:00:16
Finished restore at 2009-02-19 06:34:04
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy recid=7 stamp=679214044 filename=/home/oracle/app/oracle/oradata/test_s/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=8 stamp=679214044 filename=/home/oracle/app/oracle/oradata/test_s/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=9 stamp=679214044 filename=/home/oracle/app/oracle/oradata/test_s/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=10 stamp=679214044 filename=/home/oracle/app/oracle/oradata/test_s/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=11 stamp=679214044 filename=/home/oracle/app/oracle/oradata/test_s/ts_test01.dbf
contents of Memory Script:
{
set until scn 1886308;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 2009-02-19 06:34:04
starting media recovery
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/home/oracle/app/oracle/oradata/test_s/system01.dbf'
released channel: dup1
released channel: dup2
released channel: dup3
released channel: dup4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 02/19/2009 06:34:05
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 1446 lowscn 1885189 found to restore
RMAN-06025: no backup of log thread 1 seq 1445 lowscn 1884681 found to restore
RMAN>
告警日志:
Thu Feb 19 06:33:40 2009
alter database mount standby database
Thu Feb 19 06:33:44 2009
Setting recovery target incarnation to 2
ARCH: STARTING ARCH PROCESSES
ARC0 started with pid=19, OS id=29083
Thu Feb 19 06:33:44 2009
ARC0: Archival started
ARC1: Archival started
ARCH: STARTING ARCH PROCESSES COMPLETE
Thu Feb 19 06:33:44 2009
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC0: Thread not mounted
ARC1 started with pid=20, OS id=29085
ARC1: Becoming the heartbeat ARCH
ARC1: Thread not mounted
Thu Feb 19 06:33:44 2009
Successful mount of redo thread 1, with mount id 1977316932
Thu Feb 19 06:33:44 2009
Physical Standby Database mounted.
Completed: alter database mount standby database
Thu Feb 19 06:33:49 2009
Full restore complete of datafile 4 /home/oracle/app/oracle/oradata/test_s/users01.dbf. Elapsed time: 0:00:01
checkpoint is 1885163
Full restore complete of datafile 3 /home/oracle/app/oracle/oradata/test_s/sysaux01.dbf. Elapsed time: 0:00:09
checkpoint is 1885163
last deallocation scn is 1874683
Thu Feb 19 06:34:00 2009
Full restore complete of datafile 2 /home/oracle/app/oracle/oradata/test_s/undotbs01.dbf. Elapsed time: 0:00:12
checkpoint is 1885160
last deallocation scn is 1880441
Full restore complete of datafile 5 /home/oracle/app/oracle/oradata/test_s/ts_test01.dbf. Elapsed time: 0:00:15
checkpoint is 1885160
last deallocation scn is 1816179
Thu Feb 19 06:34:03 2009
Full restore complete of datafile 1 /home/oracle/app/oracle/oradata/test_s/system01.dbf. Elapsed time: 0:00:15
checkpoint is 1885161
last deallocation scn is 1852843
Thu Feb 19 06:34:04 2009
Switch of datafile 1 complete to datafile copy
checkpoint is 1885161
Switch of datafile 2 complete to datafile copy
checkpoint is 1885160
Switch of datafile 3 complete to datafile copy
checkpoint is 1885163
Switch of datafile 4 complete to datafile copy
checkpoint is 1885163
Switch of datafile 5 complete to datafile copy
checkpoint is 1885160
Thu Feb 19 06:34:05 2009
alter database recover datafile list clear
Completed: alter database recover datafile list clear
Thu Feb 19 06:34:05 2009
alter database recover datafile list
1 , 2 , 3 , 4 , 5
Completed: alter database recover datafile list
1 , 2 , 3 , 4 , 5
Thu Feb 19 06:34:05 2009
alter database recover if needed
standby start until change 1886308
Media Recovery Start
Managed Standby Recovery not using Real Time Apply
parallel recovery started with 2 processes
ORA-279 signalled during: alter database recover if needed
standby start until change 1886308
...
Thu Feb 19 06:34:05 2009
alter database recover cancel
Signalling error 1152 for datafile 1!
ORA-1547 signalled during: alter database recover cancel...
Thu Feb 19 06:36:48 2009
db_recovery_file_dest_size of 2048 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
17. 自动恢复
sqlplus /nolog
conn / as sysdba
alter database recover managed standby database disconnect from session;
exit
18. 主库恢复归档
alter system set log_archive_dest_2='service=test_s optional reopen=60';
alter system set log_archive_dest_state_2='enable';
外部链接:
Creating a Standby Database with Recovery Manager
Step by step guide on how to create a physical standby database using RMAN without using duplicate command
Creating a Standby Database using RMAN (Recovery Manager)
-fin-