oracle单实例通过dataguard迁移到RAC(四)

2015-01-23 21:54:04 · 作者: · 浏览: 12
uct/11.2.0/db_1/dbs/test2_pfile.ora'

4. 创建备库,在从库 RMAN 恢复:

[oracle@srvrac1~]$ export ORACLE_SID=test11

[oracle@srvrac1 ~]$ rman target sys/oracle@test1 auxiliary sys/oracle@test21

?

DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASENOFILENAMECHECK;

5. 启动重做应用:

sql> alter database recover managed standbydatabase disconnect from session

或实时同步ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENTLOGFILE DISCONNECT FROM SESSION;

6. 测试:

在主库更新:

SQL>insert into test.test_table values (17,'jhpcc');

?

1 rowcreated.

?

SQL>commit;

?

Commitcomplete.

?

SQL>alter system archive log current;

?

System altered.

在备库查看是否同步过来,分析问题看两边的alert.log

sql> alter database recover managed standbydatabase cancel;

sql>alter database open read only;

sql>SQL> select * from test.test_table;

?

ID NAME

---------- ----------

?

17 jhpcc

7. 11g已经支持活动备库,可以让数据库在只读状态下打开,同时启动日志应用:

alter database recover managed standby databasedisconnect

?

8. createspfile='+DATA/cltdbhz1/spfilecltdbhz1.ora' from pfile='/bee/app/oracle/product/11.2.0/db_1/dbs/cltdbhz1_pfile.ora';

?

?

注册第二个节点到 CRS

1. [oracle@srvrac2 dbs]$ catinittest22.ora

2. spfile='+DATA/test2/spfiletest2.ora

3. 从库的第二个节点上, $ export ORACLE_SID=test22

$ sqlplus / as sysdba sql> startup mount;

4. srvctl add database -d test2 -ntest1 -o /bee/app/oracle/product/11.2.0/db_1 -p +DATA/test2/spfiletest2.ora -rphysical_standby -a DATA(oracle用户执行)

5. srvctl add instance -d test2 -itest11 -n srvrac1

6. srvctl add instance -d test2 -itest22 -n srvrac2

7. srvctl start database -d test2

8. srvctl modify database -d test2-s mount

9. srvctl status database –d test2

?

在第三步startup mount时

由于参数文件是从单实例的主库生成的,作为RAC第二个节点启动时会先后报了几个错:

问题1:

ORA-00304: requested INSTANCE_NUMBER isbusy

解决:

alter system set instance_number=1scope=spfile sid='test11';

alter system set instance_number=2scope=spfile sid='test22';

然后重启

?

问题2:

ORA-01102: cannot mount database inEXCLUSIVE mode

解决:

SQL> show parameter cluster_databas

?

NAME TYPE VALUE

----------------------------------------------- ------------------------------

cluster_database boolean FALSE

cluster_database_instances integer 1

SQL> alter system setcluster_database=true scope=spfile;

alter system setcluster_database_instances=2 scope=spfile;

System altered.

?

select instance_name,status from gv$instance;

?

问题3:

ORA-01620: no public threads are availablefor mounting

Cause: The value of the initializationparameter THREAD is zero, its default value. There are no threads which havebeen publicly enabled, and not mounted.

?

Action: Shut down the instance, change theva lue of the initialization parameter to a thread which is privately enabledand not mounted. If the database is open in another instance, then a thread maybe publicly enabled.

?

?

?

SQL> show parameter thread

?

NAME TYPE VALUE

----------------------------------------------- ------------------------------

parallel_threads_per_cpu integer 2

thread integer 0

alter system set thread=1 scope=spfilesid='test11';

alter system set thread=2 scope=spfilesid='test22';

检查状态:

select * from V$DATAGUARD_STATUSorder by TIMESTAMP;

select STATUS, GAP_STATUS fromV$ARCHIVE_DEST_STATUS where DEST_ID = 2;

select SEQUENCE#, FIRST_TIME,NEXT_TIME, APPLIED, ARCHIVED from V$ARCHIVED_LOG where name = 'test2' order byFIRST_TIME;

select DEST_ID, STATUS,DESTIN