database migrate

Database-exporter release v1.0

June 21, 2013 Architect, software No comments

Database-exporter发布 感谢wucharles,一个充满Geek精神的小伙。

1.supports export database from each other. (you need write driver by yourself,now support oracle and MySQL)

2.supported database: Oracle, MySQL.(from oracle to mysql  or mysql to oracle)

3.supports multi source tables merged into one target table.(both mysql and oracle)

4.supports one source table split into multi target tables.(both mysql and oracle)

5.supports source table column name different from target table column name.(both mysql and oracle)

6.supports multi tables exported concurrently.

7.supports one table's data exported concurrently by page.

8.supports LOB,Long,raw datatype.

8.supports database plugin.(eg you can write driver to load sqlserver data to oracle) 

Github地址:Database-exporter

Cloning an Oracle Home

March 2, 2012 migration, oracle 1 comment

Cloning an Oracle Home


Cloning an Oracle home involves creating a copy of the Oracle home and then configuring it for a new environment. If you are performing multiple Oracle Database installations, then you may want to use this method to create each Oracle home, because copying files from an existing Oracle Database installation takes less time than creating a new version of them. This method is also useful if the Oracle home that you are cloning has had patches applied to it. When you clone the Oracle home, the new Oracle home has the patch updates.

When you clone Oracle homes using release 11.2 Database Control, you must update the exclude file list. This file list specifies files that need not be included when the source Oracle home is archived because these files are not required for the cloning operation. Do not include the following files in the archive:

sqlnet.ora
tnsnames.ora
listener.ora
oratab

Note:
In addition to cloning an Oracle home, you can clone individual Oracle Database installations by using Oracle Enterprise Manager Database Control. Oracle Database Administrator’s Guide provides detailed information about cloning Oracle Database installations and Oracle homes.
This appendix includes information about the following topics:

Cloning an Oracle Home
Configuring Oracle Configuration Manager in a Cloned Oracle Home
B.1 Cloning an Oracle Home

Perform the following to clone an Oracle home:

Verify that the installation of Oracle Database to clone is successful.

You can do this by reviewing the installActionsdate_time.log file for the installation session, which is typically located in the /orainventory_location/logs directory.

If you install patches, then check their status using the following:

$ cd $ORACLE_HOME/OPatch
Include $ORACLE_HOME/OPatch in $PATH

$ opatch lsinventory
Stop all processes related to the Oracle home. See Chapter 7, “Removing Oracle Database Software” for more information about stopping the processes for an Oracle home.

Create a ZIP file with the Oracle home (but not the Oracle base) directory.

For example, if the source Oracle installation is in the /u01/app/oracle/product/11.2.0/dbhome_1, then you zip the dbhome_1 directory by using the following command:

# zip -r dbhome_1.zip /u01/app/oracle/product/11.2.0/dbhome_1
Do not include the admin, fast_recovery_area, and oradata directories that are under the Oracle base directory. These directories are created in the target installation later, when you create a new database there.

Copy the ZIP file to the root directory of the target computer.

Extract the ZIP file contents by using the following command:

# unzip -d / dbhome_1.zip
Repeat steps 4 and 5 for each computer where you want to clone the Oracle home, unless the Oracle home is on a shared storage device.

On the target computer, change the directory to the unzipped Oracle home directory, and remove all the .ora (*.ora) files present in the unzipped $ORACLE_HOME/network/admin directory.

From the $ORACLE_HOME/clone/bin directory, run the clone.pl file for the unzipped Oracle home. Use the following syntax:

$ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=”target_oracle_base” ORACLE_HOME=”target_oracle_home”
OSDBA_GROUP=OSDBA_privileged_group OSOPER_GROUP=OSOPER_privileged_group -defaultHomeName
For example:

$ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=”/u01/app/oracle/” ORACLE_HOME=”/u01/app/oracle/product/11.2.0/dbhome_1″
OSDBA_GROUP=dba OSOPER_GROUP=oper -defaultHomeName
Oracle Universal Installer starts, and then records the cloning actions in the cloneActionstimestamp.log file. This log file is typically located in /orainventory_location/logs directory.

