测试oracle streams之前先从源库通过手动物理备份,生成目的库。在作这个测试的时候,一直悲剧不断,刚开始的时候因为我的两个数据库的版本不一样,源是10.2.0.4,目的是10.2.0.5,在执行恢复
的时候提示是完成了,但是数据库就是不能打开,报ORA-01110错误,最后把源的版本也升级到10.2.0.5就正常了。
1,首先在源库登录数据库,并操作如下:
[oracle@rac1 gbk]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 30 10:04:20 2010
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn /as sysdba
Connected.
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> alter database begin backup;
alter database begin backup
*
ERROR at line 1:
ORA-01123: cannot start online backup; media recovery not enabled
由于源库是新建立的,在建的过程中没有启动归档,故报此错误。
SQL> select log_mode from v$database;
LOG_MODE
------------
NOARCHIVELOG
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 264241152 bytes
Fixed Size 1273152 bytes
Variable Size 88081088 bytes
Database Buffers 171966464 bytes
Redo Buffers 2920448 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> alter database begin backup;
Database altered.
SQL> host scp /app/oracle/oradata/gbk/*.dbf 192.168.183.60:/u01/soft/oradata/standby
[email protected]'s password:
sysaux01.dbf 100% 250MB 10.9MB/s 00:23
system01.dbf 100% 440MB 10.7MB/s 00:41
temp01.dbf 100% 20MB 20.0MB/s 00:01
undotbs01.dbf 100% 25MB 12.5MB/s 00:02
users01.dbf 100% 5128KB 5.0MB/s 00:01
SQL> alter database end backup;
Database altered.
SQL> alter system archive log current;
System altered.
SQL> alter database backup controlfile to trace;
Database altered.
SQL> create pfile='/tmp/pfilebak.ora' from spfile;
File created.
SQL>
这是在源库的所有操作剩下的就要全部在目的库上操作了。不过要先把备份的控制文件、归档日志和参数文件也scp到目的数据库服务器上。
2,通过源库的spfile文件备份,创建pfile;
SQL>startup nomount pfile='/tmp/pfilebak.ora'
ORACLE 例程已经启动。
Total System Global Area 209715200 bytes
Fixed Size 1272840 bytes
Variable Size 71304184 bytes
Database Buffers 134217728 bytes
Redo Buffers 2920448 bytes
SQL> create pfile='/tmp/pfilebak.ora' from spfile;
File created.
SQL>SQL> CREATE CONTROLFILE set DATABASE "demo" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 '/u01/soft/oradata/standby/redo01.log' SIZE 50M,
9 GROUP 2 '/u01/soft/oradata/standby/redo02.log' SIZE 50M,
10 GROUP 3 '/u01/soft/oradata/standby/redo03.log' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 '/u01/soft/oradata/standby/system01.dbf',
14 '/u01/soft/oradata/standby/undotbs01.dbf',
15 '/u01/soft/oradata/standby/sysaux01.dbf',
'/u01/soft/oradata/standby/users01.dbf'
16 17 CHARACTER SET ZHS16GBK
18 ;
控制文件已创建。
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE until cancel;
ORA-00279: 更改 399005 (在 12/30/2010 10:11:10 生成) 对于线程 1 是必需的
ORA-00289: 建议:
/u01/soft/flash_recovery_area/DEMO/archivelog/2010_12_30/o1_mf_1_3_%u_.arc
ORA-00280: 更改 399005 (用于线程 1) 在序列 #3 中
指定日志: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: 无法打开归档日志
'/u01/soft/flash_recovery_area/DEMO/archivelog/2010_12_30/o1_mf_1_3_%u_.arc'
ORA-27037: 无法获得文件状态
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: 无法打开归档日志
'/u01/soft/flash_recovery_area/DEMO/archivelog/2010_12_30/o1_mf_1_3_%u_.arc'
ORA-27037: 无法获得文件状态
Linux Error: 2: No such file or directory
Additional information: 3
SQL> alter database open resetlogs;
数据库已更改。
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL>
至此恢复完成。数据库正常,下一步就要开始测试,oracle streams了!