To configure the connection information for the new database, run Net Configuration Assistant:

$ cd $ORACLE_HOME/bin
$ ./netca
To create a new database for the newly cloned Oracle home, run Database Configuration Assistant:

$ cd $ORACLE_HOME/bin
$ ./dbca
See Also:
Oracle Universal Installer and OPatch User’s Guide for Windows and UNIX for detailed information about using Oracle Universal Installer to clone an Oracle Database home

Oracle Database Administrator’s Guide for information about cloning Oracle databases and cloning an Oracle Database home

B.2 Configuring Oracle Configuration Manager in a Cloned Oracle Home

Perform the following to configure Oracle Configuration Manager for a cloned Oracle home:

Run the following command from $ORACLE_HOME/ccr/state:
$ rm -rf *.ll*
Run the following command from $ORACLE_HOME/ccr/inventory:
$ cp core.jar pending
Run the following commands from $ORACLE_HOME/ccr/bin:
$ ./emSnapshotEnv
$ ./deployPackages
Run the following command from $ORACLE_HOME/ccr/bin and provide the proper credentials:
$ ./configCCR
If Oracle Configuration Manager was manually configured using setupCCR, then perform the following in the cloned Oracle home:

Delete all the subdirectories of the $ORACLE_HOME/ccr/hosts directory to remove previously configured hosts.

Run the following command from $ORACLE_HOME/ccr/bin:

$ ./configCCR -a
If you installed Oracle Configuration Manager in the original Oracle home but have not configured it, then run the following command in the cloned Oracle home:

$ setupCCR

下面给个范例:

[oracle@rac03 bin]$ /data/oracle/product/11203/db1/perl/bin/perl clone.pl ORACLE_BASE=”/data/oracle” ORACLE_HOME=”/data/oracle/product/11203/db1″ OSDBA_GROUP=dba -defaultHomeName
./runInstaller -clone -waitForCompletion “ORACLE_BASE=/data/oracle” “ORACLE_HOME=/data/oracle/product/11203/db1” “oracle_install_OSDBA=dba” -defaultHomeName -defaultHomeName -silent -noConfig -nowait
Starting Oracle Universal Installer…

Checking swap space: must be greater than 500 MB. Actual 129576 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2012-02-14_02-44-44PM. Please wait …Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.

You can find the log of this install session at:
/home/oracle/oraInventory/logs/cloneActions2012-02-14_02-44-44PM.log
………………………………………………………………………………………. 100% Done.

Installation in progress (Tuesday, February 14, 2012 2:44:54 PM CST)
……………………………………………………………………. 79% Done.
Install successful

Linking in progress (Tuesday, February 14, 2012 2:45:00 PM CST)
Link successful

Setup in progress (Tuesday, February 14, 2012 2:45:51 PM CST)
Setup successful

End of install phases.(Tuesday, February 14, 2012 2:46:14 PM CST)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script ‘/home/oracle/oraInventory/orainstRoot.sh’ with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.
The following configuration scripts need to be executed as the “root” user.
/home/oracle/oraInventory/orainstRoot.sh
/data/oracle/product/11203/db1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as “root”
3. Run the scripts

The cloning of OraHome1 was successful.
Please check ‘/home/oracle/oraInventory/logs/cloneActions2012-02-14_02-44-44PM.log’ for more details.

可见oracle clone 自动进行了relink 和 oraInventory 创建,完全可以代替relink 进行数据库soft的迁移工作。

记录一次9i单节点转rac,以及一套rac存储迁移之后的整体容灾方案

November 7, 2011 migration, oracle 1 comment

数据库版本9.2.0.1 OS版本 AIX5

由于9.2.0.1的默认maxlogfiles 为5 maxinstance 为1所以需要重建controlfile 修改maxinstance为4 maxlogfiles 为 16

SQL> alter database backup controlfile to trace;

cd $ORACLE_BASE/admin/priap/udump/

查看最新的trace文件 priap_ora_143648.trc

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE “PRIAP” NORESETLOGS NOARCHIVELOG
— SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5 —–>(16)
MAXLOGMEMBERS 3
MAXDATAFILES 309
MAXINSTANCES 1 ——>(4)
MAXLOGHISTORY 5445
LOGFILE
GROUP 1 ‘/dev/rredo01’ SIZE 100M,
GROUP 2 ‘/dev/rredo02’ SIZE 100M,
GROUP 3 ‘/dev/rredo03’ SIZE 100M
— STANDBY LOGFILE
DATAFILE
‘/dev/rsystem01’,
‘/dev/rundotbs01’,
‘/dev/rcwmlite01’,
‘/dev/rPRIAP_INDEX16’
‘/dev/rdksh01’,
‘/dev/rdksh02’,
‘/dev/rDOGPHOTO’,
‘/dev/rdrsys01’,
‘/dev/rindx01’,
‘/dev/rlogmnr01’,
‘/dev/rodm01’,
‘/dev/rPRIAP01’,
‘/dev/rPRIAP02’,
‘/dev/rPRIAP04’,
‘/dev/rPRIAP06’,
‘/dev/rPRIAP19’,
‘/dev/rPRIAP18’,
‘/dev/rPRIAP17’,
‘/dev/rPRIAP16’,
‘/dev/rPRIAP15’,
‘/dev/rPRIAP14’,
‘/dev/rPRIAP13’,
‘/dev/rPRIAP12’,
‘/dev/rPRIAP11’,
‘/dev/rPRIAP43’,
‘/dev/rPRIAP42’,
‘/dev/rPRIAP41’,
‘/dev/rPRIAP40’,
‘/dev/rPRIAP29’,
‘/dev/rPRIAP28’,
‘/dev/rPRIAP27’,
‘/dev/rPRIAP26’,
‘/dev/rPRIAP25’,
‘/dev/rPRIAP24’,
‘/dev/rPRIAP23’,
‘/dev/rPRIAP22’,
‘/dev/rPRIAP21’,
‘/dev/rPRIAP20’,
‘/dev/rPRIAP10’,
‘/dev/rPRIAP09’,
‘/dev/rPRIAP08’,
‘/dev/rPRIAP53’,
‘/dev/rPRIAP52’,
‘/dev/rPRIAP51’,
‘/dev/rPRIAP50’,
‘/dev/rPRIAP49’,
‘/dev/rPRIAP48’,
‘/dev/rPRIAP47’,
‘/dev/rPRIAP46’,
‘/dev/rPRIAP45’,
‘/dev/rPRIAP70’,
‘/dev/rPRIAP69’,
‘/dev/rPRIAP68’,
‘/dev/rPRIAP67’,
‘/dev/rPRIAP66’,
‘/dev/rPRIAP65’,
‘/dev/rPRIAP64’,
‘/dev/rPRIAP63’,
‘/dev/rPRIAP62’,
‘/dev/rPRIAP87’,
‘/dev/rPRIAP86’,
‘/dev/rPRIAP85’,
‘/dev/rPRIAP84’,
‘/dev/rPRIAP83’,
‘/dev/rPRIAP82’,
‘/dev/rPRIAP81’,
‘/dev/rPRIAP80’,
‘/dev/rPRIAP79’,
‘/dev/rPRIAP95’,
‘/dev/rPRIAP94’,
‘/dev/rPRIAP93’,
‘/dev/rPRIAP92’,
‘/dev/rPRIAP91’,
‘/dev/rPRIAP90’,
‘/dev/rPRIAP89’,
‘/dev/rPRIAP88’,
‘/dev/rPRIAP78’,
‘/dev/rPRIAP77’,
‘/dev/rPRIAP76’,
‘/dev/rPRIAP75’,
‘/dev/rPRIAP74’,
‘/dev/rPRIAP73’,
‘/dev/rPRIAP72’,
‘/dev/rPRIAP71’,
‘/dev/rPRIAP61’,
‘/dev/rPRIAP60’,
‘/dev/rPRIAP59’,
‘/dev/rPRIAP58’,
‘/dev/rPRIAP57’,
‘/dev/rPRIAP56’,
‘/dev/rPRIAP55’,
‘/dev/rPRIAP54’,
‘/dev/rPRIAP44’,
‘/dev/rPRIAP39’,
‘/dev/rPRIAP38’,
‘/dev/rPRIAP37’,
‘/dev/rPRIAP36’,
‘/dev/rPRIAP35’,
‘/dev/rPRIAP34’,
‘/dev/rPRIAP33’,
‘/dev/rPRIAP32’,
‘/dev/rPRIAP31’,
‘/dev/rPRIAP30’,
‘/dev/rPRIAP07’,
‘/dev/rPRIAP05’,
‘/dev/rPRIAP03’,
‘/dev/rPRIAP21-01’,
‘/dev/rpriap21-02’,
‘/dev/rPRIAP22-01’,
‘/dev/rPRIAP22-02’,
‘/dev/rPRIAP23-01’,
‘/dev/rPRIAP23-02’,
‘/dev/rPRIAP24-01’,
‘/dev/rPRIAP24-02’,
‘/dev/rPRIAP_INDEX01’,
‘/dev/rPRIAP_INDEX04’,
‘/dev/rPRIAP_INDEX31’,
‘/dev/rPRIAP_INDEX30’,
‘/dev/rPRIAP_INDEX29’,
‘/dev/rPRIAP_INDEX24’,
‘/dev/rPRIAP_INDEX23’,
‘/dev/rPRIAP_INDEX22’,
‘/dev/rPRIAP_INDEX21’,
‘/dev/rPRIAP_INDEX20’,
‘/dev/rPRIAP_INDEX18’,
‘/dev/rPRIAP_INDEX79’,
‘/dev/rPRIAP_INDEX78’,
‘/dev/rPRIAP_INDEX77’,
‘/dev/rPRIAP_INDEX76’,
‘/dev/rPRIAP_INDEX75’,
‘/dev/rPRIAP_INDEX74’,
‘/dev/rPRIAP_INDEX73’,
‘/dev/rPRIAP_INDEX72’,
‘/dev/rPRIAP_INDEX71’,
‘/dev/rPRIAP_INDEX70’,
‘/dev/rPRIAP_INDEX69’,
‘/dev/rPRIAP_INDEX68’,
‘/dev/rPRIAP_INDEX67’,
‘/dev/rPRIAP_INDEX66’,
‘/dev/rPRIAP_INDEX65’,
‘/dev/rPRIAP_INDEX64’,
‘/dev/rPRIAP_INDEX63’,
‘/dev/rPRIAP_INDEX62’,
‘/dev/rPRIAP_INDEX61’,
‘/dev/rPRIAP_INDEX60’,
‘/dev/rPRIAP_INDEX59’,
‘/dev/rPRIAP_INDEX58’,
‘/dev/rPRIAP_INDEX57’,
‘/dev/rPRIAP_INDEX56’,
‘/dev/rPRIAP_INDEX55’,
‘/dev/rPRIAP_INDEX54’,
‘/dev/rPRIAP_INDEX53’,
‘/dev/rPRIAP_INDEX52’,
‘/dev/rPRIAP_INDEX51’,
‘/dev/rPRIAP_INDEX50’,
‘/dev/rPRIAP_INDEX49’,
‘/dev/rPRIAP_INDEX48’,
‘/dev/rPRIAP_INDEX47’,
‘/dev/rPRIAP_INDEX46’,
‘/dev/rPRIAP_INDEX45’,
‘/dev/rPRIAP_INDEX44’,
‘/dev/rPRIAP_INDEX43’,
‘/dev/rPRIAP_INDEX42’,
‘/dev/rPRIAP_INDEX41’,
‘/dev/rPRIAP_INDEX40’,
‘/dev/rPRIAP_INDEX36’,
‘/dev/rPRIAP_INDEX35’,
‘/dev/rPRIAP_INDEX34’,
‘/dev/rPRIAP_INDEX33’,
‘/dev/rPRIAP_INDEX32’,
‘/dev/rPRIAP_INDEX17’,
‘/dev/rPRIAP_INDEX15’,
‘/dev/rPRIAP_INDEX14’,
‘/dev/rPRIAP_INDEX13’,
‘/dev/rPRIAP_INDEX12’,
‘/dev/rPRIAP_INDEX11’,
‘/dev/rPRIAP_INDEX10’,
‘/dev/rPRIAP_INDEX09’,
‘/dev/rPRIAP_INDEX39’,
‘/dev/rPRIAP_INDEX38’,
‘/dev/rPRIAP_INDEX37’,
‘/dev/rPRIAP_INDEX28’,
‘/dev/rPRIAP_INDEX27’,
‘/dev/rPRIAP_INDEX26’,
‘/dev/rPRIAP_INDEX25’,
‘/dev/rPRIAP_INDEX19’,
‘/dev/rPRIAP_INDEX08’,
‘/dev/rPRIAP_INDEX07’,
‘/dev/rPRIAP_INDEX06’,
‘/dev/rPRIAP_INDEX05’,
‘/dev/rPRIAP_INDEX03’,
‘/dev/rPRIAP_INDEX02’,
‘/dev/rPRIAP_LOG01’,
‘/dev/rPRIAP_LOG02’,
‘/dev/rPRIAP_LOG69’,
‘/dev/rPRIAP_LOG68’,
‘/dev/rPRIAP_LOG67’,
‘/dev/rPRIAP_LOG66’,
‘/dev/rPRIAP_LOG65’,
‘/dev/rPRIAP_LOG64’,
‘/dev/rPRIAP_LOG63’,
‘/dev/rPRIAP_LOG62’,
‘/dev/rPRIAP_LOG16’,
‘/dev/rexample01’,
‘/dev/rPRIAP_LOG72’,
‘/dev/rPRIAP_LOG71’,
‘/dev/rPRIAP_LOG70’,
‘/dev/rPRIAP_LOG15’,
‘/dev/rPRIAP_LOG14’,
‘/dev/rPRIAP_LOG13’,
‘/dev/rPRIAP_LOG12’,
‘/dev/rPRIAP_LOG11’,
‘/dev/rPRIAP_LOG10’,
‘/dev/rPRIAP_LOG09’,
‘/dev/rPRIAP_LOG08’,
‘/dev/rPRIAP_LOG61’,
‘/dev/rPRIAP_LOG60’,
‘/dev/rPRIAP_LOG59’,
‘/dev/rPRIAP_LOG58’,
‘/dev/rPRIAP_LOG57’,
‘/dev/rPRIAP_LOG56’,
‘/dev/rPRIAP_LOG55’,
‘/dev/rPRIAP_LOG54’,
‘/dev/rPRIAP_LOG53’,
‘/dev/rPRIAP_LOG52’,
‘/dev/rPRIAP_LOG51’,
‘/dev/rPRIAP_LOG50’,
‘/dev/rPRIAP_LOG49’,
‘/dev/rPRIAP_LOG47’,
‘/dev/rPRIAP_LOG46’,
‘/dev/rPRIAP_LOG45’,
‘/dev/rPRIAP_LOG44’,
‘/dev/rPRIAP_LOG43’,
‘/dev/rPRIAP_LOG42’,
‘/dev/rPRIAP_LOG41’,
‘/dev/rPRIAP_LOG40’,
‘/dev/rPRIAP_LOG33’,
‘/dev/rPRIAP_LOG48’,
‘/dev/rPRIAP_LOG32’,
‘/dev/rPRIAP_LOG31’,
‘/dev/rPRIAP_LOG30’,
‘/dev/rPRIAP_LOG29’,
‘/dev/rPRIAP_LOG28’,
‘/dev/rPRIAP_LOG27’,
‘/dev/rPRIAP_LOG26’,
‘/dev/rPRIAP_LOG25’,
‘/dev/rPRIAP_LOG39’,
‘/dev/rPRIAP_LOG38’,
‘/dev/rPRIAP_LOG37’,
‘/dev/rPRIAP_LOG36’,
‘/dev/rPRIAP_LOG35’,
‘/dev/rPRIAP_LOG34’,
‘/dev/rPRIAP_LOG24’,
‘/dev/rPRIAP_LOG23’,
‘/dev/rPRIAP_LOG22’,
‘/dev/rPRIAP_LOG21’,
‘/dev/rPRIAP_LOG20’,
‘/dev/rPRIAP_LOG19’,
‘/dev/rPRIAP_LOG18’,
‘/dev/rPRIAP_LOG17’,
‘/dev/rPRIAP_LOG07’,
‘/dev/rPRIAP_LOG06’,
‘/dev/rPRIAP_LOG05’,
‘/dev/rPRIAP_LOG04’,
‘/dev/rPRIAP_LOG03’,
‘/dev/rtools01’,
‘/dev/rtools04’,
‘/dev/rtools05’,
‘/dev/rtools03’,
‘/dev/rtools02’,
‘/dev/rTS_FZ4_DATA’,
‘/dev/rTS_DATA_APPSYS’,
‘/dev/rTS_FZ4_DEFAULT0’,
‘/dev/rTS_FZ4_DEFAULT1’,
‘/dev/rTS_FZ4_DIC’,
‘/dev/rTS_FZ4_INDEX’,
‘/dev/rTS_IND_APPSYS’,
‘/dev/rusers01’,
‘/dev/rxdb01’,
‘/dev/rxdb02’,
‘/dev/rundotbs03’,
‘/dev/rsystem02’
CHARACTER SET ZHS16GBK
;

新建3个lv 用于controlfile (scontrol01 scontrol02 scontrol03)

修改initpriap.ora (将controlfile 路径改为’/dev/rscontrol01′,’/dev/rscontrol02′,’/dev/rscontrol03′)

关闭实例 将实例启动到mount状态

SQL>shutdown immediate;
SQL>startup nomount;

用上面语句创建controlfile;

Control file created.

SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required

SQL> alter database open;

Database altered.

SQL>

controlfile 重建完毕

单实例转rac

SQL>shutdown immediate;

关闭数据库

将rac1 rac2节点原oravg varryoff 将single_inst 节点datavg import至 rac1 rac2 节点.

将datavg 加入hacmp资源组 (将datavg置于concurrent mode)

用rac1 节点开启数据库 (指向control01,control02,control03 变为 scontrol01,scontrol02,scontrol01)

修改db_files=500

SQL>alter system set db_files=500 scope=spfile;
SQL>shutdown immediate;
SQL>startup mount;

将数据库置于mount状态

添加thread 2 日志组

SQL>alter database add logfile thread 2 group 4 (‘/dev/rredo11’) size 100M;

SQL>alter database add logfile thread 2 group 5 (‘/dev/rrdeo12’) szie 100M;

SQL>alter database add logfile thread 2 group 6 (‘/dev/rredo13’) size 100M;

打开数据库

SQL>alter database open

添加undo tablespace

SQL> create undo tablespace undotbs2 datafile ‘/dev/rundotbs03′ size 25000M;

SQL> alter system set undo_tablespace=’UNDOTBS2′ scope=both sid=’priap2’;

将redo logfile 置于public

SQL> alter database enable public thread 2;

SQL>@catclust.sql 创建rac视图

将 44 节点打开数据库 (control* 变为scontrol*)
同时将spfile中的undo_tablespace指定为undotbs2

SQL>startup;

SQL>select instance_name ,status from gv$instance;

INSTANCE_NAME STATUS
———— ——
priap1 open
priap2 open

开启listener (rac1,rac2) lsnrctl start

迁移完成.

———————————————————————————————————————————-

下面我们利用9i dataguard 将另外一套rac迁移至新的存储 (这套rac将和上面那套rac做容灾)

迁移思路, 利用rman copy 做一个rac-single_instance 的DG 利用failover 将standby 置为primary 将VG加入hacmp从而利用原rac两个节点将新库拉起

迁移步骤:
1.配置dataguard rac3,rac4–single_inst

alter system set log_archive_dest_state_2=defer scope=both sid=’*’;
alter system set log_archive_dest_2=’service=priap_dg’ scope=both sid=’*’;
alter system set standby_file_management=AUTO scope=both sid=’*’;
alter system set fal_client=priap_dg scope=both sid=’*’;
alter system set fal_server=priap1,priap2 scope=both sid=’*’;

alter system set log_archive_dest_state_2=defer scope=both;
alter system set log_archive_dest_2=’service=priap’ scope=both;
alter system set standby_file_management=AUTO scope=both;
alter system set fal_client=’priap1,priap2′ scope=both;
alter system set fal_server=priap_dg scope=both;

rac3,rac4,single_inst 节点TNS以及listener

rac3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.39)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = priap)
(INSTANCE_NAME = priap2)
)
)

rac4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.34)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = priap)
(INSTANCE_NAME = priap1)
)
)

single_inst =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.77)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = priap)
)
)

single_inst listener.ora

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = zaxxrkback)(PORT = 1521))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap)
)
)

rac3 listener.ora

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.39)(PORT = 1521))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = priap)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap2)
)
)

rac4 listener.ora

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.14.18.34)(PORT = 1521))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = priap)
(ORACLE_HOME = /oracle/app/oracle/product/920)
(SID_NAME = priap1)
)
)

2.检查两端数据一致性:archive log list (两端)

3.failover database
(1).检查归档文件是否连续,是否有gap

在standby库执行

SQL> select THREAD#,LOW_SEQUENCE#,HIGH_SEQUENCE# from v$archive_gap;

(2).如果步骤1查询出来纪录,则在primary库上执行,否则跳过此步骤

在主库上执行语句,按步骤1查询出来的纪录找出归档文件

SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN XX AND XX;

–如果primary存在,拷贝相应的归档到STANDBY数据库,并注册.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE ‘xxx’;

(3).检查归档文件是否完整

分别在primary/standby执行下列语句:

SQL> select distinct thread#,max(sequence#) over(partition by thread#) a from v$archived_log;

把相差的归档复制到待转换的standby服务器,并手工register

4.开始做failover

察看standby进程状态

SQL> select process,client_process,sequence#,status from v$managed_standby;

SQL> alter database recover managed standby database finish force ;

FORCE关键字将会停止当前活动的RFS进程,以便立刻执行failover。

SQL> alter database recover managed standby database finish skip standby logfile;

SQL> alter database commit to switchover to primary;

SQL> shutdown immediate

5.将single_inst 节点的datavg挂到rac3,rac4 同时将datavg挂到hacmp中,用rac3节点的initpriap1.ora 开启数据库

SQL> create spfile from pfile;
SQL> startup;

rac4节点同时开启数据库

SQL> startup;

6.查看数据库状态
SQL> select database_role from v$database;

Failover切换成功

7. 将single_inst 节点挂到rac1,rac2节点 原库所在存储,将oravg,oravg2剔除concurrent vg;

8. 启动priap database ;(rac->单实例)

9. 切换完成

现在我们完成了单节点转rac 以及另外一套rac的迁移工作,现在需要的工作就是两套rac之间的容灾工作。为了不影响两套rac之间独立应用,我们采取ogg单表重做的方式,使用exp的方法指定
SCN加载trail文件,过程略

以后会推出9i单节点转10g RAC的文档。

continuing ……